chore: initial commit
- Wails v2 + Go 1.21+ + Vue 3 dark UI - 3 buttons: Check env (auto-install dsh) / Start dsh web / Stop - 升级 / 检查版本 一键按钮 - 启动后窗口自动最小化到 Dock - 顶部 logo 鼠标 hover 显示大图预览 - scripts/: build-mac.sh, build-windows.bat, install-app.sh - ui-design/: 视觉设计稿 (HTML + tokens)
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
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("=== 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user