[优化] 移除 Turnstile 相关功能和配置

This commit is contained in:
ryan
2026-05-31 15:22:30 +08:00
parent 57616626fd
commit 4cb8928e4e
12 changed files with 15 additions and 288 deletions
+2 -3
View File
@@ -3,7 +3,6 @@ package controller
import (
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"openflare/common"
"openflare/model"
@@ -11,6 +10,8 @@ import (
"openflare/utils/mail"
"openflare/utils/security"
"openflare/utils/validation"
"github.com/gin-gonic/gin"
)
// GetStatus godoc
@@ -39,8 +40,6 @@ func GetStatus(c *gin.Context) {
"wechat_qrcode": common.WeChatAccountQRCodeImageURL,
"wechat_login": common.WeChatAuthEnabled,
"server_address": common.ServerAddress,
"turnstile_check": common.TurnstileCheckEnabled,
"turnstile_site_key": common.TurnstileSiteKey,
"register_enabled": common.RegisterEnabled,
"password_register_enabled": common.PasswordRegisterEnabled,
"auth_sources": authSources,
+3 -13
View File
@@ -3,7 +3,6 @@ package controller
import (
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"openflare/common"
"openflare/model"
@@ -13,6 +12,8 @@ import (
"regexp"
"strconv"
"strings"
"github.com/gin-gonic/gin"
)
var (
@@ -236,10 +237,7 @@ func validateOptionWithState(option model.Option, state map[string]string) error
if option.Value == "true" && strings.TrimSpace(state["WeChatServerAddress"]) == "" {
return fmt.Errorf("鏃犳硶鍚敤寰俊鐧诲綍锛岃鍏堝~鍏ュ井淇$櫥褰曠浉鍏抽厤缃俊鎭紒")
}
case "TurnstileCheckEnabled":
if option.Value == "true" && strings.TrimSpace(state["TurnstileSiteKey"]) == "" {
return fmt.Errorf("鏃犳硶鍚敤 Turnstile 鏍¢獙锛岃鍏堝~鍏?Turnstile 鏍¢獙鐩稿叧閰嶇疆淇℃伅锛?")
}
}
if err := validateRateLimitOption(option.Key, option.Value); err != nil {
@@ -341,14 +339,6 @@ func UpdateOption(c *gin.Context) {
})
return
}
case "TurnstileCheckEnabled":
if option.Value == "true" && common.TurnstileSiteKey == "" {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "无法启用 Turnstile 校验,请先填入 Turnstile 校验相关配置信息!",
})
return
}
}
if err = validateRateLimitOption(option.Key, option.Value); err != nil {
c.JSON(http.StatusOK, gin.H{