feat: add upyun file deployer

This commit is contained in:
Fu Diwei 2025-03-20 21:53:02 +08:00
parent 4acbbf6e13
commit e4fd1e78f5
8 changed files with 78 additions and 2 deletions

View File

@ -777,7 +777,7 @@ func createDeployer(options *deployerOptions) (deployer.Deployer, error) {
}
}
case domain.DeployProviderTypeUpyunCDN:
case domain.DeployProviderTypeUpyunCDN, domain.DeployProviderTypeUpyunFile:
{
access := domain.AccessConfigForUpyun{}
if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
@ -785,7 +785,7 @@ func createDeployer(options *deployerOptions) (deployer.Deployer, error) {
}
switch options.Provider {
case domain.DeployProviderTypeUpyunCDN:
case domain.DeployProviderTypeUpyunCDN, domain.DeployProviderTypeUpyunFile:
deployer, err := pUpyunCDN.NewDeployer(&pUpyunCDN.DeployerConfig{
Username: access.Username,
Password: access.Password,

View File

@ -161,6 +161,7 @@ const (
DeployProviderTypeUCloudUCDN = DeployProviderType("ucloud-ucdn")
DeployProviderTypeUCloudUS3 = DeployProviderType("ucloud-us3")
DeployProviderTypeUpyunCDN = DeployProviderType("upyun-cdn")
DeployProviderTypeUpyunFile = DeployProviderType("upyun-file")
DeployProviderTypeVolcEngineCDN = DeployProviderType("volcengine-cdn")
DeployProviderTypeVolcEngineCLB = DeployProviderType("volcengine-clb")
DeployProviderTypeVolcEngineDCDN = DeployProviderType("volcengine-dcdn")

View File

@ -0,0 +1,65 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { validDomainName } from "@/utils/validators";
type DeployNodeConfigFormUpyunFileConfigFieldValues = Nullish<{
domain: string;
}>;
export type DeployNodeConfigFormUpyunFileConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: DeployNodeConfigFormUpyunFileConfigFieldValues;
onValuesChange?: (values: DeployNodeConfigFormUpyunFileConfigFieldValues) => void;
};
const initFormModel = (): DeployNodeConfigFormUpyunFileConfigFieldValues => {
return {};
};
const DeployNodeConfigFormUpyunFileConfig = ({
form: formInst,
formName,
disabled,
initialValues,
onValuesChange,
}: DeployNodeConfigFormUpyunFileConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
domain: z
.string({ message: t("workflow_node.deploy.form.upyun_file_domain.placeholder") })
.refine((v) => validDomainName(v), t("common.errmsg.domain_invalid")),
});
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="domain"
label={t("workflow_node.deploy.form.upyun_file_domain.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.upyun_file_domain.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.upyun_file_domain.placeholder")} />
</Form.Item>
</Form>
);
};
export default DeployNodeConfigFormUpyunFileConfig;

View File

@ -266,6 +266,7 @@ export const DEPLOY_PROVIDERS = Object.freeze({
UCLOUD_UCDN: `${ACCESS_PROVIDERS.UCLOUD}-ucdn`,
UCLOUD_US3: `${ACCESS_PROVIDERS.UCLOUD}-us3`,
UPYUN_CDN: `${ACCESS_PROVIDERS.UPYUN}-cdn`,
UPYUN_FILE: `${ACCESS_PROVIDERS.UPYUN}-file`,
VOLCENGINE_CDN: `${ACCESS_PROVIDERS.VOLCENGINE}-cdn`,
VOLCENGINE_CLB: `${ACCESS_PROVIDERS.VOLCENGINE}-clb`,
VOLCENGINE_DCDN: `${ACCESS_PROVIDERS.VOLCENGINE}-dcdn`,
@ -347,6 +348,7 @@ export const deployProvidersMap: Map<DeployProvider["type"] | string, DeployProv
[DEPLOY_PROVIDERS.JDCLOUD_VOD, "provider.jdcloud.vod", DEPLOY_CATEGORIES.AV],
[DEPLOY_PROVIDERS.QINIU_CDN, "provider.qiniu.cdn", DEPLOY_CATEGORIES.CDN],
[DEPLOY_PROVIDERS.QINIU_PILI, "provider.qiniu.pili", DEPLOY_CATEGORIES.AV],
[DEPLOY_PROVIDERS.UPYUN_FILE, "provider.upyun.file", DEPLOY_CATEGORIES.STORAGE],
[DEPLOY_PROVIDERS.UPYUN_CDN, "provider.upyun.cdn", DEPLOY_CATEGORIES.CDN],
[DEPLOY_PROVIDERS.BAISHAN_CDN, "provider.baishan.cdn", DEPLOY_CATEGORIES.CDN],
[DEPLOY_PROVIDERS.DOGECLOUD_CDN, "provider.dogecloud.cdn", DEPLOY_CATEGORIES.CDN],

View File

@ -95,6 +95,7 @@
"provider.ucloud.us3": "UCloud - US3 (UCloud Object-based Storage)",
"provider.upyun": "UPYUN",
"provider.upyun.cdn": "UPYUN - CDN (Content Delivery Network)",
"provider.upyun.file": "UPYUN - File Storage",
"provider.volcengine": "Volcengine",
"provider.volcengine.cdn": "Volcengine - CDN (Content Delivery Network)",
"provider.volcengine.clb": "Volcengine - CLB (Cloud Load Balancer)",

View File

@ -511,6 +511,9 @@
"workflow_node.deploy.form.upyun_cdn_domain.label": "UPYUN CDN domain",
"workflow_node.deploy.form.upyun_cdn_domain.placeholder": "Please enter UPYUN CDN domain name",
"workflow_node.deploy.form.upyun_cdn_domain.tooltip": "For more information, see <a href=\"https://console.upyun.com/services/cdn/\" target=\"_blank\">https://console.upyun.com/services/cdn/</a>",
"workflow_node.deploy.form.upyun_file_domain.label": "UPYUN bucket domain",
"workflow_node.deploy.form.upyun_file_domain.placeholder": "Please enter UPYUN bucket domain name",
"workflow_node.deploy.form.upyun_file_domain.tooltip": "For more information, see <a href=\"https://console.upyun.com/services/file/\" target=\"_blank\">https://console.upyun.com/services/file/</a>",
"workflow_node.deploy.form.volcengine_cdn_domain.label": "VolcEngine CDN domain",
"workflow_node.deploy.form.volcengine_cdn_domain.placeholder": "Please enter VolcEngine CDN domain name",
"workflow_node.deploy.form.volcengine_cdn_domain.tooltip": "For more information, see <a href=\"https://console.volcengine.com/cdn/homepage\" target=\"_blank\">https://console.volcengine.com/cdn/homepage</a>",

View File

@ -95,6 +95,7 @@
"provider.ucloud.us3": "优刻得 - 对象存储 US3",
"provider.upyun": "又拍云",
"provider.upyun.cdn": "又拍云 - 云分发 CDN",
"provider.upyun.file": "又拍云 - 云存储",
"provider.volcengine": "火山引擎",
"provider.volcengine.cdn": "火山引擎 - 内容分发网络 CDN",
"provider.volcengine.clb": "火山引擎 - 负载均衡 CLB",

View File

@ -511,6 +511,9 @@
"workflow_node.deploy.form.upyun_cdn_domain.label": "又拍云 CDN 加速域名",
"workflow_node.deploy.form.upyun_cdn_domain.placeholder": "请输入又拍云 CDN 加速域名(支持泛域名)",
"workflow_node.deploy.form.upyun_cdn_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.upyun.com/services/cdn/\" target=\"_blank\">https://console.upyun.com/services/cdn/</a>",
"workflow_node.deploy.form.upyun_file_domain.label": "又拍云云存储加速域名",
"workflow_node.deploy.form.upyun_file_domain.placeholder": "请输入又拍云云存储加速域名",
"workflow_node.deploy.form.upyun_file_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.upyun.com/services/file/\" target=\"_blank\">https://console.upyun.com/services/file/</a>",
"workflow_node.deploy.form.volcengine_cdn_domain.label": "火山引擎 CDN 加速域名",
"workflow_node.deploy.form.volcengine_cdn_domain.placeholder": "请输入火山引擎 CDN 加速域名(支持泛域名)",
"workflow_node.deploy.form.volcengine_cdn_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.volcengine.com/cdn/homepage\" target=\"_blank\">https://console.volcengine.com/cdn/homepage</a>",