feat: new acme dns-01 provider: digitalocean
This commit is contained in:
@@ -29,6 +29,7 @@ import AccessFormCloudflareConfig from "./AccessFormCloudflareConfig";
|
||||
import AccessFormClouDNSConfig from "./AccessFormClouDNSConfig";
|
||||
import AccessFormCMCCCloudConfig from "./AccessFormCMCCCloudConfig";
|
||||
import AccessFormDeSECConfig from "./AccessFormDeSECConfig";
|
||||
import AccessFormDigitalOceanConfig from "./AccessFormDigitalOceanConfig";
|
||||
import AccessFormDingTalkBotConfig from "./AccessFormDingTalkBotConfig";
|
||||
import AccessFormDNSLAConfig from "./AccessFormDNSLAConfig";
|
||||
import AccessFormDogeCloudConfig from "./AccessFormDogeCloudConfig";
|
||||
@@ -216,6 +217,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
|
||||
return <AccessFormCMCCCloudConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.DESEC:
|
||||
return <AccessFormDeSECConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.DIGITALOCEAN:
|
||||
return <AccessFormDigitalOceanConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.DINGTALKBOT:
|
||||
return <AccessFormDingTalkBotConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.DNSLA:
|
||||
|
||||
57
ui/src/components/access/AccessFormDigitalOceanConfig.tsx
Normal file
57
ui/src/components/access/AccessFormDigitalOceanConfig.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type AccessConfigForDigitalOcean } from "@/domain/access";
|
||||
|
||||
type AccessFormDigitalOceanConfigFieldValues = Nullish<AccessConfigForDigitalOcean>;
|
||||
|
||||
export type AccessFormDigitalOceanConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: AccessFormDigitalOceanConfigFieldValues;
|
||||
onValuesChange?: (values: AccessFormDigitalOceanConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const initFormModel = (): AccessFormDigitalOceanConfigFieldValues => {
|
||||
return {
|
||||
accessToken: "",
|
||||
};
|
||||
};
|
||||
|
||||
const AccessFormDigitalOceanConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormDigitalOceanConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
accessToken: z.string().nonempty(t("access.form.digitalocean_access_token.placeholder")).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="accessToken"
|
||||
label={t("access.form.digitalocean_access_token.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.digitalocean_access_token.tooltip") }}></span>}
|
||||
>
|
||||
<Input.Password autoComplete="new-password" placeholder={t("access.form.digitalocean_access_token.placeholder")} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default AccessFormDigitalOceanConfig;
|
||||
@@ -170,6 +170,10 @@ export type AccessConfigForDeSEC = {
|
||||
token: string;
|
||||
};
|
||||
|
||||
export type AccessConfigForDigitalOcean = {
|
||||
accessToken: string;
|
||||
};
|
||||
|
||||
export type AccessConfigForDingTalkBot = {
|
||||
webhookUrl: string;
|
||||
secret?: string;
|
||||
|
||||
@@ -23,6 +23,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
|
||||
CLOUDNS: "cloudns",
|
||||
CMCCCLOUD: "cmcccloud",
|
||||
DESEC: "desec",
|
||||
DIGITALOCEAN: "digitalocean",
|
||||
DINGTALKBOT: "dingtalkbot",
|
||||
DNSLA: "dnsla",
|
||||
DOGECLOUD: "dogecloud",
|
||||
@@ -139,6 +140,7 @@ export const accessProvidersMap: Map<AccessProvider["type"] | string, AccessProv
|
||||
[ACCESS_PROVIDERS.CLOUDFLARE, "provider.cloudflare", "/imgs/providers/cloudflare.svg", [ACCESS_USAGES.DNS]],
|
||||
[ACCESS_PROVIDERS.CLOUDNS, "provider.cloudns", "/imgs/providers/cloudns.png", [ACCESS_USAGES.DNS]],
|
||||
[ACCESS_PROVIDERS.DESEC, "provider.desec", "/imgs/providers/desec.svg", [ACCESS_USAGES.DNS]],
|
||||
[ACCESS_PROVIDERS.DIGITALOCEAN, "provider.digitalocean", "/imgs/providers/digitalocean.svg", [ACCESS_USAGES.DNS]],
|
||||
[ACCESS_PROVIDERS.DNSLA, "provider.dnsla", "/imgs/providers/dnsla.svg", [ACCESS_USAGES.DNS]],
|
||||
[ACCESS_PROVIDERS.DYNV6, "provider.dynv6", "/imgs/providers/dynv6.svg", [ACCESS_USAGES.DNS]],
|
||||
[ACCESS_PROVIDERS.GNAME, "provider.gname", "/imgs/providers/gname.png", [ACCESS_USAGES.DNS]],
|
||||
@@ -255,6 +257,7 @@ export const ACME_DNS01_PROVIDERS = Object.freeze({
|
||||
CLOUDNS: `${ACCESS_PROVIDERS.CLOUDNS}`,
|
||||
CMCCCLOUD: `${ACCESS_PROVIDERS.CMCCCLOUD}`,
|
||||
DESEC: `${ACCESS_PROVIDERS.DESEC}`,
|
||||
DIGITALOCEAN: `${ACCESS_PROVIDERS.DIGITALOCEAN}`,
|
||||
DNSLA: `${ACCESS_PROVIDERS.DNSLA}`,
|
||||
DYNV6: `${ACCESS_PROVIDERS.DYNV6}`,
|
||||
GCORE: `${ACCESS_PROVIDERS.GCORE}`,
|
||||
@@ -312,6 +315,7 @@ export const acmeDns01ProvidersMap: Map<ACMEDns01Provider["type"] | string, ACME
|
||||
[ACME_DNS01_PROVIDERS.CLOUDFLARE, "provider.cloudflare"],
|
||||
[ACME_DNS01_PROVIDERS.CLOUDNS, "provider.cloudns"],
|
||||
[ACME_DNS01_PROVIDERS.DESEC, "provider.desec"],
|
||||
[ACME_DNS01_PROVIDERS.DIGITALOCEAN, "provider.digitalocean"],
|
||||
[ACME_DNS01_PROVIDERS.DNSLA, "provider.dnsla"],
|
||||
[ACME_DNS01_PROVIDERS.DYNV6, "provider.dynv6"],
|
||||
[ACME_DNS01_PROVIDERS.GCORE, "provider.gcore"],
|
||||
|
||||
@@ -152,6 +152,9 @@
|
||||
"access.form.desec_token.label": "deSEC token",
|
||||
"access.form.desec_token.placeholder": "Please enter deSEC token",
|
||||
"access.form.desec_token.tooltip": "For more information, see <a href=\"https://desec.readthedocs.io/en/latest/auth/tokens.html#manage-tokens\" target=\"_blank\">https://desec.readthedocs.io/en/latest/auth/tokens.html</a>",
|
||||
"access.form.digitalocean_access_token.label": "DigitalOcean access token",
|
||||
"access.form.digitalocean_access_token.placeholder": "Please enter DigitalOcean access token",
|
||||
"access.form.digitalocean_access_token.tooltip": "For more information, see <a href=\"https://docs.digitalocean.com/reference/api/create-personal-access-token/\" target=\"_blank\">https://docs.digitalocean.com/reference/api/create-personal-access-token/</a>",
|
||||
"access.form.dingtalkbot_webhook_url.label": "DingTalk bot Webhook URL",
|
||||
"access.form.dingtalkbot_webhook_url.placeholder": "Please enter DingTalk bot Webhook URL",
|
||||
"access.form.dingtalkbot_webhook_url.tooltip": "For more information, see <a href=\"https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot\" target=\"_blank\">https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot</a>",
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
"provider.ctcccloud": "China Telecom Cloud (State Cloud)",
|
||||
"provider.cucccloud": "China Unicom Cloud",
|
||||
"provider.desec": "deSEC",
|
||||
"provider.digitalocean": "DigitalOcean",
|
||||
"provider.dingtalkbot": "DingTalk Bot",
|
||||
"provider.dnsla": "DNS.LA",
|
||||
"provider.dogecloud": "Doge Cloud",
|
||||
|
||||
@@ -146,6 +146,9 @@
|
||||
"access.form.desec_token.label": "deSEC Token",
|
||||
"access.form.desec_token.placeholder": "请输入 deSEC Token",
|
||||
"access.form.desec_token.tooltip": "这是什么?请参阅 <a href=\"https://desec.readthedocs.io/en/latest/auth/tokens.html#manage-tokens\" target=\"_blank\">https://desec.readthedocs.io/en/latest/auth/tokens.html</a>",
|
||||
"access.form.digitalocean_access_token.label": "DigitalOcean Access Token",
|
||||
"access.form.digitalocean_access_token.placeholder": "请输入 DigitalOcean Access Token",
|
||||
"access.form.digitalocean_access_token.tooltip": "这是什么?请参阅 <a href=\"https://docs.digitalocean.com/reference/api/create-personal-access-token/\" target=\"_blank\">https://docs.digitalocean.com/reference/api/create-personal-access-token/</a>",
|
||||
"access.form.dingtalkbot_webhook_url.label": "钉钉群机器人 Webhook 地址",
|
||||
"access.form.dingtalkbot_webhook_url.placeholder": "请输入钉钉群机器人 Webhook 地址",
|
||||
"access.form.dingtalkbot_webhook_url.tooltip": "这是什么?请参阅 <a href=\"https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot\" target=\"_blank\">https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot</a>",
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
"provider.ctcccloud": "联通云",
|
||||
"provider.cucccloud": "天翼云",
|
||||
"provider.desec": "deSEC",
|
||||
"provider.digitalocean": "DigitalOcean",
|
||||
"provider.dingtalkbot": "钉钉群机器人",
|
||||
"provider.dnsla": "DNS.LA",
|
||||
"provider.dogecloud": "多吉云",
|
||||
|
||||
Reference in New Issue
Block a user