feat: add porkbun dns-01 applicant
This commit is contained in:
1
ui/public/imgs/providers/porkbun.svg
Normal file
1
ui/public/imgs/providers/porkbun.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg width="200" height="200" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><style>.st1{fill:#fff}</style><g><circle cx="512" cy="512" r="512" style="fill:#ef7878"/><g><path class="st1" d="M398.3 331.8c-33.2-17.9-70.3-31.9-108.6-40.9-7.7 16.6-11.5 33.2-11.5 52.4 0 28.1 8.9 53.7 24.3 74.1 24.2-35.7 56.2-66.4 95.8-85.6zm323.3 85.6c15.3-20.4 24.3-46 24.3-74.1 0-19.2-3.8-37.1-11.5-52.4-38.3 7.7-75.4 21.7-108.6 40.9 38.3 19.2 71.5 49.9 95.8 85.6zm-152.1 58.8c-7.7 0-14.1 6.4-14.1 14.1 0 2.6 1.3 5.1 2.6 7.7 5.1 7.7 12.8 12.8 21.7 15.3 2.6-5.1 3.8-11.5 3.8-17.9V489c-1.2-7.7-6.3-12.8-14-12.8z"/><path class="st1" d="M503.1 320.3c-126.5 5.1-224.9 112.4-224.9 239v131.6c0 23 19.2 42.2 42.2 42.2 23 0 42.2-19.2 42.2-42.2v-34.5H659v34.5c0 23 19.2 42.2 42.2 42.2 23 0 42.2-19.2 42.2-42.2v-138c1.2-131.6-107.5-237.7-240.3-232.6zm132.8 184c-7.7 12.8-19.2 21.7-33.2 26.8-8.9 17.9-28.1 30.7-49.8 30.7h-6.4c-7.7 0-14.1-6.4-14.1-14.1s6.4-14.1 14.1-14.1c6.4 0 12.8-2.6 17.9-5.1-7.7-3.8-15.3-8.9-20.4-16.6-5.1-6.4-7.7-12.8-7.7-21.7 0-17.9 15.3-33.2 33.2-33.2 11.5 0 20.4 5.1 26.8 14.1 7.7 10.2 12.8 21.7 12.8 35.8v5.1c6.4-2.6 11.5-7.7 15.3-12.8 2.6-3.8 6.4-3.8 10.2-2.6 2.6-1.2 3.9 3.9 1.3 7.7z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -38,6 +38,7 @@ import AccessFormNamecheapConfig from "./AccessFormNamecheapConfig";
|
||||
import AccessFormNameDotComConfig from "./AccessFormNameDotComConfig";
|
||||
import AccessFormNameSiloConfig from "./AccessFormNameSiloConfig";
|
||||
import AccessFormNS1Config from "./AccessFormNS1Config";
|
||||
import AccessFormPorkbunConfig from "./AccessFormPorkbunConfig";
|
||||
import AccessFormPowerDNSConfig from "./AccessFormPowerDNSConfig";
|
||||
import AccessFormQiniuConfig from "./AccessFormQiniuConfig";
|
||||
import AccessFormRainYunConfig from "./AccessFormRainYunConfig";
|
||||
@@ -160,6 +161,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
|
||||
return <AccessFormNameSiloConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.NS1:
|
||||
return <AccessFormNS1Config {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.PORKBUN:
|
||||
return <AccessFormPorkbunConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.POWERDNS:
|
||||
return <AccessFormPowerDNSConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.QINIU:
|
||||
|
||||
76
ui/src/components/access/AccessFormPorkbunConfig.tsx
Normal file
76
ui/src/components/access/AccessFormPorkbunConfig.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type AccessConfigForPorkbun } from "@/domain/access";
|
||||
|
||||
type AccessFormPorkbunConfigFieldValues = Nullish<AccessConfigForPorkbun>;
|
||||
|
||||
export type AccessFormPorkbunConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: AccessFormPorkbunConfigFieldValues;
|
||||
onValuesChange?: (values: AccessFormPorkbunConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const initFormModel = (): AccessFormPorkbunConfigFieldValues => {
|
||||
return {
|
||||
apiKey: "",
|
||||
secretApiKey: "",
|
||||
};
|
||||
};
|
||||
|
||||
const AccessFormPorkbunConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormPorkbunConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
apiKey: z
|
||||
.string()
|
||||
.min(1, t("access.form.porkbun_api_key.placeholder"))
|
||||
.max(256, t("common.errmsg.string_max", { max: 256 }))
|
||||
.trim(),
|
||||
secretApiKey: z
|
||||
.string()
|
||||
.min(1, t("access.form.porkbun_secret_api_key.placeholder"))
|
||||
.max(256, t("common.errmsg.string_max", { max: 256 }))
|
||||
.trim(),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
|
||||
const handleFormChange = (_: unknown, values: z.infer<typeof formSchema>) => {
|
||||
onValuesChange?.(values);
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
form={formInst}
|
||||
disabled={disabled}
|
||||
initialValues={initialValues ?? initFormModel()}
|
||||
layout="vertical"
|
||||
name={formName}
|
||||
onValuesChange={handleFormChange}
|
||||
>
|
||||
<Form.Item
|
||||
name="apiKey"
|
||||
label={t("access.form.porkbun_api_key.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.porkbun_api_key.tooltip") }}></span>}
|
||||
>
|
||||
<Input autoComplete="new-password" placeholder={t("access.form.porkbun_api_key.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="secretApiKey"
|
||||
label={t("access.form.porkbun_secret_api_key.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.porkbun_secret_api_key.tooltip") }}></span>}
|
||||
>
|
||||
<Input.Password autoComplete="new-password" placeholder={t("access.form.porkbun_secret_api_key.placeholder")} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default AccessFormPorkbunConfig;
|
||||
@@ -34,6 +34,7 @@ export interface AccessModel extends BaseModel {
|
||||
| AccessConfigForNamecheap
|
||||
| AccessConfigForNameDotCom
|
||||
| AccessConfigForNameSilo
|
||||
| AccessConfigForPorkbun
|
||||
| AccessConfigForPowerDNS
|
||||
| AccessConfigForQiniu
|
||||
| AccessConfigForRainYun
|
||||
@@ -190,6 +191,11 @@ export type AccessConfigForNS1 = {
|
||||
apiKey: string;
|
||||
};
|
||||
|
||||
export type AccessConfigForPorkbun = {
|
||||
apiKey: string;
|
||||
secretApiKey: string;
|
||||
};
|
||||
|
||||
export type AccessConfigForPowerDNS = {
|
||||
apiUrl: string;
|
||||
apiKey: string;
|
||||
|
||||
@@ -18,6 +18,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
|
||||
CLOUDFLARE: "cloudflare",
|
||||
CLOUDNS: "cloudns",
|
||||
CMCCCLOUD: "cmcccloud",
|
||||
DESEC: "desec",
|
||||
DNSLA: "dnsla",
|
||||
DOGECLOUD: "dogecloud",
|
||||
DYNV6: "dynv6",
|
||||
@@ -33,6 +34,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
|
||||
NAMEDOTCOM: "namedotcom",
|
||||
NAMESILO: "namesilo",
|
||||
NS1: "ns1",
|
||||
PORKBUN: "porkbun",
|
||||
POWERDNS: "powerdns",
|
||||
QINIU: "qiniu",
|
||||
RAINYUN: "rainyun",
|
||||
@@ -41,6 +43,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
|
||||
TENCENTCLOUD: "tencentcloud",
|
||||
UCLOUD: "ucloud",
|
||||
UPYUN: "upyun",
|
||||
VERCEL: "vercel",
|
||||
VOLCENGINE: "volcengine",
|
||||
WEBHOOK: "webhook",
|
||||
WESTCN: "westcn",
|
||||
@@ -105,6 +108,7 @@ export const accessProvidersMap: Map<AccessProvider["type"] | string, AccessProv
|
||||
[ACCESS_PROVIDERS.NAMEDOTCOM, "provider.namedotcom", "/imgs/providers/namedotcom.svg", [ACCESS_USAGES.APPLY]],
|
||||
[ACCESS_PROVIDERS.NAMESILO, "provider.namesilo", "/imgs/providers/namesilo.svg", [ACCESS_USAGES.APPLY]],
|
||||
[ACCESS_PROVIDERS.NS1, "provider.ns1", "/imgs/providers/ns1.svg", [ACCESS_USAGES.APPLY]],
|
||||
[ACCESS_PROVIDERS.PORKBUN, "provider.porkbun", "/imgs/providers/porkbun.svg", [ACCESS_USAGES.APPLY]],
|
||||
[ACCESS_PROVIDERS.CMCCCLOUD, "provider.cmcccloud", "/imgs/providers/cmcccloud.svg", [ACCESS_USAGES.APPLY]],
|
||||
[ACCESS_PROVIDERS.RAINYUN, "provider.rainyun", "/imgs/providers/rainyun.svg", [ACCESS_USAGES.APPLY]],
|
||||
[ACCESS_PROVIDERS.WESTCN, "provider.westcn", "/imgs/providers/westcn.svg", [ACCESS_USAGES.APPLY]],
|
||||
@@ -140,6 +144,7 @@ export const APPLY_DNS_PROVIDERS = Object.freeze({
|
||||
CLOUDFLARE: `${ACCESS_PROVIDERS.CLOUDFLARE}`,
|
||||
CLOUDNS: `${ACCESS_PROVIDERS.CLOUDNS}`,
|
||||
CMCCCLOUD: `${ACCESS_PROVIDERS.CMCCCLOUD}`,
|
||||
DESEC: `${ACCESS_PROVIDERS.DESEC}`,
|
||||
DNSLA: `${ACCESS_PROVIDERS.DNSLA}`,
|
||||
DYNV6: `${ACCESS_PROVIDERS.DYNV6}`,
|
||||
GCORE: `${ACCESS_PROVIDERS.GCORE}`,
|
||||
@@ -153,10 +158,12 @@ export const APPLY_DNS_PROVIDERS = Object.freeze({
|
||||
NAMEDOTCOM: `${ACCESS_PROVIDERS.NAMEDOTCOM}`,
|
||||
NAMESILO: `${ACCESS_PROVIDERS.NAMESILO}`,
|
||||
NS1: `${ACCESS_PROVIDERS.NS1}`,
|
||||
PORKBUN: `${ACCESS_PROVIDERS.PORKBUN}`,
|
||||
POWERDNS: `${ACCESS_PROVIDERS.POWERDNS}`,
|
||||
RAINYUN: `${ACCESS_PROVIDERS.RAINYUN}`,
|
||||
TENCENTCLOUD: `${ACCESS_PROVIDERS.TENCENTCLOUD}`, // 兼容旧值,等同于 `TENCENTCLOUD_DNS`
|
||||
TENCENTCLOUD_DNS: `${ACCESS_PROVIDERS.TENCENTCLOUD}-dns`,
|
||||
VERCEL: `${ACCESS_PROVIDERS.VERCEL}`,
|
||||
VOLCENGINE: `${ACCESS_PROVIDERS.VOLCENGINE}`, // 兼容旧值,等同于 `VOLCENGINE_DNS`
|
||||
VOLCENGINE_DNS: `${ACCESS_PROVIDERS.VOLCENGINE}-dns`,
|
||||
WESTCN: `${ACCESS_PROVIDERS.WESTCN}`,
|
||||
@@ -196,6 +203,7 @@ export const applyDNSProvidersMap: Map<ApplyDNSProvider["type"] | string, ApplyD
|
||||
[APPLY_DNS_PROVIDERS.NAMEDOTCOM, "provider.namedotcom"],
|
||||
[APPLY_DNS_PROVIDERS.NAMESILO, "provider.namesilo"],
|
||||
[APPLY_DNS_PROVIDERS.NS1, "provider.ns1"],
|
||||
[APPLY_DNS_PROVIDERS.PORKBUN, "provider.porkbun"],
|
||||
[APPLY_DNS_PROVIDERS.CMCCCLOUD, "provider.cmcc"],
|
||||
[APPLY_DNS_PROVIDERS.RAINYUN, "provider.rainyun"],
|
||||
[APPLY_DNS_PROVIDERS.WESTCN, "provider.westcn"],
|
||||
|
||||
@@ -196,6 +196,12 @@
|
||||
"access.form.ns1_api_key.label": "NS1 API key",
|
||||
"access.form.ns1_api_key.placeholder": "Please enter NS1 API key",
|
||||
"access.form.ns1_api_key.tooltip": "For more information, see <a href=\"https://www.ibm.com/docs/en/ns1-connect?topic=introduction-using-api\" target=\"_blank\">https://www.ibm.com/docs/en/ns1-connect?topic=introduction-using-api</a>",
|
||||
"access.form.porkbun_api_key.label": "Porkbun API key",
|
||||
"access.form.porkbun_api_key.placeholder": "Please enter Porkbun API key",
|
||||
"access.form.porkbun_api_key.tooltip": "For more information, see <a href=\"https://porkbun.com/api/json/v3/documentation#Authentication\" target=\"_blank\">https://porkbun.com/api/json/v3/documentation</a>",
|
||||
"access.form.porkbun_secret_api_key.label": "Porkbun secret API key",
|
||||
"access.form.porkbun_secret_api_key.placeholder": "Please enter Porkbun secret API key",
|
||||
"access.form.porkbun_secret_api_key.tooltip": "For more information, see <a href=\"https://porkbun.com/api/json/v3/documentation#Authentication\" target=\"_blank\">https://porkbun.com/api/json/v3/documentation</a>",
|
||||
"access.form.powerdns_api_url.label": "PowerDNS API URL",
|
||||
"access.form.powerdns_api_url.placeholder": "Please enter PowerDNS API URL",
|
||||
"access.form.powerdns_api_url.tooltip": "For more information, see <a href=\"https://doc.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api\" target=\"_blank\">https://doc.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api</a>",
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"provider.cmcccloud": "China Mobile Cloud (ECloud)",
|
||||
"provider.ctcccloud": "China Telecom Cloud (State Cloud)",
|
||||
"provider.cucccloud": "China Unicom Cloud",
|
||||
"provider.desec": "deSEC",
|
||||
"provider.dnsla": "DNS.LA",
|
||||
"provider.dogecloud": "Doge Cloud",
|
||||
"provider.dogecloud.cdn": "Doge Cloud - CDN (Content Delivery Network)",
|
||||
@@ -75,6 +76,7 @@
|
||||
"provider.namedotcom": "Name.com",
|
||||
"provider.namesilo": "NameSilo",
|
||||
"provider.ns1": "NS1 (IBM NS1 Connect)",
|
||||
"provider.porkbun": "Porkbun",
|
||||
"provider.powerdns": "PowerDNS",
|
||||
"provider.qiniu": "Qiniu",
|
||||
"provider.qiniu.cdn": "Qiniu - CDN (Content Delivery Network)",
|
||||
@@ -102,6 +104,7 @@
|
||||
"provider.upyun": "UPYUN",
|
||||
"provider.upyun.cdn": "UPYUN - CDN (Content Delivery Network)",
|
||||
"provider.upyun.file": "UPYUN - File Storage",
|
||||
"provider.vercel": "Vercel",
|
||||
"provider.volcengine": "Volcengine",
|
||||
"provider.volcengine.alb": "Volcengine - ALB (Application Load Balancer)",
|
||||
"provider.volcengine.cdn": "Volcengine - CDN (Content Delivery Network)",
|
||||
|
||||
@@ -190,6 +190,12 @@
|
||||
"access.form.ns1_api_key.label": "NS1 API Key",
|
||||
"access.form.ns1_api_key.placeholder": "请输入 NS1 API Key",
|
||||
"access.form.ns1_api_key.tooltip": "这是什么?请参阅 <a href=\"https://www.ibm.com/docs/zh/ns1-connect?topic=introduction-using-api\" target=\"_blank\">https://www.ibm.com/docs/zh/ns1-connect?topic=introduction-using-api</a>",
|
||||
"access.form.porkbun_api_key.label": "Porkbun API Key",
|
||||
"access.form.porkbun_api_key.placeholder": "请输入 Porkbun API Key",
|
||||
"access.form.porkbun_api_key.tooltip": "这是什么?请参阅 <a href=\"https://porkbun.com/api/json/v3/documentation#Authentication\" target=\"_blank\">https://porkbun.com/api/json/v3/documentation</a>",
|
||||
"access.form.porkbun_secret_api_key.label": "Porkbun Secret API Key",
|
||||
"access.form.porkbun_secret_api_key.placeholder": "请输入 Porkbun Secret API Key",
|
||||
"access.form.porkbun_secret_api_key.tooltip": "这是什么?请参阅 <a href=\"https://porkbun.com/api/json/v3/documentation#Authentication\" target=\"_blank\">https://porkbun.com/api/json/v3/documentation</a>",
|
||||
"access.form.powerdns_api_url.label": "PowerDNS API URL",
|
||||
"access.form.powerdns_api_url.placeholder": "请输入 PowerDNS API URL",
|
||||
"access.form.powerdns_api_url.tooltip": "这是什么?请参阅 <a href=\"https://doc.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api\" target=\"_blank\">https://doc.powerdns.com/authoritative/http-api/index.html#endpoints-and-objects-in-the-api</a>",
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"provider.cmcccloud": "移动云",
|
||||
"provider.ctcccloud": "联通云",
|
||||
"provider.cucccloud": "天翼云",
|
||||
"provider.desec": "deSEC",
|
||||
"provider.dnsla": "DNS.LA",
|
||||
"provider.dogecloud": "多吉云",
|
||||
"provider.dogecloud.cdn": "多吉云 - 内容分发网络 CDN",
|
||||
@@ -75,6 +76,7 @@
|
||||
"provider.namedotcom": "Name.com",
|
||||
"provider.namesilo": "NameSilo",
|
||||
"provider.ns1": "NS1(IBM NS1 Connect)",
|
||||
"provider.porkbun": "Porkbun",
|
||||
"provider.powerdns": "PowerDNS",
|
||||
"provider.qiniu": "七牛云",
|
||||
"provider.qiniu.cdn": "七牛云 - 内容分发网络 CDN",
|
||||
@@ -102,6 +104,7 @@
|
||||
"provider.upyun": "又拍云",
|
||||
"provider.upyun.cdn": "又拍云 - 云分发 CDN",
|
||||
"provider.upyun.file": "又拍云 - 云存储",
|
||||
"provider.vercel": "Vercel",
|
||||
"provider.volcengine": "火山引擎",
|
||||
"provider.volcengine.alb": "火山引擎 - 应用型负载均衡 ALB",
|
||||
"provider.volcengine.cdn": "火山引擎 - 内容分发网络 CDN",
|
||||
|
||||
Reference in New Issue
Block a user