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

@ -98,6 +98,11 @@ type AccessConfigForDeSEC struct {
Token string `json:"token"`
}
type AccessConfigForDingTalkBot struct {
WebhookUrl string `json:"webhookUrl"`
Secret string `json:"secret"`
}
type AccessConfigForDNSLA struct {
ApiId string `json:"apiId"`
ApiSecret string `json:"apiSecret"`
@ -160,6 +165,10 @@ type AccessConfigForKubernetes struct {
KubeConfig string `json:"kubeConfig,omitempty"`
}
type AccessConfigForLarkBot struct {
WebhookUrl string `json:"webhookUrl"`
}
type AccessConfigForMattermost struct {
ServerUrl string `json:"serverUrl"`
Username string `json:"username"`
@ -270,6 +279,10 @@ type AccessConfigForWebhook struct {
DefaultDataForNotification string `json:"defaultDataForNotification,omitempty"`
}
type AccessConfigForWeComBot struct {
WebhookUrl string `json:"webhookUrl"`
}
type AccessConfigForWestcn struct {
Username string `json:"username"`
ApiPassword string `json:"password"`

View File

@ -29,6 +29,7 @@ const (
AccessProviderTypeCTCCCloud = AccessProviderType("ctcccloud") // 联通云(预留)
AccessProviderTypeCUCCCloud = AccessProviderType("cucccloud") // 天翼云(预留)
AccessProviderTypeDeSEC = AccessProviderType("desec")
AccessProviderTypeDingTalkBot = AccessProviderType("dingtalkbot")
AccessProviderTypeDNSLA = AccessProviderType("dnsla")
AccessProviderTypeDogeCloud = AccessProviderType("dogecloud")
AccessProviderTypeDynv6 = AccessProviderType("dynv6")
@ -43,6 +44,7 @@ const (
AccessProviderTypeHuaweiCloud = AccessProviderType("huaweicloud")
AccessProviderTypeJDCloud = AccessProviderType("jdcloud")
AccessProviderTypeKubernetes = AccessProviderType("k8s")
AccessProviderTypeLarkBot = AccessProviderType("larkbot")
AccessProviderTypeLetsEncrypt = AccessProviderType("letsencrypt")
AccessProviderTypeLetsEncryptStaging = AccessProviderType("letsencryptstaging")
AccessProviderTypeLocal = AccessProviderType("local")
@ -67,6 +69,7 @@ const (
AccessProviderTypeVolcEngine = AccessProviderType("volcengine")
AccessProviderTypeWangsu = AccessProviderType("wangsu")
AccessProviderTypeWebhook = AccessProviderType("webhook")
AccessProviderTypeWeComBot = AccessProviderType("wecombot")
AccessProviderTypeWestcn = AccessProviderType("westcn")
AccessProviderTypeZeroSSL = AccessProviderType("zerossl")
)
@ -234,8 +237,11 @@ type NotificationProviderType string
NOTICE: If you add new constant, please keep ASCII order.
*/
const (
NotificationProviderTypeEmail = NotificationProviderType(AccessProviderTypeEmail)
NotificationProviderTypeMattermost = NotificationProviderType(AccessProviderTypeMattermost)
NotificationProviderTypeTelegram = NotificationProviderType(AccessProviderTypeTelegram)
NotificationProviderTypeWebhook = NotificationProviderType(AccessProviderTypeWebhook)
NotificationProviderTypeDingTalkBot = NotificationProviderType(AccessProviderTypeDingTalkBot)
NotificationProviderTypeEmail = NotificationProviderType(AccessProviderTypeEmail)
NotificationProviderTypeLarkBot = NotificationProviderType(AccessProviderTypeLarkBot)
NotificationProviderTypeMattermost = NotificationProviderType(AccessProviderTypeMattermost)
NotificationProviderTypeTelegram = NotificationProviderType(AccessProviderTypeTelegram)
NotificationProviderTypeWebhook = NotificationProviderType(AccessProviderTypeWebhook)
NotificationProviderTypeWeComBot = NotificationProviderType(AccessProviderTypeWeComBot)
)

View File

@ -6,10 +6,13 @@ import (
"github.com/usual2970/certimate/internal/domain"
"github.com/usual2970/certimate/internal/pkg/core/notifier"
pDingTalk "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalk"
pEmail "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/email"
pLark "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/lark"
pMattermost "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/mattermost"
pTelegram "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegram"
pWebhook "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/webhook"
pWeCom "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecom"
httputil "github.com/usual2970/certimate/internal/pkg/utils/http"
maputil "github.com/usual2970/certimate/internal/pkg/utils/map"
)
@ -26,6 +29,19 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
NOTICE: If you add new constant, please keep ASCII order.
*/
switch options.Provider {
case domain.NotificationProviderTypeDingTalkBot:
{
access := domain.AccessConfigForDingTalkBot{}
if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
}
return pDingTalk.NewNotifier(&pDingTalk.NotifierConfig{
WebhookUrl: access.WebhookUrl,
Secret: access.Secret,
})
}
case domain.NotificationProviderTypeEmail:
{
access := domain.AccessConfigForEmail{}
@ -44,6 +60,18 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
})
}
case domain.NotificationProviderTypeLarkBot:
{
access := domain.AccessConfigForLarkBot{}
if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
}
return pLark.NewNotifier(&pLark.NotifierConfig{
WebhookUrl: access.WebhookUrl,
})
}
case domain.NotificationProviderTypeMattermost:
{
access := domain.AccessConfigForMattermost{}
@ -107,6 +135,18 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
AllowInsecureConnections: access.AllowInsecureConnections,
})
}
case domain.NotificationProviderTypeWeComBot:
{
access := domain.AccessConfigForWeComBot{}
if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
}
return pWeCom.NewNotifier(&pWeCom.NotifierConfig{
WebhookUrl: access.WebhookUrl,
})
}
}
return nil, fmt.Errorf("unsupported notifier provider '%s'", options.Provider)

