Minimal-structure migration to Wails v3.0.0-beta.20 (CLI-matching pin). Single App service preserved; no domain logic touched. - main.go: wails.Run(options.App) -> application.New + RegisterService + Window.NewWithOptions. Window keeps title-with-version, 1024x768, RGBA background, Linux icon/translucency/GpuPolicyNever, ProgramName. SingleInstanceLock -> SingleInstanceOptions (same UniqueID); callback closes over the service variable set right after New. - app.go: App holds *application.App instead of a context. startup(ctx) is gone; the version title moves into the window options via appTitle(). onSecondInstanceLaunch takes v3 SecondInstanceData (Args/WorkingDir) and uses Window.Current() Restore+Focus plus Event.Emit for launchArgs. ShowVersion uses Dialog.Info. - AniList/MAL/Simkl *UserFunctions.go: runtime.BrowserOpenURL -> app.Browser.OpenURL (errors logged), runtime.MessageDialog -> app.Dialog.Info chains. OAuth callback servers, token flows, and key names unchanged. - Secrets: 99designs/keyring replaced with zalando/go-keyring (what v3 itself depends on) under the same AniTrack service name, so existing stored tokens keep working. Per-file Set helpers kept; Open/Ready boilerplate deleted (zalando needs no handle). - go.mod: v2 + 99designs dropped (stale v2 replace directive removed), v3 beta.20 + zalando v0.2.8 added.
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"log"
|
|
|
|
"github.com/wailsapp/wails/v3/pkg/application"
|
|
)
|
|
|
|
//go:embed all:frontend/dist
|
|
var assets embed.FS
|
|
|
|
func main() {
|
|
// The service is created after the application (it needs the app
|
|
// reference), so the single-instance callback closes over the variable
|
|
// and resolves it at call time. A second instance can only launch once
|
|
// this one is running, by which point svc is always set.
|
|
var svc *App
|
|
|
|
// Create application with options
|
|
app := application.New(application.Options{
|
|
Name: "AniTrack",
|
|
Description: "Track anime watchlists across AniList, MyAnimeList, and Simkl",
|
|
Assets: application.AssetOptions{
|
|
Handler: application.AssetFileServerFS(assets),
|
|
},
|
|
SingleInstance: &application.SingleInstanceOptions{
|
|
UniqueID: "49c93b6d-663d-4b7a-9cb0-8a469ea9182b",
|
|
OnSecondInstanceLaunch: func(data application.SecondInstanceData) {
|
|
svc.onSecondInstanceLaunch(data)
|
|
},
|
|
},
|
|
Linux: application.LinuxOptions{
|
|
ProgramName: "AniTrack",
|
|
},
|
|
})
|
|
|
|
svc = NewApp(app)
|
|
app.RegisterService(application.NewService(svc))
|
|
|
|
app.Window.NewWithOptions(application.WebviewWindowOptions{
|
|
Title: appTitle(),
|
|
Width: 1024,
|
|
Height: 768,
|
|
BackgroundColour: application.NewRGBA(27, 38, 54, 1),
|
|
URL: "/",
|
|
Linux: application.LinuxWindow{
|
|
Icon: []byte("./build/AniTrack.png"),
|
|
WindowIsTranslucent: false,
|
|
WebviewGpuPolicy: application.WebviewGpuPolicyNever,
|
|
},
|
|
})
|
|
|
|
if err := app.Run(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|