移除不必要的前端拦截
Some checks failed
build / build (api, amd64, linux) (push) Failing after -50s
build / build (api, arm64, linux) (push) Failing after -52s
build / build (api.exe, amd64, windows) (push) Failing after -52s

This commit is contained in:
CN-JS-HuiBai
2026-04-18 16:33:36 +08:00
parent f4af50299c
commit b874d2e258
6 changed files with 309243 additions and 935 deletions

View File

@@ -2327,6 +2327,7 @@ window.XBOARD_TRANSLATIONS['en-US'] = {
}, },
"common": { "common": {
"saving": "Saving...", "saving": "Saving...",
"saveFailed": "Failed to save",
"save_success": "Saved automatically", "save_success": "Saved automatically",
"placeholder": "Please input", "placeholder": "Please input",
"autoSaved": "Saved automatically" "autoSaved": "Saved automatically"

View File

@@ -2223,6 +2223,7 @@ window.XBOARD_TRANSLATIONS['ru-RU'] = {
}, },
"common": { "common": {
"saving": "Сохранение...", "saving": "Сохранение...",
"saveFailed": "Не удалось сохранить",
"save_success": "Автоматически сохранено", "save_success": "Автоматически сохранено",
"placeholder": "Текст...", "placeholder": "Текст...",
"autoSaved": "Сохранено" "autoSaved": "Сохранено"

View File

@@ -2261,6 +2261,7 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = {
}, },
"common": { "common": {
"saving": "保存中...", "saving": "保存中...",
"saveFailed": "保存失败",
"save_success": "已自动保存", "save_success": "已自动保存",
"placeholder": "请输入", "placeholder": "请输入",
"autoSaved": "已自动保存" "autoSaved": "已自动保存"

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,7 @@
package handler package handler
import ( import (
"encoding/json"
"fmt" "fmt"
"net/http" "net/http"
"os" "os"
@@ -122,7 +123,7 @@ func getAllConfigMappings() gin.H {
"commission_first_time_enable": service.MustGetBool("commission_first_time_enable", true), "commission_first_time_enable": service.MustGetBool("commission_first_time_enable", true),
"commission_auto_check_enable": service.MustGetBool("commission_auto_check_enable", true), "commission_auto_check_enable": service.MustGetBool("commission_auto_check_enable", true),
"commission_withdraw_limit": service.MustGetInt("commission_withdraw_limit", 100), "commission_withdraw_limit": service.MustGetInt("commission_withdraw_limit", 100),
"commission_withdraw_method": service.MustGetString("commission_withdraw_method", "alipay"), "commission_withdraw_method": getStringListSetting("commission_withdraw_method", []string{"alipay"}),
"withdraw_close_enable": service.MustGetBool("withdraw_close_enable", false), "withdraw_close_enable": service.MustGetBool("withdraw_close_enable", false),
"commission_distribution_enable": service.MustGetBool("commission_distribution_enable", false), "commission_distribution_enable": service.MustGetBool("commission_distribution_enable", false),
"commission_distribution_l1": service.MustGetInt("commission_distribution_l1", 0), "commission_distribution_l1": service.MustGetInt("commission_distribution_l1", 0),
@@ -174,17 +175,27 @@ func getAllConfigMappings() gin.H {
"server_ws_url": service.MustGetString("server_ws_url", ""), "server_ws_url": service.MustGetString("server_ws_url", ""),
}, },
"safe": gin.H{ "safe": gin.H{
"email_verify": service.MustGetBool("email_verify", false), "email_verify": service.MustGetBool("email_verify", false),
"safe_mode_enable": service.MustGetBool("safe_mode_enable", false), "safe_mode_enable": service.MustGetBool("safe_mode_enable", false),
"secure_path": service.GetAdminSecurePath(), "secure_path": service.GetAdminSecurePath(),
"email_whitelist_enable": service.MustGetBool("email_whitelist_enable", false), "email_whitelist_enable": service.MustGetBool("email_whitelist_enable", false),
"email_whitelist_suffix": service.MustGetString("email_whitelist_suffix", ""), "email_whitelist_suffix": getStringListSetting("email_whitelist_suffix", []string{}),
"email_gmail_limit_enable": service.MustGetBool("email_gmail_limit_enable", false), "email_gmail_limit_enable": service.MustGetBool("email_gmail_limit_enable", false),
"captcha_enable": service.MustGetBool("captcha_enable", false), "captcha_enable": service.MustGetBool("captcha_enable", false),
"captcha_type": service.MustGetString("captcha_type", "recaptcha"), "captcha_type": service.MustGetString("captcha_type", "recaptcha"),
"register_limit_by_ip_enable": service.MustGetBool("register_limit_by_ip_enable", false), "recaptcha_key": service.MustGetString("recaptcha_key", ""),
"register_limit_count": service.MustGetInt("register_limit_count", 3), "recaptcha_site_key": service.MustGetString("recaptcha_site_key", ""),
"password_limit_enable": service.MustGetBool("password_limit_enable", true), "recaptcha_v3_secret_key": service.MustGetString("recaptcha_v3_secret_key", ""),
"recaptcha_v3_site_key": service.MustGetString("recaptcha_v3_site_key", ""),
"recaptcha_v3_score_threshold": service.MustGetString("recaptcha_v3_score_threshold", "0.5"),
"turnstile_secret_key": service.MustGetString("turnstile_secret_key", ""),
"turnstile_site_key": service.MustGetString("turnstile_site_key", ""),
"register_limit_by_ip_enable": service.MustGetBool("register_limit_by_ip_enable", false),
"register_limit_count": service.MustGetInt("register_limit_count", 3),
"register_limit_expire": service.MustGetString("register_limit_expire", ""),
"password_limit_enable": service.MustGetBool("password_limit_enable", true),
"password_limit_count": service.MustGetString("password_limit_count", ""),
"password_limit_expire": service.MustGetString("password_limit_expire", ""),
}, },
"email": gin.H{ "email": gin.H{
"email_template": service.MustGetString("email_template", "classic"), "email_template": service.MustGetString("email_template", "classic"),
@@ -197,6 +208,20 @@ func getAllConfigMappings() gin.H {
"email_from_name": service.MustGetString("email_from_name", service.MustGetString("app_name", "XBoard")), "email_from_name": service.MustGetString("email_from_name", service.MustGetString("app_name", "XBoard")),
"remind_mail_enable": service.MustGetBool("remind_mail_enable", false), "remind_mail_enable": service.MustGetBool("remind_mail_enable", false),
}, },
"telegram": gin.H{
"telegram_bot_enable": service.MustGetBool("telegram_bot_enable", false),
"telegram_bot_token": service.MustGetString("telegram_bot_token", ""),
"telegram_webhook_url": service.MustGetString("telegram_webhook_url", ""),
"telegram_discuss_link": service.MustGetString("telegram_discuss_link", ""),
},
"app": gin.H{
"windows_version": service.MustGetString("windows_version", ""),
"windows_download_url": service.MustGetString("windows_download_url", ""),
"macos_version": service.MustGetString("macos_version", ""),
"macos_download_url": service.MustGetString("macos_download_url", ""),
"android_version": service.MustGetString("android_version", ""),
"android_download_url": service.MustGetString("android_download_url", ""),
},
"nebula": gin.H{ "nebula": gin.H{
"nebula_theme_color": service.MustGetString("nebula_theme_color", "aurora"), "nebula_theme_color": service.MustGetString("nebula_theme_color", "aurora"),
"nebula_hero_slogan": service.MustGetString("nebula_hero_slogan", ""), "nebula_hero_slogan": service.MustGetString("nebula_hero_slogan", ""),
@@ -230,8 +255,21 @@ func saveSetting(name string, value any) {
} else { } else {
val = "0" val = "0"
} }
case []string:
val = serializeSettingList(name, v)
case []any:
items := make([]string, 0, len(v))
for _, item := range v {
text := strings.TrimSpace(stringFromAny(item))
if text != "" {
items = append(items, text)
}
}
val = serializeSettingList(name, items)
default: default:
// serialize complex types if needed if marshaled, err := json.Marshal(v); err == nil {
val = string(marshaled)
}
} }
result := database.DB.Model(&model.Setting{}).Where("name = ?", name).Update("value", val) result := database.DB.Model(&model.Setting{}).Where("name = ?", name).Update("value", val)
@@ -293,6 +331,60 @@ func collectEmailTemplateNames() []string {
return result return result
} }
func getStringListSetting(name string, defaultValue []string) []string {
raw, ok := service.GetSetting(name)
if !ok || strings.TrimSpace(raw) == "" {
return append([]string(nil), defaultValue...)
}
var values []string
if err := json.Unmarshal([]byte(raw), &values); err == nil {
return compactStringList(values, defaultValue)
}
normalized := strings.ReplaceAll(raw, "\r\n", "\n")
var parts []string
if strings.Contains(normalized, "\n") {
parts = strings.Split(normalized, "\n")
} else if strings.Contains(normalized, ",") {
parts = strings.Split(normalized, ",")
} else {
parts = []string{normalized}
}
return compactStringList(parts, defaultValue)
}
func compactStringList(values []string, defaultValue []string) []string {
result := make([]string, 0, len(values))
for _, item := range values {
item = strings.TrimSpace(item)
if item != "" {
result = append(result, item)
}
}
if len(result) == 0 {
return append([]string(nil), defaultValue...)
}
return result
}
func serializeSettingList(name string, values []string) string {
values = compactStringList(values, []string{})
if len(values) == 0 {
return ""
}
switch name {
case "commission_withdraw_method":
if payload, err := json.Marshal(values); err == nil {
return string(payload)
}
}
return strings.Join(values, "\n")
}
func currentAdminEmail(c *gin.Context) string { func currentAdminEmail(c *gin.Context) string {
userID, exists := c.Get("user_id") userID, exists := c.Get("user_id")
if !exists { if !exists {
@@ -330,11 +422,19 @@ func settingGroupName(name string) string {
return "server" return "server"
case "email_verify", "safe_mode_enable", "secure_path", "email_whitelist_enable", case "email_verify", "safe_mode_enable", "secure_path", "email_whitelist_enable",
"email_whitelist_suffix", "email_gmail_limit_enable", "captcha_enable", "captcha_type", "email_whitelist_suffix", "email_gmail_limit_enable", "captcha_enable", "captcha_type",
"register_limit_by_ip_enable", "register_limit_count", "password_limit_enable": "recaptcha_key", "recaptcha_site_key", "recaptcha_v3_secret_key", "recaptcha_v3_site_key",
"recaptcha_v3_score_threshold", "turnstile_secret_key", "turnstile_site_key",
"register_limit_by_ip_enable", "register_limit_count", "register_limit_expire",
"password_limit_enable", "password_limit_count", "password_limit_expire":
return "safe" return "safe"
case "email_template", "email_host", "email_port", "email_username", "email_password", "email_encryption", case "email_template", "email_host", "email_port", "email_username", "email_password", "email_encryption",
"email_from_address", "email_from_name", "email_from", "remind_mail_enable": "email_from_address", "email_from_name", "email_from", "remind_mail_enable":
return "email" return "email"
case "telegram_bot_enable", "telegram_bot_token", "telegram_webhook_url", "telegram_discuss_link":
return "telegram"
case "windows_version", "windows_download_url", "macos_version", "macos_download_url",
"android_version", "android_download_url":
return "app"
case "nebula_theme_color", "nebula_hero_slogan", "nebula_welcome_target", "nebula_register_title", case "nebula_theme_color", "nebula_hero_slogan", "nebula_welcome_target", "nebula_register_title",
"nebula_background_url", "nebula_metrics_base_url", "nebula_default_theme_mode", "nebula_background_url", "nebula_metrics_base_url", "nebula_default_theme_mode",
"nebula_light_logo_url", "nebula_dark_logo_url", "nebula_custom_html", "nebula_static_cdn_url": "nebula_light_logo_url", "nebula_dark_logo_url", "nebula_custom_html", "nebula_static_cdn_url":

308234
scratch/bundle-head.js Normal file

File diff suppressed because one or more lines are too long