mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-25 19:52:48 +00:00
feat(captcha): update Cap field names to Site Key and Secret Key
This commit is contained in:
parent
d2a0fce739
commit
4fc50ae8cb
|
|
@ -433,10 +433,10 @@
|
|||
"cap": "Cap",
|
||||
"capInstanceURL": "Instance URL",
|
||||
"capInstanceURLDes": "The URL of your self-hosted Cap server. For more details, see the <0>standalone mode documentation</0>.",
|
||||
"capKeyID": "Key ID",
|
||||
"capKeyIDDes": "The key ID from your Cap server dashboard.",
|
||||
"capKeySecret": "Key Secret",
|
||||
"capKeySecretDes": "The key secret from your Cap server dashboard.",
|
||||
"capSiteKey": "Site Key",
|
||||
"capSiteKeyDes": "The site key from your Cap server dashboard.",
|
||||
"capSecretKey": "Secret Key",
|
||||
"capSecretKeyDes": "The secret key from your Cap server dashboard.",
|
||||
"captchaProvider": "Captcha provider",
|
||||
"captchaWidth": "Width",
|
||||
"captchaHeight": "Height",
|
||||
|
|
|
|||
|
|
@ -431,10 +431,10 @@
|
|||
"cap": "Cap",
|
||||
"capInstanceURL": "インスタンス URL",
|
||||
"capInstanceURLDes": "自身でホストしている Cap サーバーの URL。詳細については、<0>スタンドアロンモードドキュメント</0> を参照してください。",
|
||||
"capKeyID": "キー ID",
|
||||
"capKeyIDDes": "Cap サーバーダッシュボードから取得したキー ID。",
|
||||
"capKeySecret": "キーシークレット",
|
||||
"capKeySecretDes": "Cap サーバーダッシュボードから取得したキーシークレット。",
|
||||
"capSiteKey": "サイトキー",
|
||||
"capSiteKeyDes": "Cap サーバーダッシュボードから取得したサイトキー。",
|
||||
"capSecretKey": "シークレットキー",
|
||||
"capSecretKeyDes": "Cap サーバーダッシュボードから取得したシークレットキー。",
|
||||
"captchaProvider": "認証コードタイプ",
|
||||
"captchaWidth": "幅",
|
||||
"captchaHeight": "高さ",
|
||||
|
|
|
|||
|
|
@ -431,10 +431,10 @@
|
|||
"cap": "Cap",
|
||||
"capInstanceURL": "实例 URL",
|
||||
"capInstanceURLDes": "自部署 Cap 服务器的 URL 地址。详细信息请参考 <0>独立模式文档</0>。",
|
||||
"capKeyID": "密钥 ID",
|
||||
"capKeyIDDes": "从 Cap 服务器控制面板获取的密钥 ID。",
|
||||
"capKeySecret": "密钥密码",
|
||||
"capKeySecretDes": "从 Cap 服务器控制面板获取的密钥密码。",
|
||||
"capSiteKey": "站点密钥",
|
||||
"capSiteKeyDes": "从 Cap 服务器控制面板获取的站点密钥。",
|
||||
"capSecretKey": "私密密钥",
|
||||
"capSecretKeyDes": "从 Cap 服务器控制面板获取的私密密钥。",
|
||||
"captchaProvider": "验证码类型",
|
||||
"captchaWidth": "宽度",
|
||||
"captchaHeight": "高度",
|
||||
|
|
|
|||
|
|
@ -428,10 +428,10 @@
|
|||
"cap": "Cap",
|
||||
"capInstanceURL": "實例 URL",
|
||||
"capInstanceURLDes": "自部署 Cap 伺服器的 URL 地址。詳細資訊請參考 <0>獨立模式文檔</0>。",
|
||||
"capKeyID": "金鑰 ID",
|
||||
"capKeyIDDes": "從 Cap 伺服器控制面板獲取的金鑰 ID。",
|
||||
"capKeySecret": "金鑰密碼",
|
||||
"capKeySecretDes": "從 Cap 伺服器控制面板獲取的金鑰密碼。",
|
||||
"capSiteKey": "站點金鑰",
|
||||
"capSiteKeyDes": "從 Cap 伺服器控制面板獲取的站點金鑰。",
|
||||
"capSecretKey": "私密金鑰",
|
||||
"capSecretKeyDes": "從 Cap 伺服器控制面板獲取的私密金鑰。",
|
||||
"captchaProvider": "驗證碼型別",
|
||||
"captchaWidth": "寬度",
|
||||
"captchaHeight": "高度",
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ export interface SiteConfig {
|
|||
captcha_type?: CaptchaType;
|
||||
turnstile_site_id?: string;
|
||||
captcha_cap_instance_url?: string;
|
||||
captcha_cap_key_id?: string;
|
||||
captcha_cap_key_secret?: string;
|
||||
captcha_cap_site_key?: string;
|
||||
captcha_cap_secret_key?: string;
|
||||
register_enabled?: boolean;
|
||||
logo?: string;
|
||||
logo_light?: string;
|
||||
|
|
|
|||
|
|
@ -37,33 +37,33 @@ const CapCaptcha = ({ values, setSettings }: CapCaptchaProps) => {
|
|||
</NoMarginHelperText>
|
||||
</FormControl>
|
||||
</SettingForm>
|
||||
<SettingForm title={t("settings.capKeyID")} lgWidth={5}>
|
||||
<SettingForm title={t("settings.capSiteKey")} lgWidth={5}>
|
||||
<FormControl fullWidth>
|
||||
<DenseFilledTextField
|
||||
value={values.captcha_cap_key_id}
|
||||
value={values.captcha_cap_site_key}
|
||||
onChange={(e) =>
|
||||
setSettings({
|
||||
captcha_cap_key_id: e.target.value,
|
||||
captcha_cap_site_key: e.target.value,
|
||||
})
|
||||
}
|
||||
required
|
||||
/>
|
||||
<NoMarginHelperText>
|
||||
<Trans
|
||||
i18nKey="settings.capKeyIDDes"
|
||||
i18nKey="settings.capSiteKeyDes"
|
||||
ns={"dashboard"}
|
||||
components={[<Link key={0} href={"https://capjs.js.org/guide/standalone.html"} target={"_blank"} />]}
|
||||
/>
|
||||
</NoMarginHelperText>
|
||||
</FormControl>
|
||||
</SettingForm>
|
||||
<SettingForm title={t("settings.capKeySecret")} lgWidth={5}>
|
||||
<SettingForm title={t("settings.capSecretKey")} lgWidth={5}>
|
||||
<FormControl fullWidth>
|
||||
<DenseFilledTextField
|
||||
value={values.captcha_cap_key_secret}
|
||||
value={values.captcha_cap_secret_key}
|
||||
onChange={(e) =>
|
||||
setSettings({
|
||||
captcha_cap_key_secret: e.target.value,
|
||||
captcha_cap_secret_key: e.target.value,
|
||||
})
|
||||
}
|
||||
type="password"
|
||||
|
|
@ -71,7 +71,7 @@ const CapCaptcha = ({ values, setSettings }: CapCaptchaProps) => {
|
|||
/>
|
||||
<NoMarginHelperText>
|
||||
<Trans
|
||||
i18nKey="settings.capKeySecretDes"
|
||||
i18nKey="settings.capSecretKeyDes"
|
||||
ns={"dashboard"}
|
||||
components={[<Link key={0} href={"https://capjs.js.org/guide/standalone.html"} target={"_blank"} />]}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const CapCaptcha = ({ onStateChange, generation, fullWidth, ...rest }: CapProps
|
|||
const { t } = useTranslation("common");
|
||||
|
||||
const capInstanceURL = useAppSelector((state) => state.siteConfig.basic.config.captcha_cap_instance_url);
|
||||
const capKeyID = useAppSelector((state) => state.siteConfig.basic.config.captcha_cap_key_id);
|
||||
const capSiteKey = useAppSelector((state) => state.siteConfig.basic.config.captcha_cap_site_key);
|
||||
|
||||
// Keep callback reference up to date
|
||||
useEffect(() => {
|
||||
|
|
@ -72,7 +72,7 @@ const CapCaptcha = ({ onStateChange, generation, fullWidth, ...rest }: CapProps
|
|||
};
|
||||
|
||||
const createWidget = () => {
|
||||
if (!captchaRef.current || !capInstanceURL || !capKeyID) {
|
||||
if (!captchaRef.current || !capInstanceURL || !capSiteKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ const CapCaptcha = ({ onStateChange, generation, fullWidth, ...rest }: CapProps
|
|||
const widget = document.createElement("cap-widget");
|
||||
|
||||
// Cap 2.0 API format: {instanceURL}/{siteKey}/
|
||||
const apiEndpoint = `${capInstanceURL.replace(/\/$/, "")}/${capKeyID}/`;
|
||||
const apiEndpoint = `${capInstanceURL.replace(/\/$/, "")}/${capSiteKey}/`;
|
||||
widget.setAttribute("data-cap-api-endpoint", apiEndpoint);
|
||||
widget.id = "cap-widget";
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ const CapCaptcha = ({ onStateChange, generation, fullWidth, ...rest }: CapProps
|
|||
}, [generation, t]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!capInstanceURL || !capKeyID) {
|
||||
if (!capInstanceURL || !capSiteKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -166,9 +166,9 @@ const CapCaptcha = ({ onStateChange, generation, fullWidth, ...rest }: CapProps
|
|||
captchaRef.current.innerHTML = "";
|
||||
}
|
||||
};
|
||||
}, [capInstanceURL, capKeyID, t]);
|
||||
}, [capInstanceURL, capSiteKey, t]);
|
||||
|
||||
if (!capInstanceURL || !capKeyID) {
|
||||
if (!capInstanceURL || !capSiteKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue