mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-04 21:44:54 +00:00
refactor: remove nikoksr/notify deps
This commit is contained in:
@@ -57,7 +57,7 @@ import AccessFormRainYunConfig from "./AccessFormRainYunConfig";
|
||||
import AccessFormSafeLineConfig from "./AccessFormSafeLineConfig";
|
||||
import AccessFormSSHConfig from "./AccessFormSSHConfig";
|
||||
import AccessFormSSLComConfig from "./AccessFormSSLComConfig";
|
||||
import AccessFormTelegramConfig from "./AccessFormTelegramConfig";
|
||||
import AccessFormTelegramBotConfig from "./AccessFormTelegramBotConfig";
|
||||
import AccessFormTencentCloudConfig from "./AccessFormTencentCloudConfig";
|
||||
import AccessFormUCloudConfig from "./AccessFormUCloudConfig";
|
||||
import AccessFormUpyunConfig from "./AccessFormUpyunConfig";
|
||||
@@ -264,8 +264,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
|
||||
return <AccessFormSafeLineConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.SSH:
|
||||
return <AccessFormSSHConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.TELEGRAM:
|
||||
return <AccessFormTelegramConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.TELEGRAMBOT:
|
||||
return <AccessFormTelegramBotConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.SSLCOM:
|
||||
return <AccessFormSSLComConfig {...nestedFormProps} />;
|
||||
case ACCESS_PROVIDERS.TENCENTCLOUD:
|
||||
|
@@ -3,25 +3,25 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type AccessConfigForTelegram } from "@/domain/access";
|
||||
import { type AccessConfigForTelegramBot } from "@/domain/access";
|
||||
|
||||
type AccessFormTelegramConfigFieldValues = Nullish<AccessConfigForTelegram>;
|
||||
type AccessFormTelegramBotConfigFieldValues = Nullish<AccessConfigForTelegramBot>;
|
||||
|
||||
export type AccessFormTelegramConfigProps = {
|
||||
export type AccessFormTelegramBotConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: AccessFormTelegramConfigFieldValues;
|
||||
onValuesChange?: (values: AccessFormTelegramConfigFieldValues) => void;
|
||||
initialValues?: AccessFormTelegramBotConfigFieldValues;
|
||||
onValuesChange?: (values: AccessFormTelegramBotConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const initFormModel = (): AccessFormTelegramConfigFieldValues => {
|
||||
const initFormModel = (): AccessFormTelegramBotConfigFieldValues => {
|
||||
return {
|
||||
botToken: "",
|
||||
};
|
||||
};
|
||||
|
||||
const AccessFormTelegramConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormTelegramConfigProps) => {
|
||||
const AccessFormTelegramBotConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormTelegramBotConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -38,7 +38,7 @@ const AccessFormTelegramConfig = ({ form: formInst, formName, disabled, initialV
|
||||
.refine((v) => {
|
||||
if (v == null || v + "" === "") return true;
|
||||
return /^\d+$/.test(v + "") && +v! > 0;
|
||||
}, t("access.form.telegram_default_chat_id.placeholder"))
|
||||
}, t("access.form.telegram_bot_default_chat_id.placeholder"))
|
||||
)
|
||||
.nullish(),
|
||||
});
|
||||
@@ -68,14 +68,14 @@ const AccessFormTelegramConfig = ({ form: formInst, formName, disabled, initialV
|
||||
|
||||
<Form.Item
|
||||
name="defaultChatId"
|
||||
label={t("access.form.telegram_default_chat_id.label")}
|
||||
label={t("access.form.telegram_bot_default_chat_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.telegram_default_chat_id.tooltip") }}></span>}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.telegram_bot_default_chat_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input type="number" allowClear placeholder={t("access.form.telegram_default_chat_id.placeholder")} />
|
||||
<Input type="number" allowClear placeholder={t("access.form.telegram_bot_default_chat_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default AccessFormTelegramConfig;
|
||||
export default AccessFormTelegramBotConfig;
|
@@ -142,8 +142,7 @@ const AccessFormWebhookConfig = ({ form: formInst, formName, disabled, initialVa
|
||||
{
|
||||
title: "${SUBJECT}",
|
||||
body: "${MESSAGE}",
|
||||
group: "<your-bark-group>",
|
||||
device_keys: "<your-bark-device-key>",
|
||||
device_key: "<your-bark-device-key>",
|
||||
},
|
||||
null,
|
||||
2
|
||||
|
@@ -19,7 +19,7 @@ import { useNotifyChannelsStore } from "@/stores/notify";
|
||||
|
||||
import NotifyNodeConfigFormEmailConfig from "./NotifyNodeConfigFormEmailConfig";
|
||||
import NotifyNodeConfigFormMattermostConfig from "./NotifyNodeConfigFormMattermostConfig";
|
||||
import NotifyNodeConfigFormTelegramConfig from "./NotifyNodeConfigFormTelegramConfig";
|
||||
import NotifyNodeConfigFormTelegramBotConfig from "./NotifyNodeConfigFormTelegramBotConfig";
|
||||
import NotifyNodeConfigFormWebhookConfig from "./NotifyNodeConfigFormWebhookConfig";
|
||||
|
||||
type NotifyNodeConfigFormFieldValues = Partial<WorkflowNodeConfigForNotify>;
|
||||
@@ -114,8 +114,8 @@ const NotifyNodeConfigForm = forwardRef<NotifyNodeConfigFormInstance, NotifyNode
|
||||
return <NotifyNodeConfigFormEmailConfig {...nestedFormProps} />;
|
||||
case NOTIFICATION_PROVIDERS.MATTERMOST:
|
||||
return <NotifyNodeConfigFormMattermostConfig {...nestedFormProps} />;
|
||||
case NOTIFICATION_PROVIDERS.TELEGRAM:
|
||||
return <NotifyNodeConfigFormTelegramConfig {...nestedFormProps} />;
|
||||
case NOTIFICATION_PROVIDERS.TELEGRAMBOT:
|
||||
return <NotifyNodeConfigFormTelegramBotConfig {...nestedFormProps} />;
|
||||
case NOTIFICATION_PROVIDERS.WEBHOOK:
|
||||
return <NotifyNodeConfigFormWebhookConfig {...nestedFormProps} />;
|
||||
}
|
||||
|
@@ -3,23 +3,29 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
type NotifyNodeConfigFormTelegramConfigFieldValues = Nullish<{
|
||||
type NotifyNodeConfigFormTelegramBotConfigFieldValues = Nullish<{
|
||||
chatId?: string | number;
|
||||
}>;
|
||||
|
||||
export type NotifyNodeConfigFormTelegramConfigProps = {
|
||||
export type NotifyNodeConfigFormTelegramBotConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: NotifyNodeConfigFormTelegramConfigFieldValues;
|
||||
onValuesChange?: (values: NotifyNodeConfigFormTelegramConfigFieldValues) => void;
|
||||
initialValues?: NotifyNodeConfigFormTelegramBotConfigFieldValues;
|
||||
onValuesChange?: (values: NotifyNodeConfigFormTelegramBotConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const initFormModel = (): NotifyNodeConfigFormTelegramConfigFieldValues => {
|
||||
const initFormModel = (): NotifyNodeConfigFormTelegramBotConfigFieldValues => {
|
||||
return {};
|
||||
};
|
||||
|
||||
const NotifyNodeConfigFormTelegramConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: NotifyNodeConfigFormTelegramConfigProps) => {
|
||||
const NotifyNodeConfigFormTelegramBotConfig = ({
|
||||
form: formInst,
|
||||
formName,
|
||||
disabled,
|
||||
initialValues,
|
||||
onValuesChange,
|
||||
}: NotifyNodeConfigFormTelegramBotConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -32,7 +38,7 @@ const NotifyNodeConfigFormTelegramConfig = ({ form: formInst, formName, disabled
|
||||
.refine((v) => {
|
||||
if (v == null || v + "" === "") return true;
|
||||
return /^\d+$/.test(v + "") && +v! > 0;
|
||||
}, t("workflow_node.notify.form.telegram_chat_id.placeholder"))
|
||||
}, t("workflow_node.notify.form.telegram_bot_chat_id.placeholder"))
|
||||
)
|
||||
.nullish(),
|
||||
});
|
||||
@@ -53,14 +59,14 @@ const NotifyNodeConfigFormTelegramConfig = ({ form: formInst, formName, disabled
|
||||
>
|
||||
<Form.Item
|
||||
name="chatId"
|
||||
label={t("workflow_node.notify.form.telegram_chat_id.label")}
|
||||
label={t("workflow_node.notify.form.telegram_bot_chat_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.notify.form.telegram_chat_id.tooltip") }}></span>}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.notify.form.telegram_bot_chat_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input type="number" allowClear placeholder={t("workflow_node.notify.form.telegram_chat_id.placeholder")} />
|
||||
<Input type="number" allowClear placeholder={t("workflow_node.notify.form.telegram_bot_chat_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default NotifyNodeConfigFormTelegramConfig;
|
||||
export default NotifyNodeConfigFormTelegramBotConfig;
|
@@ -51,7 +51,7 @@ export interface AccessModel extends BaseModel {
|
||||
| AccessConfigForSafeLine
|
||||
| AccessConfigForSSH
|
||||
| AccessConfigForSSLCom
|
||||
| AccessConfigForTelegram
|
||||
| AccessConfigForTelegramBot
|
||||
| AccessConfigForTencentCloud
|
||||
| AccessConfigForUCloud
|
||||
| AccessConfigForUpyun
|
||||
@@ -312,7 +312,7 @@ export type AccessConfigForSSLCom = {
|
||||
eabHmacKey: string;
|
||||
};
|
||||
|
||||
export type AccessConfigForTelegram = {
|
||||
export type AccessConfigForTelegramBot = {
|
||||
botToken: string;
|
||||
defaultChatId?: number;
|
||||
};
|
||||
|
@@ -54,7 +54,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
|
||||
SAFELINE: "safeline",
|
||||
SSH: "ssh",
|
||||
SSLCOM: "sslcom",
|
||||
TELEGRAM: "telegram",
|
||||
TELEGRAMBOT: "telegrambot",
|
||||
TENCENTCLOUD: "tencentcloud",
|
||||
UCLOUD: "ucloud",
|
||||
UPYUN: "upyun",
|
||||
@@ -157,7 +157,7 @@ export const accessProvidersMap: Map<AccessProvider["type"] | string, AccessProv
|
||||
[ACCESS_PROVIDERS.LARKBOT, "provider.larkbot", "/imgs/providers/lark.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||
[ACCESS_PROVIDERS.WECOMBOT, "provider.wecombot", "/imgs/providers/wecom.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||
[ACCESS_PROVIDERS.MATTERMOST, "provider.mattermost", "/imgs/providers/mattermost.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||
[ACCESS_PROVIDERS.TELEGRAM, "provider.telegram", "/imgs/providers/telegram.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||
[ACCESS_PROVIDERS.TELEGRAMBOT, "provider.telegrambot", "/imgs/providers/telegram.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||
].map((e) => [
|
||||
e[0] as string,
|
||||
{
|
||||
@@ -547,7 +547,7 @@ export const NOTIFICATION_PROVIDERS = Object.freeze({
|
||||
EMAIL: `${ACCESS_PROVIDERS.EMAIL}`,
|
||||
LARKBOT: `${ACCESS_PROVIDERS.LARKBOT}`,
|
||||
MATTERMOST: `${ACCESS_PROVIDERS.MATTERMOST}`,
|
||||
TELEGRAM: `${ACCESS_PROVIDERS.TELEGRAM}`,
|
||||
TELEGRAMBOT: `${ACCESS_PROVIDERS.TELEGRAMBOT}`,
|
||||
WEBHOOK: `${ACCESS_PROVIDERS.WEBHOOK}`,
|
||||
WECOMBOT: `${ACCESS_PROVIDERS.WECOMBOT}`,
|
||||
} as const);
|
||||
@@ -573,7 +573,7 @@ export const notificationProvidersMap: Map<NotificationProvider["type"] | string
|
||||
[NOTIFICATION_PROVIDERS.LARKBOT],
|
||||
[NOTIFICATION_PROVIDERS.WECOMBOT],
|
||||
[NOTIFICATION_PROVIDERS.MATTERMOST],
|
||||
[NOTIFICATION_PROVIDERS.TELEGRAM],
|
||||
[NOTIFICATION_PROVIDERS.TELEGRAMBOT],
|
||||
].map(([type]) => [
|
||||
type,
|
||||
{
|
||||
|
@@ -343,9 +343,9 @@
|
||||
"access.form.telegram_bot_token.label": "Telegram bot token",
|
||||
"access.form.telegram_bot_token.placeholder": "Please enter Telegram bot token",
|
||||
"access.form.telegram_bot_token.tooltip": "How to get the bot token? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||
"access.form.telegram_default_chat_id.label": "Default Telegram chat ID (Optional)",
|
||||
"access.form.telegram_default_chat_id.placeholder": "Please enter default Telegram chat ID",
|
||||
"access.form.telegram_default_chat_id.tooltip": "How to get the chat ID? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||
"access.form.telegram_bot_default_chat_id.label": "Default Telegram chat ID (Optional)",
|
||||
"access.form.telegram_bot_default_chat_id.placeholder": "Please enter default Telegram chat ID",
|
||||
"access.form.telegram_bot_default_chat_id.tooltip": "How to get the chat ID? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||
"access.form.tencentcloud_secret_id.label": "Tencent Cloud SecretId",
|
||||
"access.form.tencentcloud_secret_id.placeholder": "Please enter Tencent Cloud SecretId",
|
||||
"access.form.tencentcloud_secret_id.tooltip": "For more information, see <a href=\"https://cloud.tencent.com/document/product/598/40488?lang=en\" target=\"_blank\">https://cloud.tencent.com/document/product/598/40488?lang=en</a>",
|
||||
|
@@ -106,7 +106,7 @@
|
||||
"provider.safeline": "SafeLine",
|
||||
"provider.ssh": "SSH deployment",
|
||||
"provider.sslcom": "SSL.com",
|
||||
"provider.telegram": "Telegram",
|
||||
"provider.telegrambot": "Telegram Bot",
|
||||
"provider.tencentcloud": "Tencent Cloud",
|
||||
"provider.tencentcloud.cdn": "Tencent Cloud - CDN (Content Delivery Network)",
|
||||
"provider.tencentcloud.clb": "Tencent Cloud - CLB (Cloud Load Balancer)",
|
||||
|
@@ -776,9 +776,9 @@
|
||||
"workflow_node.notify.form.mattermost_channel_id.label": "Mattermost channel ID (Optional)",
|
||||
"workflow_node.notify.form.mattermost_channel_id.placeholder": "Please enter Mattermost channel ID to override the default value",
|
||||
"workflow_node.notify.form.mattermost_channel_id.tooltip": "Leave it blank to use the default channel ID provided by the authorization.",
|
||||
"workflow_node.notify.form.telegram_chat_id.label": "Telegram chat ID (Optional)",
|
||||
"workflow_node.notify.form.telegram_chat_id.placeholder": "Please enter Telegram chat ID to override the default value",
|
||||
"workflow_node.notify.form.telegram_chat_id.tooltip": "Leave it blank to use the default chat ID provided by the selected authorization.",
|
||||
"workflow_node.notify.form.telegram_bot_chat_id.label": "Telegram chat ID (Optional)",
|
||||
"workflow_node.notify.form.telegram_bot_chat_id.placeholder": "Please enter Telegram chat ID to override the default value",
|
||||
"workflow_node.notify.form.telegram_bot_chat_id.tooltip": "Leave it blank to use the default chat ID provided by the selected authorization.",
|
||||
"workflow_node.notify.form.webhook_data.label": "Webhook data (Optional)",
|
||||
"workflow_node.notify.form.webhook_data.placeholder": "Please enter Webhook data to override the default value",
|
||||
"workflow_node.notify.form.webhook_data.tooltip": "Leave it blank to use the default Webhook data provided by the authorization.",
|
||||
|
@@ -334,12 +334,12 @@
|
||||
"access.form.sslcom_eab_hmac_key.label": "ACME EAB HMAC key",
|
||||
"access.form.sslcom_eab_hmac_key.placeholder": "请输入 ACME EAB HMAC key",
|
||||
"access.form.sslcom_eab_hmac_key.tooltip": "这是什么?请参阅 <a href=\"https://www.ssl.com/how-to/generate-acme-credentials-for-reseller-customers/#ftoc-heading-6\" target=\"_blank\">https://www.ssl.com/how-to/generate-acme-credentials-for-reseller-customers/</a>",
|
||||
"access.form.telegram_bot_token.label": "Telegram 机器人 API Token",
|
||||
"access.form.telegram_bot_token.placeholder": "请输入 Telegram 机器人 API Token",
|
||||
"access.form.telegram_bot_token.label": "Telegram 群机器人 API Token",
|
||||
"access.form.telegram_bot_token.placeholder": "请输入 Telegram 群机器人 API Token",
|
||||
"access.form.telegram_bot_token.tooltip": "如何获取机器人 API Token?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||
"access.form.telegram_default_chat_id.label": "默认的 Telegram 会话 ID(可选)",
|
||||
"access.form.telegram_default_chat_id.placeholder": "请输入默认的 Telegram 会话 ID",
|
||||
"access.form.telegram_default_chat_id.tooltip": "如何获取会话 ID?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||
"access.form.telegram_bot_default_chat_id.label": "默认的 Telegram 会话 ID(可选)",
|
||||
"access.form.telegram_bot_default_chat_id.placeholder": "请输入默认的 Telegram 会话 ID",
|
||||
"access.form.telegram_bot_default_chat_id.tooltip": "如何获取会话 ID?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||
"access.form.tencentcloud_secret_id.label": "腾讯云 SecretId",
|
||||
"access.form.tencentcloud_secret_id.placeholder": "请输入腾讯云 SecretId",
|
||||
"access.form.tencentcloud_secret_id.tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/598/40488\" target=\"_blank\">https://cloud.tencent.com/document/product/598/40488</a>",
|
||||
|
@@ -106,7 +106,7 @@
|
||||
"provider.safeline": "雷池",
|
||||
"provider.ssh": "SSH 部署",
|
||||
"provider.sslcom": "SSL.com",
|
||||
"provider.telegram": "Telegram",
|
||||
"provider.telegrambot": "Telegram 群机器人",
|
||||
"provider.tencentcloud": "腾讯云",
|
||||
"provider.tencentcloud.cdn": "腾讯云 - 内容分发网络 CDN",
|
||||
"provider.tencentcloud.clb": "腾讯云 - 负载均衡 CLB",
|
||||
|
@@ -775,9 +775,9 @@
|
||||
"workflow_node.notify.form.mattermost_channel_id.label": "Mattermost 频道 ID(可选)",
|
||||
"workflow_node.notify.form.mattermost_channel_id.placeholder": "请输入 Mattermost 频道 ID 以覆盖默认值",
|
||||
"workflow_node.notify.form.mattermost_channel_id.tooltip": "不填写时,将使用所选通知渠道授权的默认频道 ID。",
|
||||
"workflow_node.notify.form.telegram_chat_id.label": "Telegram 会话 ID(可选)",
|
||||
"workflow_node.notify.form.telegram_chat_id.placeholder": "请输入 Telegram 会话 ID 以覆盖默认值",
|
||||
"workflow_node.notify.form.telegram_chat_id.tooltip": "不填写时,将使用所选通知渠道授权的默认会话 ID。",
|
||||
"workflow_node.notify.form.telegram_bot_chat_id.label": "Telegram 会话 ID(可选)",
|
||||
"workflow_node.notify.form.telegram_bot_chat_id.placeholder": "请输入 Telegram 会话 ID 以覆盖默认值",
|
||||
"workflow_node.notify.form.telegram_bot_chat_id.tooltip": "不填写时,将使用所选通知渠道授权的默认会话 ID。",
|
||||
"workflow_node.notify.form.webhook_data.label": "Webhook 回调数据(可选)",
|
||||
"workflow_node.notify.form.webhook_data.placeholder": "请输入 Webhook 回调数据以覆盖默认值",
|
||||
"workflow_node.notify.form.webhook_data.tooltip": "不填写时,将使用所选部署目标授权的默认 Webhook 回调数据。",
|
||||
|
Reference in New Issue
Block a user