-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.go
54 lines (43 loc) · 934 Bytes
/
build.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
49
50
51
52
53
54
package main
import (
"embed"
"encoding/json"
"net"
"net/http"
utl "webapp/utilities"
)
//go:embed www
var fs embed.FS
//go:embed build.json
var buildjs string
type options struct {
Url string `json:Url`
Size string `json:Size`
Args []string `json:Args`
FullScreen bool
}
func readFile(file string, Url string) {
e := []byte(file)
var newOption options
json.Unmarshal(e, &newOption)
// Url := newOption.Url
Size := newOption.Size
Args := newOption.Args
FullScreen := newOption.FullScreen
pathName := utl.LocateChrome()
utl.CreateWindow(pathName, Url, Size, FullScreen, Args)
}
func checkErrors(err error) {
if err != nil {
panic(err)
}
}
func main() {
ln, err := net.Listen("tcp", "127.0.0.1:0")
checkErrors(err)
defer ln.Close()
go http.Serve(ln, http.FileServer(http.FS(fs)))
fileName := buildjs
Url := "http://" + ln.Addr().String() + "/www"
readFile(fileName, Url)
}