-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.go
More file actions
80 lines (71 loc) · 2.84 KB
/
Copy pathmain.go
File metadata and controls
80 lines (71 loc) · 2.84 KB
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
package main
import (
"flag"
"fmt"
"os"
"runtime"
"strings"
app "github.com/sag-enhanced/native-app/src"
"github.com/sag-enhanced/native-app/src/isadmin"
"github.com/sag-enhanced/native-app/src/options"
)
var defaultProxyBypassList = []string{
// SAGE
"*.sage.party",
"*.leodev.cloud",
"*.sagemail.top",
// Brave browser
"*.brave.com",
"*.brave-http-only.com",
// Captcha solvers
"*.nopecha.com",
}
func main() {
if isadmin.IsAdmin() {
if runtime.GOOS == "windows" {
// if you start a HTTP server as admin on Windows, it won't be accessible to non-admin users.
// this breaks a lot of things, so we exit early and tell the user to run without admin privileges.
fmt.Println("Running as administrator is not supported on Windows. Please run without admin privileges.")
os.Exit(1)
}
fmt.Println("Running as root is not recommended. SAGE does not need root privileges to function properly.")
}
opt := options.NewOptions()
var openCommand string
var buildOverride int
var releaseOverride int
var loopbackPort int
flag.StringVar(&opt.DataDirectory, "data", opt.DataDirectory, "Data directory to use")
flag.StringVar(&opt.Realm, "realm", options.StableRealm, "Run the app in the specified realm")
flag.BoolVar(&opt.Verbose, "verbose", false, "Enable VERY verbose logging")
flag.StringVar(&openCommand, "open", "", "Command to open URLs")
flag.StringVar(&opt.UI, "ui", opt.UI, "UI to use (webview or playwright)")
flag.BoolVar(&opt.SteamDev, "steamdev", false, "Enable Steam Dev mode")
flag.BoolVar(&opt.NoCompress, "nocompress", false, "Disable file compression")
flag.IntVar(&buildOverride, "build", -1, "Override/spoof build number (NOT RECOMMENDED)")
flag.IntVar(&releaseOverride, "release", -1, "Override/spoof release number (NOT RECOMMENDED)")
flag.IntVar(&loopbackPort, "loopback", -1, fmt.Sprintf("Port to use for loopback connections (default: %d) (NOT RECOMMENDED)", opt.LoopbackPort))
flag.StringVar(&opt.ForceBrowser, "forcebrowser", "", "Force a specific browser to be used (specify full executable path)")
flag.StringVar(&opt.ProxyBypassList, "proxybypasslist", strings.Join(defaultProxyBypassList, ";"), "Bypass any specified proxy for the given semi-colon-separated list of hosts")
flag.Parse()
if openCommand != "" {
opt.OpenCommand = strings.Split(openCommand, " ")
}
if buildOverride != -1 {
fmt.Println("WARNING: Build number override is not recommended and may cause issues.")
opt.Build = uint32(buildOverride)
}
if releaseOverride != -1 {
fmt.Println("WARNING: Release number override is not recommended and may cause issues.")
opt.Release = uint32(releaseOverride)
}
if loopbackPort != -1 {
opt.LoopbackPort = uint16(loopbackPort)
}
if opt.Realm != options.StableRealm {
fmt.Println("WARNING: Using experimental realm. This may cause issues.")
}
if err := app.Run(opt); err != nil {
fmt.Println(err)
}
}