mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-04 21:44:54 +00:00
add feat: tencent TEO deploy support
新增腾讯TEO(Edge One)部署方式
This commit is contained in:
@@ -14,6 +14,7 @@ import DeployToAliyunCDN from "./DeployToAliyunCDN";
|
||||
import DeployToTencentCDN from "./DeployToTencentCDN";
|
||||
import DeployToTencentCLB from "./DeployToTencentCLB";
|
||||
import DeployToTencentCOS from "./DeployToTencentCOS";
|
||||
import DeployToTencentTEO from "./DeployToTencentTEO";
|
||||
import DeployToHuaweiCloudCDN from "./DeployToHuaweiCloudCDN";
|
||||
import DeployToHuaweiCloudELB from "./DeployToHuaweiCloudELB";
|
||||
import DeployToQiniuCDN from "./DeployToQiniuCDN";
|
||||
@@ -128,6 +129,9 @@ const DeployEditDialog = ({ trigger, deployConfig, onSave }: DeployEditDialogPro
|
||||
case "tencent-cos":
|
||||
childComponent = <DeployToTencentCOS />;
|
||||
break;
|
||||
case "tencent-teo":
|
||||
childComponent = <DeployToTencentTEO />;
|
||||
break;
|
||||
case "huaweicloud-cdn":
|
||||
childComponent = <DeployToHuaweiCloudCDN />;
|
||||
break;
|
||||
|
131
ui/src/components/certimate/DeployToTencentTEO.tsx
Normal file
131
ui/src/components/certimate/DeployToTencentTEO.tsx
Normal file
@@ -0,0 +1,131 @@
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { z } from "zod";
|
||||
import { produce } from "immer";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useDeployEditContext } from "./DeployEdit";
|
||||
|
||||
const DeployToTencentTEO = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { deploy: data, setDeploy, error, setError } = useDeployEditContext();
|
||||
|
||||
useEffect(() => {
|
||||
setError({});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const resp = domainSchema.safeParse(data.config?.domain);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
domain: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
domain: "",
|
||||
});
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
const resp = ZoneIdSchema.safeParse(data.config?.zoneId);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
zoneId: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
zoneId: "",
|
||||
});
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
const domainSchema = z.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, {
|
||||
message: t("common.errmsg.domain_invalid"),
|
||||
});
|
||||
|
||||
const ZoneIdSchema = z.string().regex(/^zone-[0-9a-zA-Z]{9}$/, {
|
||||
message: t("common.errmsg.domain_invalid"),
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex flex-col space-y-8">
|
||||
<div>
|
||||
<Label>{t("domain.deployment.form.tencent_teo_zone_id.label")}</Label>
|
||||
<Input
|
||||
placeholder={t("domain.deployment.form.tencent_teo_zone_id.placeholder")}
|
||||
className="w-full mt-1"
|
||||
value={data?.config?.zoneId}
|
||||
onChange={(e) => {
|
||||
const temp = e.target.value;
|
||||
|
||||
const resp = ZoneIdSchema.safeParse(temp);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
zoneId: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
zoneId: "",
|
||||
});
|
||||
}
|
||||
|
||||
const newData = produce(data, (draft) => {
|
||||
if (!draft.config) {
|
||||
draft.config = {};
|
||||
}
|
||||
draft.config.zoneId = temp;
|
||||
});
|
||||
setDeploy(newData);
|
||||
}}
|
||||
/>
|
||||
<div className="text-red-600 text-sm mt-1">{error?.zoneId}</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>{t("domain.deployment.form.tencent_teo_domain.label")}</Label>
|
||||
<Textarea
|
||||
placeholder={t("domain.deployment.form.tencent_teo_domain.placeholder")}
|
||||
className="w-full mt-1"
|
||||
value={data?.config?.domain}
|
||||
onChange={(e) => {
|
||||
const temp = e.target.value;
|
||||
|
||||
const resp = domainSchema.safeParse(temp);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
domain: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
domain: "",
|
||||
});
|
||||
}
|
||||
|
||||
const newData = produce(data, (draft) => {
|
||||
if (!draft.config) {
|
||||
draft.config = {};
|
||||
}
|
||||
draft.config.domain = temp;
|
||||
});
|
||||
setDeploy(newData);
|
||||
}}
|
||||
/>
|
||||
<div className="text-red-600 text-sm mt-1">{error?.domain}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DeployToTencentTEO;
|
@@ -79,6 +79,7 @@ export const deployTargetsMap: Map<DeployTarget["type"], DeployTarget> = new Map
|
||||
["tencent-ecdn", "common.provider.tencent.ecdn", "/imgs/providers/tencent.svg"],
|
||||
["tencent-clb", "common.provider.tencent.clb", "/imgs/providers/tencent.svg"],
|
||||
["tencent-cos", "common.provider.tencent.cos", "/imgs/providers/tencent.svg"],
|
||||
["tencent-teo", "common.provider.tencent.teo", "/imgs/providers/tencent.svg"],
|
||||
["huaweicloud-cdn", "common.provider.huaweicloud.cdn", "/imgs/providers/huaweicloud.svg"],
|
||||
["huaweicloud-elb", "common.provider.huaweicloud.elb", "/imgs/providers/huaweicloud.svg"],
|
||||
["qiniu-cdn", "common.provider.qiniu.cdn", "/imgs/providers/qiniu.svg"],
|
||||
|
@@ -61,6 +61,7 @@
|
||||
"common.provider.tencent.ecdn": "Tencent Cloud - ECDN",
|
||||
"common.provider.tencent.clb": "Tencent Cloud - CLB",
|
||||
"common.provider.tencent.cos": "Tencent Cloud - COS",
|
||||
"common.provider.tencent.teo": "Tencent Cloud - TEO",
|
||||
"common.provider.huaweicloud": "Huawei Cloud",
|
||||
"common.provider.huaweicloud.cdn": "Huawei Cloud - CDN",
|
||||
"common.provider.huaweicloud.elb": "Huawei Cloud - ELB",
|
||||
|
@@ -73,6 +73,10 @@
|
||||
"domain.deployment.form.tencent_clb_listener.placeholder": "Please enter listener ID (e.g. lbl-xxxxxxxx). The specific listener should have set the corresponding domain HTTPS forwarding, and the original certificate domain should be consistent with the certificate to be deployed.",
|
||||
"domain.deployment.form.tencent_clb_domain.label": "Deploy to domain (Wildcard domain is also supported)",
|
||||
"domain.deployment.form.tencent_clb_domain.placeholder": "Please enter domain to be deployed. If SNI is not enabled, you can leave it blank.",
|
||||
"domain.deployment.form.tencent_teo_zone_id.label": "Zone ID",
|
||||
"domain.deployment.form.tencent_teo_zone_id.placeholder": "Please enter zone id, e.g. zone-xxxxxxxxx",
|
||||
"domain.deployment.form.tencent_teo_domain.label": "Deploy to domain (Wildcard domain is also supported, but should be same as the config on server, one domain each line)",
|
||||
"domain.deployment.form.tencent_teo_domain.placeholder": "Please enter domain to be deployed.",
|
||||
"domain.deployment.form.huaweicloud_elb_region.label": "Region",
|
||||
"domain.deployment.form.huaweicloud_elb_region.placeholder": "Please enter region (e.g. cn-north-1)",
|
||||
"domain.deployment.form.huaweicloud_elb_resource_type.label": "Resource Type",
|
||||
|
@@ -60,6 +60,7 @@
|
||||
"common.provider.tencent.cdn": "腾讯云 - CDN",
|
||||
"common.provider.tencent.ecdn": "腾讯云 - ECDN",
|
||||
"common.provider.tencent.clb": "腾讯云 - CLB",
|
||||
"common.provider.tencent.teo": "腾讯云 - TEO",
|
||||
"common.provider.huaweicloud": "华为云",
|
||||
"common.provider.huaweicloud.cdn": "华为云 - CDN",
|
||||
"common.provider.huaweicloud.elb": "华为云 - ELB",
|
||||
|
@@ -73,6 +73,10 @@
|
||||
"domain.deployment.form.tencent_clb_listener.placeholder": "请输入监听器 ID(如 lb-xxxxxxxx)",
|
||||
"domain.deployment.form.tencent_clb_domain.label": "部署到域名(支持泛域名)",
|
||||
"domain.deployment.form.tencent_clb_domain.placeholder": "请输入部署到的域名, 如未开启 SNI, 可置空忽略此项",
|
||||
"domain.deployment.form.tencent_teo_zone_id.label": "Zone ID",
|
||||
"domain.deployment.form.tencent_teo_zone_id.placeholder": "请输入zoneid, 形如: zone-xxxxxxxxx",
|
||||
"domain.deployment.form.tencent_teo_domain.label": "部署到域名(支持泛域名, 应与服务器上配置的域名完全一致, 每行一个域名。",
|
||||
"domain.deployment.form.tencent_teo_domain.placeholder": "请输入部署到的域名",
|
||||
"domain.deployment.form.huaweicloud_elb_region.label": "地域",
|
||||
"domain.deployment.form.huaweicloud_elb_region.placeholder": "请输入地域(如 cn-north-1)",
|
||||
"domain.deployment.form.huaweicloud_elb_resource_type.label": "资源类型替换方式",
|
||||
|
Reference in New Issue
Block a user