mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-07 05:52:56 +08:00
- 启动参数新增固定 WebviewUserDataPath 到 %APPDATA%/GoNavi/WebView2 - 首次启动自动迁移历史 WebView 数据目录 - 保留现有存储键,避免破坏已落盘配置 - 前端持久化读取增加历史结构兼容 - refs #125
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
|
|
"GoNavi-Wails/internal/app"
|
|
"GoNavi-Wails/internal/logger"
|
|
|
|
"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"
|
|
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
|
)
|
|
|
|
//go:embed all:frontend/dist
|
|
var assets embed.FS
|
|
|
|
func main() {
|
|
// Create an instance of the app structure
|
|
application := app.NewApp()
|
|
|
|
// Create application with options
|
|
err := wails.Run(&options.App{
|
|
Title: "GoNavi",
|
|
Width: 1024,
|
|
Height: 768,
|
|
Frameless: true,
|
|
AssetServer: &assetserver.Options{
|
|
Assets: assets,
|
|
},
|
|
BackgroundColour: &options.RGBA{R: 0, G: 0, B: 0, A: 0},
|
|
OnStartup: application.Startup,
|
|
OnShutdown: application.Shutdown,
|
|
Bind: []interface{}{
|
|
application,
|
|
},
|
|
Windows: &windows.Options{
|
|
WebviewIsTransparent: true,
|
|
WindowIsTranslucent: true,
|
|
BackdropType: windows.Acrylic,
|
|
DisableWindowIcon: false,
|
|
DisableFramelessWindowDecorations: false,
|
|
WebviewUserDataPath: resolveWindowsWebviewUserDataPath(),
|
|
},
|
|
Mac: &mac.Options{
|
|
WebviewIsTransparent: true,
|
|
WindowIsTranslucent: true,
|
|
},
|
|
})
|
|
|
|
if err != nil {
|
|
logger.Error(err, "应用启动失败")
|
|
}
|
|
}
|