-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
48 lines (38 loc) · 882 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"flag"
"fmt"
"log"
"math/rand"
"net/http"
"time"
"github.com/fishioon/wxgo/webwx"
)
var (
Version string
BuildTime string
)
type Config struct {
}
func main() {
listenHost := flag.String("host", "127.0.0.1:9981", "listen host")
showVersion := flag.Bool("version", false, "show version")
flag.Parse()
if *showVersion {
fmt.Printf("Version: %s\nBuild: %s\n", Version, BuildTime)
return
}
rand.Seed(time.Now().Unix())
/*
str := strconv.Itoa(rand.Int())
deviceID := "e" + str[2:17]
*/
// start already login session
// wait login
go webwx.Run(msgHandle, "")
http.HandleFunc("/cmd/shell", handleScript)
http.HandleFunc("/cmd/network/location", handleLocation)
http.HandleFunc("/webwx/new", WebwxRun)
fmt.Printf("login wechat with [http://%s/webwx/new]\n", *listenHost)
log.Fatal(http.ListenAndServe(*listenHost, nil))
}