feat: Implement database-backed configuration management and the main backend application entry point.

This commit is contained in:
2026-02-01 07:37:49 +08:00
parent 28bdc9d509
commit 247bfb336e
2 changed files with 10 additions and 0 deletions

View File

@@ -225,6 +225,7 @@ func handleConfig(w http.ResponseWriter, r *http.Request) {
"group_ids": config.Global.GroupIDs,
"proxy_enabled": config.Global.ProxyEnabled,
"default_proxy": config.Global.DefaultProxy,
"team_reg_proxy": config.Global.TeamRegProxy,
"proxy_test_status": getProxyTestStatus(),
"proxy_test_ip": getProxyTestIP(),
"site_name": config.Global.SiteName,
@@ -242,6 +243,7 @@ func handleConfig(w http.ResponseWriter, r *http.Request) {
GroupIDs []int `json:"group_ids"`
ProxyEnabled *bool `json:"proxy_enabled"`
DefaultProxy *string `json:"default_proxy"`
TeamRegProxy *string `json:"team_reg_proxy"`
SiteName *string `json:"site_name"`
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
@@ -276,6 +278,9 @@ func handleConfig(w http.ResponseWriter, r *http.Request) {
database.Instance.SetConfig("proxy_test_ip", "")
}
}
if req.TeamRegProxy != nil {
config.Global.TeamRegProxy = *req.TeamRegProxy
}
if req.SiteName != nil {
config.Global.SiteName = *req.SiteName
}