View File

@ -35,8 +35,8 @@ func createNotifierProviderUseGlobalSettings(channel domain.NotifyChannelType, c
case domain.NotifyChannelTypeDingTalk:
return pDingTalk.NewNotifier(&pDingTalk.NotifierConfig{
AccessToken: maputil.GetString(channelConfig, "accessToken"),
Secret: maputil.GetString(channelConfig, "secret"),
WebhookUrl: "https://oapi.dingtalk.com/robot/send?access_token=" + maputil.GetString(channelConfig, "accessToken"),
Secret: maputil.GetString(channelConfig, "secret"),
})
case domain.NotifyChannelTypeEmail:

View File

@ -2,7 +2,9 @@ package dingtalk
import (
"context"
"fmt"
"log/slog"
"net/url"
"github.com/nikoksr/notify/service/dingding"
@ -10,8 +12,8 @@ import (
)
type NotifierConfig struct {
// 钉钉机器人的 Token
AccessToken string `json:"accessToken"`
// 钉钉机器人的 Webhook 地址
WebhookUrl string `json:"webhookUrl"`
// 钉钉机器人的 Secret。
Secret string `json:"secret"`
}
@ -44,8 +46,13 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
}
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
webhookUrl, err := url.Parse(n.config.WebhookUrl)
if err != nil {
return nil, fmt.Errorf("invalid webhook url: %w", err)
}
srv := dingding.New(&dingding.Config{
Token: n.config.AccessToken,
Token: webhookUrl.Query().Get("access_token"),
Secret: n.config.Secret,
})

View File

@ -0,0 +1 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512.003 79C272.855 79 79 272.855 79 512.003 79 751.145 272.855 945 512.003 945 751.145 945 945 751.145 945 512.003 945 272.855 751.145 79 512.003 79z m200.075 375.014c-0.867 3.764-3.117 9.347-6.234 16.012h0.087l-0.347 0.648c-18.183 38.86-65.631 115.108-65.631 115.108l-0.215-0.52-13.856 24.147h66.8L565.063 779l29.002-115.368h-52.598l18.27-76.29c-14.76 3.55-32.253 8.436-52.945 15.1 0 0-27.967 16.36-80.607-31.5 0 0-35.501-31.29-14.891-39.078 8.744-3.33 42.466-7.573 69.004-11.122 35.93-4.845 57.965-7.441 57.965-7.441s-110.607 1.643-136.841-2.468c-26.237-4.11-59.525-47.905-66.626-86.377 0 0-10.953-21.117 23.595-11.122 34.547 10 177.535 38.95 177.535 38.95s-185.933-56.992-198.36-70.929c-12.381-13.846-36.406-75.902-33.289-113.981 0 0 1.343-9.521 11.127-6.926 0 0 137.49 62.75 231.475 97.152 94.028 34.403 175.76 51.885 165.2 96.414z" fill="#3AA2EB"></path></svg>

After

Width:  |  Height:  |  Size: 1022 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M803.6 859.2c0 26.6-20.4 49.2-48.4 51.8-21.2 2-48.6-11-54.8-39.8-5.6-26-13.2-50.8-29-72.4-6-8.2-12.8-16-20-23.4-7.6-8-9.4-14-4.4-19.8 5-5.8 12.8-5 20.8 3.2 20.8 21 45.4 35.2 73.6 43.6 7.2 2.2 14.8 3.4 22.2 5.2 24.6 6.2 40 26.2 40 51.6z" fill="#FC6401"></path><path d="M698.2 549.8c0.2-28.4 20.8-50.2 49.6-52.6 25.6-2.2 50.6 17.6 55 45.2 6 36.2 22.8 66.2 48.4 92 3.2 3.2 5.6 9.2 5.2 13.8-0.4 7.2-9.8 10.6-16.2 6.4-3.4-2.2-6.2-5-9-7.8-25.4-24.6-55.6-39.4-90.4-45.4-24.8-4.6-42.6-26.2-42.6-51.6z" fill="#2DBD00"></path><path d="M595.4 765.2c-26.6 0-49.2-20.4-51.8-48.4-2-21.2 11-48.6 39.8-54.8 26-5.6 50.8-13.2 72.4-29 8.2-6 16-12.8 23.4-20 8-7.6 14-9.4 19.8-4.4 5.8 5 5 12.8-3.2 20.8-21 20.8-35.2 45.4-43.6 73.6-2.2 7.2-3.4 14.8-5.2 22.2-6.2 24.6-26.2 40-51.6 40z" fill="#FFCD00"></path><path d="M898.8 650c28.4 0.2 50.2 20.8 52.6 49.6 2.2 25.6-17.6 50.6-45.2 55-36.2 6-66.2 22.8-92 48.4-3.2 3.2-9.2 5.6-13.8 5.2-7.2-0.4-10.6-9.8-6.4-16.2 2.2-3.4 5-6.2 7.8-9 24.6-25.4 39.4-55.6 45.4-90.4 4.6-25 26.2-42.8 51.6-42.6z" fill="#0084F0"></path><path d="M734 208.6c-110.4-108.4-244.8-139.8-392.4-100C81.6 178.8 1.2 449.2 132.6 625.6c6.4 8.6 7.6 24.4 5.2 35.4-7 32.4-17.4 64.2-26 96.2-4.6 17.2-7.4 34.6 8 48.4 16.6 14.8 34.2 11.8 52.2 2.6 29.6-15 59.8-29.2 89-45 19-10.4 36.2-10.8 57.6-4.8 42.8 11.8 87.2 18.4 109.6 23 43.8-0.8 83.6-5.2 120.2-13.6-13.8-12-23-29.2-24.8-49-0.4-5.4-0.2-10.8 0.6-16.2-57.8 12.4-119.2 7.4-183.2-14-42.2-14.2-76.8-17.8-113.4 7-3.4 2.2-7.8 2.8-24.6 8.2 33.8-58.4 8.8-95-19.6-136.6-63.4-92-50.4-210.8 24.6-296.4 122.8-139.8 363-139.8 485.8 0.2 52.8 60.2 73.6 135.2 61.8 206.2 28 1.6 52.8 20.6 63 47.2 32-108.8 4-228.8-84.6-315.8z" fill="#0083EF"></path></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -25,6 +25,7 @@ import AccessFormCloudflareConfig from "./AccessFormCloudflareConfig";
import AccessFormClouDNSConfig from "./AccessFormClouDNSConfig";
import AccessFormCMCCCloudConfig from "./AccessFormCMCCCloudConfig";
import AccessFormDeSECConfig from "./AccessFormDeSECConfig";
import AccessFormDingTalkBotConfig from "./AccessFormDingTalkBotConfig";
import AccessFormDNSLAConfig from "./AccessFormDNSLAConfig";
import AccessFormDogeCloudConfig from "./AccessFormDogeCloudConfig";
import AccessFormDynv6Config from "./AccessFormDynv6Config";
@ -37,6 +38,7 @@ import AccessFormGoogleTrustServicesConfig from "./AccessFormGoogleTrustServices
import AccessFormHuaweiCloudConfig from "./AccessFormHuaweiCloudConfig";
import AccessFormJDCloudConfig from "./AccessFormJDCloudConfig";
import AccessFormKubernetesConfig from "./AccessFormKubernetesConfig";
import AccessFormLarkBotConfig from "./AccessFormLarkBotConfig";
import AccessFormMattermostConfig from "./AccessFormMattermostConfig";
import AccessFormNamecheapConfig from "./AccessFormNamecheapConfig";
import AccessFormNameDotComConfig from "./AccessFormNameDotComConfig";
@ -57,6 +59,7 @@ import AccessFormVercelConfig from "./AccessFormVercelConfig";
import AccessFormVolcEngineConfig from "./AccessFormVolcEngineConfig";
import AccessFormWangsuConfig from "./AccessFormWangsuConfig";
import AccessFormWebhookConfig from "./AccessFormWebhookConfig";
import AccessFormWeComBotConfig from "./AccessFormWeComBotConfig";
import AccessFormWestcnConfig from "./AccessFormWestcnConfig";
import AccessFormZeroSSLConfig from "./AccessFormZeroSSLConfig";
@ -183,6 +186,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
return <AccessFormCMCCCloudConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.DESEC:
return <AccessFormDeSECConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.DINGTALKBOT:
return <AccessFormDingTalkBotConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.DNSLA:
return <AccessFormDNSLAConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.DOGECLOUD:
@ -207,6 +212,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
return <AccessFormJDCloudConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.KUBERNETES:
return <AccessFormKubernetesConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.LARKBOT:
return <AccessFormLarkBotConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.MATTERMOST:
return <AccessFormMattermostConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.NAMECHEAP:
@ -252,6 +259,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
{...nestedFormProps}
/>
);
case ACCESS_PROVIDERS.WECOMBOT:
return <AccessFormWeComBotConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.WESTCN:
return <AccessFormWestcnConfig {...nestedFormProps} />;
case ACCESS_PROVIDERS.ZEROSSL:

