-
Notifications
You must be signed in to change notification settings - Fork 21
/
main.go
91 lines (81 loc) · 2.05 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package main
import (
"embed"
"log"
"os"
"github.com/martinlindhe/notify"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
"easyclash/app"
"easyclash/utils"
)
//go:embed build/appicon.png
var icon []byte
//go:embed frontend/dist
var ui embed.FS
//go:embed .easy_clash
var ruleSet embed.FS
var mode = ""
func init() {
path, _ := os.UserHomeDir()
err := utils.SaveDir(ruleSet, path, mode == "dev")
if err != nil {
notify.Alert("EasyClash", "", "init conf dir error", "")
log.Fatal(err)
}
_ = os.Chmod(path+"/.easy_clash/easy_clash_core", os.ModePerm)
}
func main() {
_app := app.NewApp()
err := wails.Run(&options.App{
Title: "EasyClash",
Width: 1024,
Height: 768,
MinWidth: 985,
MinHeight: 768,
DisableResize: false,
Fullscreen: false,
Frameless: false,
StartHidden: false,
HideWindowOnClose: true,
RGBA: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
Assets: ui,
LogLevel: logger.DEBUG,
OnStartup: _app.Startup,
OnDomReady: _app.DomReady,
OnShutdown: _app.Shutdown,
Bind: []interface{}{
_app,
},
Windows: &windows.Options{
WebviewIsTransparent: false,
WindowIsTranslucent: false,
DisableWindowIcon: false,
},
Mac: &mac.Options{
TitleBar: &mac.TitleBar{
TitlebarAppearsTransparent: true,
HideTitle: true,
HideTitleBar: false,
FullSizeContent: false,
UseToolbar: false,
HideToolbarSeparator: true,
},
Appearance: mac.NSAppearanceNameVibrantLight,
WebviewIsTransparent: true,
WindowIsTranslucent: true,
About: &mac.AboutInfo{
Title: "EasyClash",
Message: "clash config manager",
Icon: icon,
},
},
})
if err != nil {
notify.Alert("", "", err.Error(), "")
log.Fatal(err)
}
}