nf-disk/main.go

55 lines
1.1 KiB
Go
Raw Normal View History

2024-09-26 17:54:14 +08:00
package main
import (
2024-09-29 22:15:28 +08:00
"context"
2024-09-26 17:54:14 +08:00
"embed"
"flag"
2024-09-27 14:52:10 +08:00
"github.com/loveuer/nf-disk/internal/controller"
2024-09-29 22:15:28 +08:00
"github.com/loveuer/nf-disk/internal/opt"
"os/signal"
"syscall"
2024-09-26 17:54:14 +08:00
"github.com/loveuer/nf/nft/log"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
)
//go:embed all:frontend/dist
var assets embed.FS
func init() {
2024-09-29 22:15:28 +08:00
}
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
defer cancel()
flag.BoolVar(&opt.Debug, "debug", true, "debug mode")
2024-09-26 17:54:14 +08:00
flag.Parse()
if opt.Debug {
log.SetLogLevel(log.LogLevelDebug)
}
app := controller.NewApp()
2024-09-29 22:15:28 +08:00
app.Init(ctx)
2024-09-26 17:54:14 +08:00
if err := wails.Run(&options.App{
Title: "nf-disk",
Width: 1024,
Height: 768,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 223, G: 223, B: 223, A: 1},
OnStartup: app.Startup,
Bind: []interface{}{
app,
},
}); err != nil {
log.Fatal("wails run err: %s", err.Error())
}
}