feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+16 -4
View File
@@ -143,6 +143,7 @@ func InitOptionMap() {
common.OptionMap["QuotaForNewUser"] = strconv.Itoa(common.QuotaForNewUser)
common.OptionMap["QuotaForInviter"] = strconv.Itoa(common.QuotaForInviter)
common.OptionMap["QuotaForInvitee"] = strconv.Itoa(common.QuotaForInvitee)
common.OptionMap["QuotaRemindEnabled"] = strconv.FormatBool(common.QuotaRemindEnabled)
common.OptionMap["QuotaRemindThreshold"] = strconv.Itoa(common.QuotaRemindThreshold)
common.OptionMap["PreConsumedQuota"] = strconv.Itoa(common.PreConsumedQuota)
common.OptionMap["ModelRequestRateLimitCount"] = strconv.Itoa(setting.ModelRequestRateLimitCount)
@@ -199,7 +200,7 @@ func loadOptionsFromDatabase() {
defer requestPolicyOptionMutex.Unlock()
defer func() {
if err := refreshRequestPolicySnapshot(); err != nil {
common.SysError("invalid request policy: " + err.Error())
common.SysError(common.LogText("invalid request policy: %s", err.Error()))
}
}()
passkeyOptionMutex.Lock()
@@ -213,7 +214,7 @@ func loadOptionsFromDatabase() {
}
err := updateOptionMap(option.Key, option.Value)
if err != nil {
common.SysLog("failed to update option map: " + err.Error())
common.SysLog(common.LogText("failed to update option map: %s", err.Error()))
}
}
applyPasskeyDomainOptions(passkeyOptions)
@@ -222,18 +223,27 @@ func loadOptionsFromDatabase() {
func SyncOptions(frequency int) {
for {
time.Sleep(time.Duration(frequency) * time.Second)
common.SysLog("syncing options from database")
common.SysLog(common.LogText("syncing options from database"))
loadOptionsFromDatabase()
}
}
func validateOptionValue(key string, value string) error {
if key == legacyAccessTokenRetireAtKey {
return errLegacyRetireAtReadOnly
}
if err := operation_setting.ValidateQuotaOption(key, value); err != nil {
return err
}
if key == operation_setting.ToolPriceOptionKey {
return operation_setting.ValidateToolPricesJSON(value)
}
if key == operation_setting.ChannelTestConcurrencyOptionKey {
return operation_setting.ValidateChannelTestConcurrency(value)
}
if key == operation_setting.LogMaxRangeDaysOptionKey {
return operation_setting.ValidateLogMaxRangeDays(value)
}
if key == "MaxTokenAutoGroups" {
return setting.ValidateMaxTokenAutoGroups(value)
}
@@ -337,7 +347,7 @@ func UpdateOptionsBulk(values map[string]string) error {
}
func updateOptionMap(key string, value string) (err error) {
if key == retiredThemeOptionKey {
if key == retiredThemeOptionKey || key == legacyAccessTokenRetireAtKey {
common.OptionMapRWMutex.Lock()
delete(common.OptionMap, key)
common.OptionMapRWMutex.Unlock()
@@ -395,6 +405,8 @@ func updateOptionMap(key string, value string) (err error) {
common.AutomaticDisableChannelEnabled = boolValue
case "AutomaticEnableChannelEnabled":
common.AutomaticEnableChannelEnabled = boolValue
case "QuotaRemindEnabled":
common.QuotaRemindEnabled = boolValue
case "LogConsumeEnabled":
common.LogConsumeEnabled = boolValue
case "DisplayInCurrencyEnabled":