refactor(captcha): update Cap to 2.0.0 (#2573)

* refactor(captcha): update Cap backend to 2.0.0 API format

* feat(captcha): add Cap version config for 1.x/2.x compatibility

* fix(captcha): change Cap default version to 1.x for backward compatibility

* refactor(captcha): remove Cap 1.x compatibility, keep only 2.x support

* feat(captcha): update field names to Cap 2.0 standard - Site Key and Secret Key

* fix(captcha): update Cap field names in defaults configuration
This commit is contained in:
WittF
2025-06-26 14:58:58 +08:00
committed by GitHub
parent 3db522609e
commit 2500ebc6a4
5 changed files with 18 additions and 16 deletions

View File

@@ -30,7 +30,7 @@ type SiteConfig struct {
CaptchaType setting.CaptchaType `json:"captcha_type,omitempty"`
TurnstileSiteID string `json:"turnstile_site_id,omitempty"`
CapInstanceURL string `json:"captcha_cap_instance_url,omitempty"`
CapKeyID string `json:"captcha_cap_key_id,omitempty"`
CapSiteKey string `json:"captcha_cap_site_key,omitempty"`
RegisterEnabled bool `json:"register_enabled,omitempty"`
TosUrl string `json:"tos_url,omitempty"`
PrivacyPolicyUrl string `json:"privacy_policy_url,omitempty"`
@@ -137,7 +137,7 @@ func (s *GetSettingService) GetSiteConfig(c *gin.Context) (*SiteConfig, error) {
TurnstileSiteID: settings.TurnstileCaptcha(c).Key,
ReCaptchaKey: reCaptcha.Key,
CapInstanceURL: capCaptcha.InstanceURL,
CapKeyID: capCaptcha.KeyID,
CapSiteKey: capCaptcha.SiteKey,
AppPromotion: appSetting.Promotion,
}, nil
}