-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
123 lines (101 loc) · 2.67 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package main
import (
"embed"
"os"
"strings"
"github.com/tunnels-is/nicelandvpn-desktop/core"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/linux"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
)
//go:embed all:frontend/dist
var assets embed.FS
const (
VERSION = "1.1.5"
PRODUCTION = true
ENABLE_INTERFACE = true
)
var MONITOR = make(chan int, 200)
var (
APP = NewApp()
SERVICE = NewService()
)
func main() {
WebViewGPUPolicy := 0
for i := range os.Args {
argToLower := strings.ToLower(os.Args[i])
if argToLower == "-disablegpu" {
WebViewGPUPolicy = 2
}
}
core.PRODUCTION = PRODUCTION
core.ENABLE_INSTERFACE = ENABLE_INTERFACE
core.GLOBAL_STATE.Version = VERSION
go core.StartService(MONITOR)
logger := new(core.LoggerInterface)
err := wails.Run(&options.App{
Title: "Niceland VPN",
Width: 1050,
Height: 650,
Frameless: false,
Fullscreen: false,
AlwaysOnTop: false,
DisableResize: false,
Logger: logger,
Windows: &windows.Options{
// Do not enable zoom controls
// They are kind of broken inside webview and cause bad scaling
IsZoomControlEnabled: false,
WebviewIsTransparent: false,
WindowIsTranslucent: false,
DisableWindowIcon: false,
DisableFramelessWindowDecorations: false,
WebviewGpuIsDisabled: false,
},
Linux: &linux.Options{
WebviewGpuPolicy: linux.WebviewGpuPolicy(WebViewGPUPolicy),
WindowIsTranslucent: false,
},
Mac: &mac.Options{
TitleBar: &mac.TitleBar{
TitlebarAppearsTransparent: true,
HideTitle: true,
HideTitleBar: false,
FullSizeContent: true,
UseToolbar: true,
HideToolbarSeparator: false,
},
Appearance: "NSAppearanceNameDarkAqua",
About: &mac.AboutInfo{
Title: "Niceland",
Message: "Support: [email protected]",
},
},
CSSDragProperty: "--wails-draggable",
CSSDragValue: "drag",
AssetServer: &assetserver.Options{
Assets: assets,
},
OnStartup: APP.startup,
OnShutdown: APP.shutdown,
Bind: []interface{}{
APP,
SERVICE,
},
Debug: options.Debug{
OpenInspectorOnStartup: true,
},
// Debug: options.Debug{
// OpenInspectorOnStartup: !PRODUCTION,
// },
})
if err != nil {
if core.LogFile != nil {
_, _ = core.LogFile.WriteString("Unable to start the GUI(wails.io): " + err.Error())
core.CreateErrorLog("", "Unable to start the GUI(wails.io): ", err.Error())
}
}
}