feat: 缓存代理keys
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"gpt-load/internal/models"
|
||||
"gpt-load/internal/response"
|
||||
"gpt-load/internal/utils"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -51,6 +52,14 @@ func (s *Server) UpdateSettings(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Sanitize proxy_keys input
|
||||
if proxyKeys, ok := settingsMap["proxy_keys"]; ok {
|
||||
if proxyKeysStr, ok := proxyKeys.(string); ok {
|
||||
cleanedKeys := utils.SplitAndTrim(proxyKeysStr, ",")
|
||||
settingsMap["proxy_keys"] = strings.Join(cleanedKeys, ",")
|
||||
}
|
||||
}
|
||||
|
||||
// 更新配置
|
||||
if err := s.SettingsManager.UpdateSettings(settingsMap); err != nil {
|
||||
response.Error(c, app_errors.NewAPIError(app_errors.ErrDatabase, err.Error()))
|
||||
|
Reference in New Issue
Block a user