feat: refresh accounts automatically every five minutes

This commit is contained in:
2026-08-14 15:35:27 +08:00
parent c1985852e1
commit 5f50669b98
11 changed files with 66 additions and 145 deletions
+4 -3
View File
@@ -408,9 +408,9 @@ func (a *App) logout(w http.ResponseWriter, r *http.Request) {
func (a *App) general() GeneralSettings {
g := defaults()
a.store.GetJSON("general", &g)
if g.SyncMinutes < 1 {
g.SyncMinutes = 5
}
// Keep the legacy field in the response for old clients, but automatic
// account synchronization is intentionally fixed at five minutes.
g.SyncMinutes = automaticSyncMinutes
if g.RetentionDays < 1 {
g.RetentionDays = 90
}
@@ -430,6 +430,7 @@ func (a *App) generalAPI(w http.ResponseWriter, r *http.Request) {
jsonOut(w, 400, map[string]string{"error": "无效时区"})
return
}
g.SyncMinutes = automaticSyncMinutes
_ = a.store.SetJSON("general", g)
jsonOut(w, 200, g)
}