Add support for server config override

Add settings.override_server_config with enable flag and per-platform
(Android/iOS) url + size fields.

Use this config in /download/update to override the fixed
99_0_115.zip package source when needed.

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-01 21:48:41 +08:00
parent 259351b7ac
commit 8a7d7ccb93
4 changed files with 130 additions and 18 deletions
+26 -3
View File
@@ -23,9 +23,21 @@ type AppConfigs struct {
}
type Settings struct {
ListenPort string `json:"listen_port"`
CdnServer string `json:"cdn_server"`
BackupCdnServer string `json:"backup_cdn_server"`
ListenPort string `json:"listen_port"`
CdnServer string `json:"cdn_server"`
BackupCdnServer string `json:"backup_cdn_server"`
OverrideServerConfig OverrideServerConfig `json:"override_server_config"`
}
type OverrideServerConfig struct {
Enable bool `json:"enable"`
Android OverrideFileSource `json:"android"`
IOS OverrideFileSource `json:"ios"`
}
type OverrideFileSource struct {
URL string `json:"url"`
Size int `json:"size"`
}
func InitConfig() {
@@ -39,6 +51,17 @@ func DefaultConfigs() *AppConfigs {
ListenPort: "8080",
CdnServer: "http://127.0.0.1:8080/static",
BackupCdnServer: "",
OverrideServerConfig: OverrideServerConfig{
Enable: false,
Android: OverrideFileSource{
URL: "",
Size: 0,
},
IOS: OverrideFileSource{
URL: "",
Size: 0,
},
},
},
}
}