View File

@ -0,0 +1,68 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { type AccessConfigForDingTalkBot } from "@/domain/access";
type AccessFormDingTalkBotConfigFieldValues = Nullish<AccessConfigForDingTalkBot>;
export type AccessFormDingTalkBotConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: AccessFormDingTalkBotConfigFieldValues;
onValuesChange?: (values: AccessFormDingTalkBotConfigFieldValues) => void;
};
const initFormModel = (): AccessFormDingTalkBotConfigFieldValues => {
return {
webhookUrl: "",
secret: "",
};
};
const AccessFormDingTalkBotConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormDingTalkBotConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
webhookUrl: z.string().url(t("common.errmsg.url_invalid")),
secret: z.string().nonempty(t("access.form.dingtalkbot_secret.placeholder")).trim(),
});
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="webhookUrl"
label={t("access.form.dingtalkbot_webhook_url.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.dingtalkbot_webhook_url.tooltip") }}></span>}
>
<Input placeholder={t("access.form.dingtalkbot_webhook_url.placeholder")} />
</Form.Item>
<Form.Item
name="secret"
label={t("access.form.dingtalkbot_secret.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.dingtalkbot_secret.tooltip") }}></span>}
>
<Input.Password autoComplete="new-password" placeholder={t("access.form.dingtalkbot_secret.placeholder")} />
</Form.Item>
</Form>
);
};
export default AccessFormDingTalkBotConfig;

