mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 08:40:20 +00:00
feat(auth): allow JWT IP changes by configuration (#1236)
* feat(auth): allow JWT IP changes by configuration * fix(auth): make JWT IP change setting concurrency-safe * test(auth): move JWT IP change setting tests out of MCP test file
This commit is contained in:
1 parent
8cb86e3853
commit
d19952a834
8 files changed
+172
-2
No files matched your search
@@ -97,6 +97,9 @@ func updateConfig(c *gin.Context) (any, error) {
|
||||
|
||||
singleton.Conf.EnableIPChangeNotification = sf.EnableIPChangeNotification
|
||||
singleton.Conf.EnablePlainIPInNotification = sf.EnablePlainIPInNotification
|
||||
if sf.AllowJWTIPChange != nil {
|
||||
singleton.Conf.SetJWTIPChangeAllowed(*sf.AllowJWTIPChange)
|
||||
}
|
||||
singleton.Conf.Cover = sf.Cover
|
||||
singleton.Conf.InstallHost = sf.InstallHost
|
||||
singleton.Conf.DashboardHost = sf.DashboardHost
|
||||
@@ -160,6 +163,12 @@ func fireMCPKillSwitch() {
|
||||
// the current config to avoid accidentally tripping the kill switch on
|
||||
// partial PATCH calls that omit enable_mcp.
|
||||
func resolveSettingEnableMCP(formValue *bool, current bool) bool {
|
||||
return resolveOptionalBool(formValue, current)
|
||||
}
|
||||
|
||||
// resolveOptionalBool preserves a setting for partial PATCH requests when its
|
||||
// boolean field is absent, while still allowing an explicit false value.
|
||||
func resolveOptionalBool(formValue *bool, current bool) bool {
|
||||
if formValue == nil {
|
||||
return current
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user