mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 22:14:53 +00:00
feat: support pushover as notification
This commit is contained in:
@@ -9,6 +9,7 @@ import NotifyChannelEditFormDingTalkFields from "./NotifyChannelEditFormDingTalk
|
||||
import NotifyChannelEditFormEmailFields from "./NotifyChannelEditFormEmailFields";
|
||||
import NotifyChannelEditFormGotifyFields from "./NotifyChannelEditFormGotifyFields.tsx";
|
||||
import NotifyChannelEditFormLarkFields from "./NotifyChannelEditFormLarkFields";
|
||||
import NotifyChannelEditFormPushoverFields from "./NotifyChannelEditFormPushoverFields";
|
||||
import NotifyChannelEditFormPushPlusFields from "./NotifyChannelEditFormPushPlusFields";
|
||||
import NotifyChannelEditFormServerChanFields from "./NotifyChannelEditFormServerChanFields";
|
||||
import NotifyChannelEditFormTelegramFields from "./NotifyChannelEditFormTelegramFields";
|
||||
@@ -54,6 +55,8 @@ const NotifyChannelEditForm = forwardRef<NotifyChannelEditFormInstance, NotifyCh
|
||||
return <NotifyChannelEditFormGotifyFields />;
|
||||
case NOTIFY_CHANNELS.LARK:
|
||||
return <NotifyChannelEditFormLarkFields />;
|
||||
case NOTIFY_CHANNELS.PUSHOVER:
|
||||
return <NotifyChannelEditFormPushoverFields />;
|
||||
case NOTIFY_CHANNELS.PUSHPLUS:
|
||||
return <NotifyChannelEditFormPushPlusFields />;
|
||||
case NOTIFY_CHANNELS.SERVERCHAN:
|
||||
|
@@ -0,0 +1,41 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
const NotifyChannelEditFormPushoverFields = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
token: z
|
||||
.string({ message: t("settings.notification.channel.form.pushover_token.placeholder") })
|
||||
.nonempty(t("settings.notification.channel.form.pushover_token.placeholder")),
|
||||
user: z
|
||||
.string({ message: t("settings.notification.channel.form.pushover_user.placeholder") })
|
||||
.nonempty(t("settings.notification.channel.form.pushover_user.placeholder")),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form.Item
|
||||
name="token"
|
||||
label={t("settings.notification.channel.form.pushover_token.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("settings.notification.channel.form.pushover_token.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("settings.notification.channel.form.pushover_token.placeholder")} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="user"
|
||||
label={t("settings.notification.channel.form.pushover_user.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("settings.notification.channel.form.pushover_user.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("settings.notification.channel.form.pushover_user.placeholder")} />
|
||||
</Form.Item>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default NotifyChannelEditFormPushoverFields;
|
@@ -44,6 +44,7 @@ export const NOTIFY_CHANNELS = Object.freeze({
|
||||
EMAIL: "email",
|
||||
GOTIFY: "gotify",
|
||||
LARK: "lark",
|
||||
PUSHOVER: "pushover",
|
||||
PUSHPLUS: "pushplus",
|
||||
SERVERCHAN: "serverchan",
|
||||
TELEGRAM: "telegram",
|
||||
@@ -64,6 +65,7 @@ export type NotifyChannelsSettingsContent = {
|
||||
[NOTIFY_CHANNELS.EMAIL]?: EmailNotifyChannelConfig;
|
||||
[NOTIFY_CHANNELS.GOTIFY]?: GotifyNotifyChannelConfig;
|
||||
[NOTIFY_CHANNELS.LARK]?: LarkNotifyChannelConfig;
|
||||
[NOTIFY_CHANNELS.PUSHOVER]?: PushoverNotifyChannelConfig;
|
||||
[NOTIFY_CHANNELS.PUSHPLUS]?: PushPlusNotifyChannelConfig;
|
||||
[NOTIFY_CHANNELS.SERVERCHAN]?: ServerChanNotifyChannelConfig;
|
||||
[NOTIFY_CHANNELS.TELEGRAM]?: TelegramNotifyChannelConfig;
|
||||
@@ -106,6 +108,12 @@ export type LarkNotifyChannelConfig = {
|
||||
enabled?: boolean;
|
||||
};
|
||||
|
||||
export type PushoverNotifyChannelConfig = {
|
||||
token: string;
|
||||
user: string;
|
||||
enabled?: boolean;
|
||||
};
|
||||
|
||||
export type PushPlusNotifyChannelConfig = {
|
||||
token: string;
|
||||
enabled?: boolean;
|
||||
@@ -143,6 +151,7 @@ export const notifyChannelsMap: Map<NotifyChannel["type"], NotifyChannel> = new
|
||||
[NOTIFY_CHANNELS.DINGTALK, "common.notifier.dingtalk"],
|
||||
[NOTIFY_CHANNELS.GOTIFY, "common.notifier.gotify"],
|
||||
[NOTIFY_CHANNELS.LARK, "common.notifier.lark"],
|
||||
[NOTIFY_CHANNELS.PUSHOVER, "common.notifier.pushover"],
|
||||
[NOTIFY_CHANNELS.PUSHPLUS, "common.notifier.pushplus"],
|
||||
[NOTIFY_CHANNELS.WECOM, "common.notifier.wecom"],
|
||||
[NOTIFY_CHANNELS.TELEGRAM, "common.notifier.telegram"],
|
||||
|
@@ -41,6 +41,7 @@
|
||||
"common.notifier.email": "Email",
|
||||
"common.notifier.gotify": "Gotify",
|
||||
"common.notifier.lark": "Lark",
|
||||
"common.notifier.pushover": "Pushover",
|
||||
"common.notifier.pushplus": "PushPlus",
|
||||
"common.notifier.serverchan": "ServerChan",
|
||||
"common.notifier.telegram": "Telegram",
|
||||
|
@@ -66,6 +66,12 @@
|
||||
"settings.notification.channel.form.lark_webhook_url.label": "Webhook URL",
|
||||
"settings.notification.channel.form.lark_webhook_url.placeholder": "Please enter Webhook URL",
|
||||
"settings.notification.channel.form.lark_webhook_url.tooltip": "For more information, see <a href=\"https://www.feishu.cn/hc/en-US/articles/807992406756\" target=\"_blank\">https://www.feishu.cn/hc/en-US/articles/807992406756</a>",
|
||||
"settings.notification.channel.form.pushover_token.placeholder": "Please enter Application API Token",
|
||||
"settings.notification.channel.form.pushover_token.label": "Application API Token",
|
||||
"settings.notification.channel.form.pushover_token.tooltip": "For more information, see <a href=\"https://pushover.net/api#registration\" target=\"_blank\">https://pushover.net/api#registration</a>",
|
||||
"settings.notification.channel.form.pushover_user.placeholder": "Please enter User/Group Key",
|
||||
"settings.notification.channel.form.pushover_user.label": "User/Group Key",
|
||||
"settings.notification.channel.form.pushover_user.tooltip": "For more information, see <a href=\"https://pushover.net/api#identifiers\" target=\"_blank\">https://pushover.net/api#identifiers</a>",
|
||||
"settings.notification.channel.form.pushplus_token.placeholder": "Please enter Token",
|
||||
"settings.notification.channel.form.pushplus_token.label": "Token",
|
||||
"settings.notification.channel.form.pushplus_token.tooltip": "For more information, see <a href=\"https://www.pushplus.plus/push1.html\" target=\"_blank\">https://www.pushplus.plus/push1.html</a>",
|
||||
|
@@ -41,6 +41,7 @@
|
||||
"common.notifier.email": "邮件",
|
||||
"common.notifier.gotify": "Gotify",
|
||||
"common.notifier.lark": "飞书",
|
||||
"common.notifier.pushover": "Pushover",
|
||||
"common.notifier.pushplus": "PushPlus推送加",
|
||||
"common.notifier.serverchan": "Server 酱",
|
||||
"common.notifier.telegram": "Telegram",
|
||||
|
@@ -66,6 +66,12 @@
|
||||
"settings.notification.channel.form.lark_webhook_url.label": "机器人 Webhook 地址",
|
||||
"settings.notification.channel.form.lark_webhook_url.placeholder": "请输入机器人 Webhook 地址",
|
||||
"settings.notification.channel.form.lark_webhook_url.tooltip": "这是什么?请参阅 <a href=\"https://www.feishu.cn/hc/zh-CN/articles/807992406756\" target=\"_blank\">https://www.feishu.cn/hc/zh-CN/articles/807992406756</a>",
|
||||
"settings.notification.channel.form.pushover_token.placeholder": "请输入应用 API Token",
|
||||
"settings.notification.channel.form.pushover_token.label": "应用 API Token",
|
||||
"settings.notification.channel.form.pushover_token.tooltip": "这是什么?请参阅 <a href=\"https://pushover.net/api#registration\" target=\"_blank\">https://pushover.net/api#registration</a>",
|
||||
"settings.notification.channel.form.pushover_user.placeholder": "请输入用户/分组 Key",
|
||||
"settings.notification.channel.form.pushover_user.label": "用户/分组 Key",
|
||||
"settings.notification.channel.form.pushover_user.tooltip": "这是什么?请参阅 <a href=\"https://pushover.net/api#identifiers\" target=\"_blank\">https://pushover.net/api#identifiers</a>",
|
||||
"settings.notification.channel.form.pushplus_token.placeholder": "请输入Token",
|
||||
"settings.notification.channel.form.pushplus_token.label": "Token",
|
||||
"settings.notification.channel.form.pushplus_token.tooltip": "请参阅 <a href=\"https://www.pushplus.plus/push1.html\" target=\"_blank\">https://www.pushplus.plus/push1.html</a>",
|
||||
|
Reference in New Issue
Block a user