View File

@ -0,0 +1,57 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { type AccessConfigForLarkBot } from "@/domain/access";
type AccessFormLarkBotConfigFieldValues = Nullish<AccessConfigForLarkBot>;
export type AccessFormLarkBotConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: AccessFormLarkBotConfigFieldValues;
onValuesChange?: (values: AccessFormLarkBotConfigFieldValues) => void;
};
const initFormModel = (): AccessFormLarkBotConfigFieldValues => {
return {
webhookUrl: "",
};
};
const AccessFormLarkBotConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormLarkBotConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
webhookUrl: z.string().url(t("common.errmsg.url_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="webhookUrl"
label={t("access.form.larkbot_webhook_url.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.larkbot_webhook_url.tooltip") }}></span>}
>
<Input placeholder={t("access.form.larkbot_webhook_url.placeholder")} />
</Form.Item>
</Form>
);
};
export default AccessFormLarkBotConfig;

View File

@ -0,0 +1,57 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { type AccessConfigForWeComBot } from "@/domain/access";
type AccessFormWeComBotConfigFieldValues = Nullish<AccessConfigForWeComBot>;
export type AccessFormWeComBotConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: AccessFormWeComBotConfigFieldValues;
onValuesChange?: (values: AccessFormWeComBotConfigFieldValues) => void;
};
const initFormModel = (): AccessFormWeComBotConfigFieldValues => {
return {
webhookUrl: "",
};
};
const AccessFormWeComBotConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormWeComBotConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
webhookUrl: z.string().url(t("common.errmsg.url_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="webhookUrl"
label={t("access.form.wecombot_webhook_url.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.wecombot_webhook_url.tooltip") }}></span>}
>
<Input placeholder={t("access.form.wecombot_webhook_url.placeholder")} />
</Form.Item>
</Form>
);
};
export default AccessFormWeComBotConfig;

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;

