mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 14:04:54 +00:00
feat: add porkbun dns-01 applicant
This commit is contained in:
@@ -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