@@ -24,6 +24,7 @@ import (
2424 "github.com/router-for-me/CLIProxyAPI/v6/internal/api/middleware"
2525 "github.com/router-for-me/CLIProxyAPI/v6/internal/api/modules"
2626 ampmodule "github.com/router-for-me/CLIProxyAPI/v6/internal/api/modules/amp"
27+ "github.com/router-for-me/CLIProxyAPI/v6/internal/cache"
2728 "github.com/router-for-me/CLIProxyAPI/v6/internal/auth/kiro"
2829 "github.com/router-for-me/CLIProxyAPI/v6/internal/config"
2930 "github.com/router-for-me/CLIProxyAPI/v6/internal/logging"
@@ -262,6 +263,7 @@ func NewServer(cfg *config.Config, authManager *auth.Manager, accessManager *sdk
262263 }
263264 managementasset .SetCurrentConfig (cfg )
264265 auth .SetQuotaCooldownDisabled (cfg .DisableCooling )
266+ applySignatureCacheConfig (nil , cfg )
265267 // Initialize management handler
266268 s .mgmt = managementHandlers .NewHandler (cfg , configFilePath , authManager )
267269 if optionState .localPassword != "" {
@@ -966,6 +968,8 @@ func (s *Server) UpdateClients(cfg *config.Config) {
966968 auth .SetQuotaCooldownDisabled (cfg .DisableCooling )
967969 }
968970
971+ applySignatureCacheConfig (oldCfg , cfg )
972+
969973 if s .handlers != nil && s .handlers .AuthManager != nil {
970974 s .handlers .AuthManager .SetRetryConfig (cfg .RequestRetry , time .Duration (cfg .MaxRetryInterval )* time .Second , cfg .MaxRetryCredentials )
971975 }
@@ -1104,3 +1108,40 @@ func AuthMiddleware(manager *sdkaccess.Manager) gin.HandlerFunc {
11041108 c .AbortWithStatusJSON (statusCode , gin.H {"error" : err .Message })
11051109 }
11061110}
1111+
1112+ func configuredSignatureCacheEnabled (cfg * config.Config ) bool {
1113+ if cfg != nil && cfg .AntigravitySignatureCacheEnabled != nil {
1114+ return * cfg .AntigravitySignatureCacheEnabled
1115+ }
1116+ return true
1117+ }
1118+
1119+ func applySignatureCacheConfig (oldCfg , cfg * config.Config ) {
1120+ newVal := configuredSignatureCacheEnabled (cfg )
1121+ newStrict := configuredSignatureBypassStrict (cfg )
1122+ if oldCfg == nil {
1123+ cache .SetSignatureCacheEnabled (newVal )
1124+ cache .SetSignatureBypassStrictMode (newStrict )
1125+ log .Debugf ("antigravity_signature_cache_enabled toggled to %t" , newVal )
1126+ return
1127+ }
1128+
1129+ oldVal := configuredSignatureCacheEnabled (oldCfg )
1130+ if oldVal != newVal {
1131+ cache .SetSignatureCacheEnabled (newVal )
1132+ log .Debugf ("antigravity_signature_cache_enabled updated from %t to %t" , oldVal , newVal )
1133+ }
1134+
1135+ oldStrict := configuredSignatureBypassStrict (oldCfg )
1136+ if oldStrict != newStrict {
1137+ cache .SetSignatureBypassStrictMode (newStrict )
1138+ log .Debugf ("antigravity_signature_bypass_strict updated from %t to %t" , oldStrict , newStrict )
1139+ }
1140+ }
1141+
1142+ func configuredSignatureBypassStrict (cfg * config.Config ) bool {
1143+ if cfg != nil && cfg .AntigravitySignatureBypassStrict != nil {
1144+ return * cfg .AntigravitySignatureBypassStrict
1145+ }
1146+ return false
1147+ }
0 commit comments