feat: add dingtalk, lark, and wecom bot webhook

This commit is contained in:
Fu Diwei
2025-04-27 23:44:01 +08:00
parent 7e707cd973
commit 18a19096d3
19 changed files with 372 additions and 10 deletions

View File

@@ -22,6 +22,7 @@ export interface AccessModel extends BaseModel {
| AccessConfigForClouDNS
| AccessConfigForCMCCCloud
| AccessConfigForDeSEC
| AccessConfigForDingTalkBot
| AccessConfigForDNSLA
| AccessConfigForDogeCloud
| AccessConfigForDynv6
@@ -34,6 +35,7 @@ export interface AccessModel extends BaseModel {
| AccessConfigForHuaweiCloud
| AccessConfigForJDCloud
| AccessConfigForKubernetes
| AccessConfigForLarkBot
| AccessConfigForMattermost
| AccessConfigForNamecheap
| AccessConfigForNameDotCom
@@ -53,6 +55,7 @@ export interface AccessModel extends BaseModel {
| AccessConfigForVolcEngine
| AccessConfigForWangsu
| AccessConfigForWebhook
| AccessConfigForWeComBot
| AccessConfigForWestcn
| AccessConfigForZeroSSL
);
@@ -143,6 +146,11 @@ export type AccessConfigForDeSEC = {
token: string;
};
export type AccessConfigForDingTalkBot = {
webhookUrl: string;
secret?: string;
};
export type AccessConfigForDNSLA = {
apiId: string;
apiSecret: string;
@@ -205,6 +213,10 @@ export type AccessConfigForKubernetes = {
kubeConfig?: string;
};
export type AccessConfigForLarkBot = {
webhookUrl: string;
};
export type AccessConfigForMattermost = {
serverUrl: string;
username: string;
@@ -315,6 +327,10 @@ export type AccessConfigForWebhook = {
defaultDataForNotification?: string;
};
export type AccessConfigForWeComBot = {
webhookUrl: string;
};
export type AccessConfigForWestcn = {
username: string;
apiPassword: string;

View File

@@ -21,6 +21,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
CLOUDNS: "cloudns",
CMCCCLOUD: "cmcccloud",
DESEC: "desec",
DINGTALKBOT: "dingtalkbot",
DNSLA: "dnsla",
DOGECLOUD: "dogecloud",
DYNV6: "dynv6",
@@ -33,6 +34,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
HUAWEICLOUD: "huaweicloud",
JDCLOUD: "jdcloud",
KUBERNETES: "k8s",
LARKBOT: "larkbot",
LETSENCRYPT: "letsencrypt",
LETSENCRYPTSTAGING: "letsencryptstaging",
LOCAL: "local",
@@ -56,6 +58,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
VOLCENGINE: "volcengine",
WANGSU: "wangsu",
WEBHOOK: "webhook",
WECOMBOT: "wecombot",
WESTCN: "westcn",
ZEROSSL: "zerossl",
} as const);
@@ -142,6 +145,9 @@ export const accessProvidersMap: Map<AccessProvider["type"] | string, AccessProv
[ACCESS_PROVIDERS.ZEROSSL, "provider.zerossl", "/imgs/providers/zerossl.svg", [ACCESS_USAGES.CA]],
[ACCESS_PROVIDERS.EMAIL, "provider.email", "/imgs/providers/email.svg", [ACCESS_USAGES.NOTIFICATION]],
[ACCESS_PROVIDERS.DINGTALKBOT, "provider.dingtalkbot", "/imgs/providers/dingtalk.svg", [ACCESS_USAGES.NOTIFICATION]],
[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]],
].map((e) => [
@@ -514,10 +520,13 @@ export const deploymentProvidersMap: Map<DeploymentProvider["type"] | string, De
NOTICE: If you add new constant, please keep ASCII order.
*/
export const NOTIFICATION_PROVIDERS = Object.freeze({
DINGTALKBOT: `${ACCESS_PROVIDERS.DINGTALKBOT}`,
EMAIL: `${ACCESS_PROVIDERS.EMAIL}`,
LARKBOT: `${ACCESS_PROVIDERS.LARKBOT}`,
MATTERMOST: `${ACCESS_PROVIDERS.MATTERMOST}`,
TELEGRAM: `${ACCESS_PROVIDERS.TELEGRAM}`,
WEBHOOK: `${ACCESS_PROVIDERS.WEBHOOK}`,
WECOMBOT: `${ACCESS_PROVIDERS.WECOMBOT}`,
} as const);
export type NotificationProviderType = (typeof CA_PROVIDERS)[keyof typeof CA_PROVIDERS];
@@ -534,7 +543,15 @@ export const notificationProvidersMap: Map<NotificationProvider["type"] | string
注意:此处的顺序决定显示在前端的顺序。
NOTICE: The following order determines the order displayed at the frontend.
*/
[[NOTIFICATION_PROVIDERS.EMAIL], [NOTIFICATION_PROVIDERS.WEBHOOK], [NOTIFICATION_PROVIDERS.MATTERMOST], [NOTIFICATION_PROVIDERS.TELEGRAM]].map(([type]) => [
[
[NOTIFICATION_PROVIDERS.EMAIL],
[NOTIFICATION_PROVIDERS.WEBHOOK],
[NOTIFICATION_PROVIDERS.DINGTALKBOT],
[NOTIFICATION_PROVIDERS.LARKBOT],
[NOTIFICATION_PROVIDERS.WECOMBOT],
[NOTIFICATION_PROVIDERS.MATTERMOST],
[NOTIFICATION_PROVIDERS.TELEGRAM],
].map(([type]) => [
type,
{
type: type as CAProviderType,

View File

@@ -87,12 +87,18 @@ export type NotifyChannelsSettingsContent = {
[NOTIFY_CHANNELS.WECOM]?: WeComNotifyChannelConfig;
};
/**
* @deprecated
*/
export type BarkNotifyChannelConfig = {
deviceKey: string;
serverUrl: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type EmailNotifyChannelConfig = {
smtpHost: string;
smtpPort: number;
@@ -104,12 +110,18 @@ export type EmailNotifyChannelConfig = {
enabled?: boolean;
};
/**
* @deprecated
*/
export type DingTalkNotifyChannelConfig = {
accessToken: string;
secret: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type GotifyNotifyChannelConfig = {
url: string;
token: string;
@@ -117,11 +129,17 @@ export type GotifyNotifyChannelConfig = {
enabled?: boolean;
};
/**
* @deprecated
*/
export type LarkNotifyChannelConfig = {
webhookUrl: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type MattermostNotifyChannelConfig = {
serverUrl: string;
channel: string;
@@ -130,38 +148,59 @@ export type MattermostNotifyChannelConfig = {
enabled?: boolean;
};
/**
* @deprecated
*/
export type PushoverNotifyChannelConfig = {
token: string;
user: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type PushPlusNotifyChannelConfig = {
token: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type ServerChanNotifyChannelConfig = {
url: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type TelegramNotifyChannelConfig = {
apiToken: string;
chatId: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type WebhookNotifyChannelConfig = {
url: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type WeComNotifyChannelConfig = {
webhookUrl: string;
enabled?: boolean;
};
/**
* @deprecated
*/
export type NotifyChannel = {
type: string;
name: string;