MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / updateOptionMap

Function updateOptionMap

model/option.go:183–420  ·  view source on GitHub ↗
(key string, value string)

Source from the content-addressed store, hash-verified

181}
182
183func updateOptionMap(key string, value string) (err error) {
184 common.OptionMapRWMutex.Lock()
185 defer common.OptionMapRWMutex.Unlock()
186 common.OptionMap[key] = value
187
188 // 检查是否是模型配置 - 使用更规范的方式处理
189 if handleConfigUpdate(key, value) {
190 return nil // 已由配置系统处理
191 }
192
193 // 处理传统配置项...
194 if strings.HasSuffix(key, "Permission") {
195 intValue, _ := strconv.Atoi(value)
196 switch key {
197 case "FileUploadPermission":
198 common.FileUploadPermission = intValue
199 case "FileDownloadPermission":
200 common.FileDownloadPermission = intValue
201 case "ImageUploadPermission":
202 common.ImageUploadPermission = intValue
203 case "ImageDownloadPermission":
204 common.ImageDownloadPermission = intValue
205 }
206 }
207 if strings.HasSuffix(key, "Enabled") || key == "DefaultCollapseSidebar" || key == "DefaultUseAutoGroup" {
208 boolValue := value == "true"
209 switch key {
210 case "PasswordRegisterEnabled":
211 common.PasswordRegisterEnabled = boolValue
212 case "PasswordLoginEnabled":
213 common.PasswordLoginEnabled = boolValue
214 case "EmailVerificationEnabled":
215 common.EmailVerificationEnabled = boolValue
216 case "GitHubOAuthEnabled":
217 common.GitHubOAuthEnabled = boolValue
218 case "LinuxDOOAuthEnabled":
219 common.LinuxDOOAuthEnabled = boolValue
220 case "WeChatAuthEnabled":
221 common.WeChatAuthEnabled = boolValue
222 case "TelegramOAuthEnabled":
223 common.TelegramOAuthEnabled = boolValue
224 case "TurnstileCheckEnabled":
225 common.TurnstileCheckEnabled = boolValue
226 case "RegisterEnabled":
227 common.RegisterEnabled = boolValue
228 case "EmailDomainRestrictionEnabled":
229 common.EmailDomainRestrictionEnabled = boolValue
230 case "EmailAliasRestrictionEnabled":
231 common.EmailAliasRestrictionEnabled = boolValue
232 case "AutomaticDisableChannelEnabled":
233 common.AutomaticDisableChannelEnabled = boolValue
234 case "AutomaticEnableChannelEnabled":
235 common.AutomaticEnableChannelEnabled = boolValue
236 case "LogConsumeEnabled":
237 common.LogConsumeEnabled = boolValue
238 case "LogUserInputEnabled":
239 common.LogUserInputEnabled = boolValue
240 case "DisplayInCurrencyEnabled":

Callers 2

loadOptionsFromDatabaseFunction · 0.85
UpdateOptionFunction · 0.85

Tested by

no test coverage detected