更新若干功能

This commit is contained in:
李琦
2026-08-15 07:29:45 +08:00
parent ce00c9d193
commit 4954295961
9 changed files with 164 additions and 44 deletions

23
sync_defaults.go Normal file
View File

@@ -0,0 +1,23 @@
package main
import (
_ "embed"
"encoding/json"
)
//go:embed build/sync.defaults.json
var syncDefaultsJSON []byte
// packagedSyncDefaults 读取打包时嵌入的同步服务器配置。
// 修改连接地址请编辑 build/sync.defaults.json 后重新 wails3 task windows:build。
func packagedSyncDefaults() SyncConfig {
var c SyncConfig
if e := json.Unmarshal(syncDefaultsJSON, &c); e != nil {
// 嵌入文件损坏时回退到安全的空配置,由调用方再兜底。
return SyncConfig{Port: 3306}
}
if c.Port <= 0 || c.Port > 65535 {
c.Port = 3306
}
return c
}