Merge pull request #578 from fudiwei/feat/providers

Support cloudflare zone api token
This commit is contained in:
Yoan.liu
2025-04-03 17:42:23 +08:00
committed by GitHub
7 changed files with 30 additions and 5 deletions

View File

@@ -30,6 +30,11 @@ const AccessFormCloudflareConfig = ({ form: formInst, formName, disabled, initia
.min(1, t("access.form.cloudflare_dns_api_token.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
zoneApiToken: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish(),
});
const formRule = createSchemaFieldRule(formSchema);
@@ -54,6 +59,15 @@ const AccessFormCloudflareConfig = ({ form: formInst, formName, disabled, initia
>
<Input.Password autoComplete="new-password" placeholder={t("access.form.cloudflare_dns_api_token.placeholder")} />
</Form.Item>
<Form.Item
name="zoneApiToken"
label={t("access.form.cloudflare_zone_api_token.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.cloudflare_zone_api_token.tooltip") }}></span>}
>
<Input.Password autoComplete="new-password" placeholder={t("access.form.cloudflare_zone_api_token.placeholder")} />
</Form.Item>
</Form>
);
};

View File

@@ -114,6 +114,7 @@ export type AccessConfigForCdnfly = {
export type AccessConfigForCloudflare = {
dnsApiToken: string;
zoneApiToken?: string;
};
export type AccessConfigForClouDNS = {

View File

@@ -111,9 +111,12 @@
"access.form.cdnfly_api_secret.label": "Cdnfly user API secret",
"access.form.cdnfly_api_secret.placeholder": "Please enter Cdnfly user API secret",
"access.form.cdnfly_api_secret.tooltip": "For more information, see <a href=\"https://doc.cdnfly.cn/shiyongjieshao.html\" target=\"_blank\">https://doc.cdnfly.cn/shiyongjieshao.html</a>",
"access.form.cloudflare_dns_api_token.label": "Cloudflare API token",
"access.form.cloudflare_dns_api_token.placeholder": "Please enter Cloudflare API token",
"access.form.cloudflare_dns_api_token.label": "Cloudflare DNS API token",
"access.form.cloudflare_dns_api_token.placeholder": "Please enter Cloudflare DNS API token",
"access.form.cloudflare_dns_api_token.tooltip": "For more information, see <a href=\"https://developers.cloudflare.com/fundamentals/api/get-started/create-token/\" target=\"_blank\">https://developers.cloudflare.com/fundamentals/api/get-started/create-token/</a>",
"access.form.cloudflare_zone_api_token.label": "Cloudflare Zone API token (Optional)",
"access.form.cloudflare_zone_api_token.placeholder": "Please enter Cloudflare Zone API token",
"access.form.cloudflare_zone_api_token.tooltip": "For more information, see <a href=\"https://developers.cloudflare.com/fundamentals/api/get-started/create-token/\" target=\"_blank\">https://developers.cloudflare.com/fundamentals/api/get-started/create-token/</a><br><br>Only required when you scope the DNS API token to <b>specific zones</b>. PLease scope the Zone API token to <b>all zones</b> with <i>Zone/Zone/Read</i> permission.",
"access.form.cloudns_auth_id.label": "ClouDNS API user ID",
"access.form.cloudns_auth_id.placeholder": "Please enter ClouDNS API user ID",
"access.form.cloudns_auth_id.tooltip": "For more information, see <a href=\"https://www.cloudns.net/wiki/article/42/\" target=\"_blank\">https://www.cloudns.net/wiki/article/42/</a>",

View File

@@ -105,9 +105,12 @@
"access.form.cdnfly_api_secret.label": "Cdnfly 用户端 API Secret",
"access.form.cdnfly_api_secret.placeholder": "请输入 Cdnfly 用户端 API Secret",
"access.form.cdnfly_api_secret.tooltip": "这是什么?请参阅 <a href=\"https://doc.cdnfly.cn/shiyongjieshao.html\" target=\"_blank\">https://doc.cdnfly.cn/shiyongjieshao.html</a>",
"access.form.cloudflare_dns_api_token.label": "Cloudflare API Token",
"access.form.cloudflare_dns_api_token.placeholder": "请输入 Cloudflare API Token",
"access.form.cloudflare_dns_api_token.label": "Cloudflare DNS API 令牌",
"access.form.cloudflare_dns_api_token.placeholder": "请输入 Cloudflare DNS API 令牌",
"access.form.cloudflare_dns_api_token.tooltip": "这是什么?请参阅 <a href=\"https://developers.cloudflare.com/fundamentals/api/get-started/create-token/\" target=\"_blank\">https://developers.cloudflare.com/fundamentals/api/get-started/create-token/</a>",
"access.form.cloudflare_zone_api_token.label": "Cloudflare Zone API 令牌(可选)",
"access.form.cloudflare_zone_api_token.placeholder": "请输入 Cloudflare Zone API 令牌",
"access.form.cloudflare_zone_api_token.tooltip": "这是什么?请参阅 <a href=\"https://developers.cloudflare.com/fundamentals/api/get-started/create-token/\" target=\"_blank\">https://developers.cloudflare.com/fundamentals/api/get-started/create-token/</a><br><br>仅当你将 DNS API 令牌范围指定为<b>特定域</b>时需要填写,请将 Zone API 令牌范围指定为<b>全部域</b>,并分配 <i>Zone/Zone/Read</i> 权限。",
"access.form.cloudns_auth_id.label": "ClouDNS API 用户 ID",
"access.form.cloudns_auth_id.placeholder": "请输入 ClouDNS API 用户 ID",
"access.form.cloudns_auth_id.tooltip": "这是什么?请参阅 <a href=\"https://www.cloudns.net/wiki/article/42/\" target=\"_blank\">https://www.cloudns.net/wiki/article/42/</a>",