View File

@ -145,6 +145,12 @@
"access.form.desec_token.label": "deSEC token",
"access.form.desec_token.placeholder": "Please enter deSEC token",
"access.form.desec_token.tooltip": "For more information, see <a href=\"https://desec.readthedocs.io/en/latest/auth/tokens.html#manage-tokens\" target=\"_blank\">https://desec.readthedocs.io/en/latest/auth/tokens.html</a>",
"access.form.dingtalkbot_webhook_url.label": "DingTalk bot Webhook URL",
"access.form.dingtalkbot_webhook_url.placeholder": "Please enter DingTalk bot Webhook URL",
"access.form.dingtalkbot_webhook_url.tooltip": "For more information, see <a href=\"https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot\" target=\"_blank\">https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot</a>",
"access.form.dingtalkbot_secret.label": "DingTalk bot secret",
"access.form.dingtalkbot_secret.placeholder": "Please enter DingTalk bot secret",
"access.form.dingtalkbot_secret.tooltip": "For more information, see <a href=\"https://open.dingtalk.com/document/orgapp/customize-robot-security-settings\" target=\"_blank\">https://open.dingtalk.com/document/orgapp/customize-robot-security-settings</a>",
"access.form.dnsla_api_id.label": "DNS.LA API ID",
"access.form.dnsla_api_id.placeholder": "Please enter DNS.LA API ID",
"access.form.dnsla_api_id.tooltip": "For more information, see <a href=\"https://www.dns.la/docs/ApiDoc\" target=\"_blank\">https://www.dns.la/docs/ApiDoc</a>",
@ -216,6 +222,9 @@
"access.form.k8s_kubeconfig.placeholder": "Please enter KubeConfig file",
"access.form.k8s_kubeconfig.upload": "Choose File ...",
"access.form.k8s_kubeconfig.tooltip": "For more information, see <a href=\"https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/\" target=\"_blank\">https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/</a><br><br>Leave it blank to use the Pod's ServiceAccount.",
"access.form.larkbot_webhook_url.label": "Lark bot Webhook URL",
"access.form.larkbot_webhook_url.placeholder": "Please enter Lark bot Webhook URL",
"access.form.larkbot_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>",
"access.form.mattermost_server_url.label": "Mattermost server URL",
"access.form.mattermost_server_url.placeholder": "Please enter Mattermost server URL",
"access.form.mattermost_username.label": "Mattermost username",
@ -364,6 +373,9 @@
"access.form.webhook_allow_insecure_conns.tooltip": "Allowing insecure connections may lead to data leak or tampering. Use this option only when under trusted networks.",
"access.form.webhook_allow_insecure_conns.switch.on": "Allow",
"access.form.webhook_allow_insecure_conns.switch.off": "Disallow",
"access.form.wecombot_webhook_url.label": "WeCom bot Webhook URL",
"access.form.wecombot_webhook_url.placeholder": "Please enter WeCom bot Webhook URL",
"access.form.wecombot_webhook_url.tooltip": "For more information, see <a href=\"https://open.work.weixin.qq.com/help2/pc/18401#%E5%85%AD%E3%80%81%E7%BE%A4%E6%9C%BA%E5%99%A8%E4%BA%BAWebhook%E5%9C%B0%E5%9D%80\" target=\"_blank\">https://open.work.weixin.qq.com/help2/pc/18401</a>",
"access.form.westcn_username.label": "West.cn username",
"access.form.westcn_username.placeholder": "Please enter West.cn username",
"access.form.westcn_username.tooltip": "For more information, see <a href=\"https://www.west.cn/CustomerCenter/doc/apiv2.html#12u3001u8eabu4efdu9a8cu8bc10a3ca20id3d12u3001u8eabu4efdu9a8cu8bc13e203ca3e\" target=\"_blank\">https://www.west.cn/CustomerCenter/doc/apiv2.html</a>",

