You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.8 KiB
74 lines
1.8 KiB
package main
|
|
|
|
import (
|
|
"embed"
|
|
"fmt"
|
|
"os"
|
|
|
|
"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/mac"
|
|
)
|
|
|
|
//go:embed all:frontend/dist
|
|
var assets embed.FS
|
|
|
|
func main() {
|
|
// 调试模式:不启 GUI,直接调 CheckEnv 走完流程,看是不是会崩。
|
|
if len(os.Args) > 1 && os.Args[1] == "--selftest" {
|
|
app := NewApp()
|
|
fmt.Println("=== CheckEnv ===")
|
|
r := app.CheckEnv()
|
|
fmt.Printf("nodeOK=%v dshPath=%q dshVer=%q cred=%v portBusy=%v\n",
|
|
r.NodeOK, r.DshPath, r.DshVersion, r.CredExists, r.PortBusy)
|
|
fmt.Printf("issues=%v\n", r.Issues)
|
|
fmt.Println("=== CheckUpdate ===")
|
|
u := app.CheckUpdate()
|
|
fmt.Printf("installed=%q latest=%q hasUpdate=%v\n",
|
|
u.Installed, u.Latest, u.HasUpdate)
|
|
fmt.Println("=== listDSHPids ===")
|
|
pids := listDSHPids()
|
|
fmt.Printf("found %d dsh-related pids:\n", len(pids))
|
|
for _, p := range pids {
|
|
fmt.Printf(" - %s\n", p)
|
|
}
|
|
fmt.Println("=== done, exiting ===")
|
|
return
|
|
}
|
|
|
|
app := NewApp()
|
|
|
|
err := wails.Run(&options.App{
|
|
Title: "dsh-launcher",
|
|
Width: 1040,
|
|
Height: 1280,
|
|
AssetServer: &assetserver.Options{
|
|
Assets: assets,
|
|
},
|
|
BackgroundColour: &options.RGBA{R: 17, G: 24, B: 39, A: 1},
|
|
OnStartup: app.startup,
|
|
OnShutdown: app.shutdown,
|
|
Bind: []interface{}{
|
|
app,
|
|
},
|
|
Mac: &mac.Options{
|
|
TitleBar: &mac.TitleBar{
|
|
TitlebarAppearsTransparent: true,
|
|
HideTitle: false,
|
|
HideTitleBar: false,
|
|
FullSizeContent: false,
|
|
},
|
|
Appearance: mac.NSAppearanceNameDarkAqua,
|
|
WebviewIsTransparent: false,
|
|
About: &mac.AboutInfo{
|
|
Title: "dsh-launcher",
|
|
Message: "本地按需启动 dsh web UI。",
|
|
},
|
|
},
|
|
})
|
|
|
|
if err != nil {
|
|
println("Error:", err.Error())
|
|
}
|
|
} |