Merge pull request #735 from fudiwei/feat/providers

enhance providers
This commit is contained in:
RHQYZ
2025-06-01 23:04:42 +08:00
committed by GitHub
160 changed files with 610 additions and 380 deletions

View File

@@ -28,14 +28,15 @@ const AccessFormAliyunConfig = ({ form: formInst, formName, disabled, initialVal
const formSchema = z.object({
accessKeyId: z
.string()
.trim()
.min(1, t("access.form.aliyun_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
accessKeySecret: z
.string()
.trim()
.min(1, t("access.form.aliyun_access_key_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
resourceGroupId: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);
@@ -69,6 +70,24 @@ const AccessFormAliyunConfig = ({ form: formInst, formName, disabled, initialVal
>
<Input.Password autoComplete="new-password" placeholder={t("access.form.aliyun_access_key_secret.placeholder")} />
</Form.Item>
<Form.Item
name="securityToken"
label={t("access.form.aliyun_security_token.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.aliyun_security_token.tooltip") }}></span>}
>
<Input allowClear autoComplete="new-password" placeholder={t("access.form.aliyun_security_token.placeholder")} />
</Form.Item>
<Form.Item
name="resourceGroupId"
label={t("access.form.aliyun_resource_group_id.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.aliyun_resource_group_id.tooltip") }}></span>}
>
<Input allowClear autoComplete="new-password" placeholder={t("access.form.aliyun_resource_group_id.placeholder")} />
</Form.Item>
</Form>
);
};

View File

@@ -28,14 +28,15 @@ const AccessFormHuaweiCloudConfig = ({ form: formInst, formName, disabled, initi
const formSchema = z.object({
accessKeyId: z
.string()
.trim()
.min(1, t("access.form.huaweicloud_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretAccessKey: z
.string()
.trim()
.min(1, t("access.form.huaweicloud_secret_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
enterpriseProjectId: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);
@@ -69,6 +70,15 @@ const AccessFormHuaweiCloudConfig = ({ form: formInst, formName, disabled, initi
>
<Input.Password autoComplete="new-password" placeholder={t("access.form.huaweicloud_secret_access_key.placeholder")} />
</Form.Item>
<Form.Item
name="enterpriseProjectId"
label={t("access.form.huaweicloud_enterprise_project_id.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.huaweicloud_enterprise_project_id.tooltip") }}></span>}
>
<Input allowClear autoComplete="new-password" placeholder={t("access.form.huaweicloud_enterprise_project_id.placeholder")} />
</Form.Item>
</Form>
);
};

View File

@@ -224,7 +224,24 @@ const AccessFormWebhookConfig = ({ form: formInst, formName, disabled, initialVa
);
break;
case "serverchan":
case "serverchan3":
formInst.setFieldValue("url", "https://<your-serverchan-uid>.push.ft07.com/send/<your-serverchan-sendkey>.send");
formInst.setFieldValue("method", "POST");
formInst.setFieldValue("headers", "Content-Type: application/json");
formInst.setFieldValue(
"defaultDataForNotification",
JSON.stringify(
{
title: "${SUBJECT}",
desp: "${MESSAGE}",
},
null,
2
)
);
break;
case "serverchanturbo":
formInst.setFieldValue("url", "https://sctapi.ftqq.com/<your-serverchan-key>.send");
formInst.setFieldValue("method", "POST");
formInst.setFieldValue("headers", "Content-Type: application/json");
@@ -329,9 +346,9 @@ const AccessFormWebhookConfig = ({ form: formInst, formName, disabled, initialVa
<div className="text-right">
<Dropdown
menu={{
items: ["bark", "ntfy", "gotify", "pushover", "pushplus", "serverchan", "common"].map((key) => ({
items: ["bark", "ntfy", "gotify", "pushover", "pushplus", "serverchan3", "serverchanturbo", "common"].map((key) => ({
key,
label: t(`access.form.webhook_preset_data.option.${key}.label`),
label: <span dangerouslySetInnerHTML={{ __html: t(`access.form.webhook_preset_data.option.${key}.label`) }}></span>,
onClick: () => handlePresetDataForNotificationClick(key),
})),
}}