View File

@ -52,6 +52,7 @@
"provider.ctcccloud": "China Telecom Cloud (State Cloud)",
"provider.cucccloud": "China Unicom Cloud",
"provider.desec": "deSEC",
"provider.dingtalkbot": "DingTalk Bot",
"provider.dnsla": "DNS.LA",
"provider.dogecloud": "Doge Cloud",
"provider.dogecloud.cdn": "Doge Cloud - CDN (Content Delivery Network)",
@ -81,6 +82,7 @@
"provider.jdcloud.vod": "JD Cloud - VOD (Video on Demand)",
"provider.kubernetes": "Kubernetes",
"provider.kubernetes.secret": "Kubernetes - Secret",
"provider.larkbot": "Lark Bot",
"provider.letsencrypt": "Let's Encrypt",
"provider.letsencryptstaging": "Let's Encrypt Staging Environment",
"provider.local": "Local deployment",
@ -134,6 +136,7 @@
"provider.wangsu": "Wangsu Cloud",
"provider.wangsu.cdnpro": "Wangsu Cloud - CDN Pro",
"provider.webhook": "Webhook",
"provider.wecombot": "WeCom Bot",
"provider.westcn": "West.cn",
"provider.zerossl": "ZeroSSL",

View File

@ -139,6 +139,12 @@
"access.form.desec_token.label": "deSEC Token",
"access.form.desec_token.placeholder": "请输入 deSEC Token",
"access.form.desec_token.tooltip": "这是什么?请参阅 <a href=\"https://desec.readthedocs.io/en/latest/auth/tokens.html#manage-tokens\" target=\"_blank\">https://desec.readthedocs.io/en/latest/auth/tokens.html</a>",
"access.form.dingtalkbot_webhook_url.label": "钉钉群机器人 Webhook 地址",
"access.form.dingtalkbot_webhook_url.placeholder": "请输入钉钉群机器人 Webhook 地址",
"access.form.dingtalkbot_webhook_url.tooltip": "这是什么?请参阅 <a href=\"https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot\" target=\"_blank\">https://open.dingtalk.com/document/orgapp/obtain-the-webhook-address-of-a-custom-robot</a>",
"access.form.dingtalkbot_secret.label": "钉钉群机器人加签密钥",
"access.form.dingtalkbot_secret.placeholder": "请输入钉钉群机器人加签密钥",
"access.form.dingtalkbot_secret.tooltip": "这是什么?请参阅 <a href=\"https://open.dingtalk.com/document/orgapp/customize-robot-security-settings\" target=\"_blank\">https://open.dingtalk.com/document/orgapp/customize-robot-security-settings</a>",
"access.form.dnsla_api_id.label": "DNS.LA API ID",
"access.form.dnsla_api_id.placeholder": "请输入 DNS.LA API ID",
"access.form.dnsla_api_id.tooltip": "这是什么?请参阅 <a href=\"https://www.dns.la/docs/ApiDoc\" target=\"_blank\">https://www.dns.la/docs/ApiDoc</a>",
@ -210,6 +216,9 @@
"access.form.k8s_kubeconfig.placeholder": "请选择 KubeConfig 文件",
"access.form.k8s_kubeconfig.upload": "选择文件",
"access.form.k8s_kubeconfig.tooltip": "这是什么?请参阅 <a href=\"https://kubernetes.io/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/\" target=\"_blank\">https://kubernetes.io/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/</a><br><br>为空时,将使用 Pod 的 ServiceAccount 作为凭证。",
"access.form.larkbot_webhook_url.label": "飞书群机器人 Webhook 地址",
"access.form.larkbot_webhook_url.placeholder": "请输入飞书群机器人 Webhook 地址",
"access.form.larkbot_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>",
"access.form.mattermost_server_url.label": "Mattermost 服务地址",
"access.form.mattermost_server_url.placeholder": "请输入 Mattermost 服务地址",
"access.form.mattermost_username.label": "Mattermost 用户名",
@ -364,6 +373,9 @@
"access.form.webhook_allow_insecure_conns.tooltip": "忽略 SSL/TLS 证书错误可能导致数据泄露或被篡改。建议仅在可信网络下启用。",
"access.form.webhook_allow_insecure_conns.switch.on": "允许",
"access.form.webhook_allow_insecure_conns.switch.off": "不允许",
"access.form.wecombot_webhook_url.label": "企业微信群机器人 Webhook 地址",
"access.form.wecombot_webhook_url.placeholder": "请输入企业微信群机器人 Webhook 地址",
"access.form.wecombot_webhook_url.tooltip": "这是什么?请参阅 <a href=\"https://open.work.weixin.qq.com/help2/pc/18401#%E5%85%AD%E3%80%81%E7%BE%A4%E6%9C%BA%E5%99%A8%E4%BA%BAWebhook%E5%9C%B0%E5%9D%80\" target=\"_blank\">https://open.work.weixin.qq.com/help2/pc/18401</a>",
"access.form.westcn_username.label": "西部数码用户名",
"access.form.westcn_username.placeholder": "请输入西部数码用户名",
"access.form.westcn_username.tooltip": "这是什么?请参阅 <a href=\"https://www.west.cn/CustomerCenter/doc/apiv2.html#12u3001u8eabu4efdu9a8cu8bc10a3ca20id3d12u3001u8eabu4efdu9a8cu8bc13e203ca3e\" target=\"_blank\">https://www.west.cn/CustomerCenter/doc/apiv2.html</a>",

View File

@ -52,6 +52,7 @@
"provider.ctcccloud": "联通云",
"provider.cucccloud": "天翼云",
"provider.desec": "deSEC",
"provider.dingtalkbot": "钉钉群机器人",
"provider.dnsla": "DNS.LA",
"provider.dogecloud": "多吉云",
"provider.dogecloud.cdn": "多吉云 - 内容分发网络 CDN",
@ -81,6 +82,7 @@
"provider.jdcloud.vod": "京东云 - 视频点播",
"provider.kubernetes": "Kubernetes",
"provider.kubernetes.secret": "Kubernetes - Secret",
"provider.larkbot": "飞书群机器人",
"provider.letsencrypt": "Let's Encrypt",
"provider.letsencryptstaging": "Let's Encrypt 测试环境",
"provider.local": "本地部署",
@ -134,6 +136,7 @@
"provider.wangsu": "网宿云",
"provider.wangsu.cdnpro": "网宿云 - CDN Pro",
"provider.webhook": "Webhook",
"provider.wecombot": "企业微信群机器人",
"provider.westcn": "西部数码",
"provider.zerossl": "ZeroSSL",