更新若干功能

This commit is contained in:
李琦
2026-08-14 07:51:46 +08:00
parent d2aeb13a09
commit 153c7ed448
48 changed files with 5567 additions and 2673 deletions

63
main.go
View File

@@ -2,38 +2,59 @@ package main
import (
"embed"
"log/slog"
"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/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/services/notifications"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
// Create an instance of the app structure
app := NewApp()
func devtoolsArgs() []string {
if p := os.Getenv("CC_DEVTOOLS_PORT"); p != "" {
return []string{"--remote-debugging-port=" + p}
}
return nil
}
// Create application with options
err := wails.Run(&options.App{
Title: "Code Count",
Width: 1280,
Height: 820,
MinWidth: 960,
MinHeight: 680,
AssetServer: &assetserver.Options{
Assets: assets,
func main() {
app := NewApp()
notifier := notifications.New()
app.notifier = notifier
wapp := application.New(application.Options{
Name: "年糕崽崽项目管理PMS",
Description: "本地代码统计与项目工作台",
Services: []application.Service{
application.NewService(app),
application.NewService(notifier),
},
BackgroundColour: &options.RGBA{R: 13, G: 18, B: 28, A: 1},
OnStartup: app.startup,
OnShutdown: app.shutdown,
Bind: []interface{}{
app,
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
LogLevel: slog.LevelError,
Windows: application.WindowsOptions{
// Opt-in DevTools protocol endpoint for automated UI testing; inert unless the env var is set.
AdditionalBrowserArgs: devtoolsArgs(),
},
})
if err != nil {
win := wapp.Window.NewWithOptions(application.WebviewWindowOptions{
Name: "main",
Title: "年糕崽崽项目管理PMS",
Width: 1280,
Height: 820,
MinWidth: 960,
MinHeight: 680,
URL: "/",
BackgroundColour: application.NewRGBA(13, 18, 28, 255),
})
app.SetupShell(wapp, win)
if err := wapp.Run(); err != nil {
println("Error:", err.Error())
}
}