maybeEnableUpdater inits app.Updater (CurrentVersion from wails.json, embedded public key, accent-themed builtin window) behind two gates: -tags production (wails3 build sets it, dev does not) and application.System.IsDesktop (mobile stays on Obtainium). The startup check is headless; the window opens via a second CheckAndInstall only when an update is found. ANITRACK_UPDATER_CHANNEL=beta opts into -rc pre-releases for testing. updater_flow_test.go drives the REAL framework verifier headless: good signature stages byte-identical, tampered signature rejected (both phases green). Works around the framework process-wide app singleton with a single two-phase test.
66 lines
1.9 KiB
Go
66 lines
1.9 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))
|
|
|
|
// Self-updates: desktop production builds only (no-op elsewhere).
|
|
maybeEnableUpdater(app)
|
|
|
|
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,
|
|
// OnDemand: GPU for scrolling/compositing on AMD/Intel Mesa,
|
|
// software fallback otherwise. Never (the old Nvidia/X11
|
|
// blank-window workaround) forces CPU raster on GTK4/WebKit 6
|
|
// and makes scrolling janky. All target machines here are
|
|
// AMD or Intel, so the Nvidia DMABUF workaround is not needed.
|
|
WebviewGpuPolicy: application.WebviewGpuPolicyOnDemand,
|
|
},
|
|
})
|
|
|
|
if err := app.Run(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|