From d9ec7c362caf22c053b6ca66bf494cf5b7be23a2 Mon Sep 17 00:00:00 2001 From: Bot Date: Thu, 16 Apr 2026 21:36:55 +0800 Subject: [PATCH] feat: add billing UI, SMTP support and expiry settings --- src/components/notifier.tsx | 155 +++++++++++++++++------------ src/components/server.tsx | 34 +++++++ src/locales/en/translation.json | 2 + src/locales/zh-CN/translation.json | 4 +- src/routes/settings.tsx | 26 +++++ src/types/api.ts | 17 ++++ 6 files changed, 175 insertions(+), 63 deletions(-) diff --git a/src/components/notifier.tsx b/src/components/notifier.tsx index d892209..6004262 100644 --- a/src/components/notifier.tsx +++ b/src/components/notifier.tsx @@ -58,6 +58,7 @@ const notificationFormSchema = z.object({ verify_tls: asOptionalField(z.boolean()), skip_check: asOptionalField(z.boolean()), format_metric_units: asOptionalField(z.boolean()), + type: z.coerce.number().int().default(1), }) export const NotifierCard: React.FC = ({ data, mutate }) => { @@ -77,6 +78,7 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { verify_tls: (data as any).verify_tls ?? false, skip_check: (data as any).skip_check ?? false, format_metric_units: (data as any).format_metric_units ?? false, + type: data.type ?? 1, } : { name: "", @@ -88,6 +90,7 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { verify_tls: false, skip_check: false, format_metric_units: false, + type: 1, }, resetOptions: { keepDefaultValues: false, @@ -143,12 +146,36 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { )} /> + ( + + Notification Type + + + + )} + /> ( - URL + {form.watch("type") == 2 ? "SMTP Server (host:port)" : "URL"} @@ -156,72 +183,76 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { )} /> - ( - - {t("RequestMethod")} - - - - )} - /> - ( - - {t("Type")} - - - - )} - /> + {form.watch("type") != 2 && ( + <> + ( + + {t("RequestMethod")} + + + + )} + /> + ( + + {t("Type")} + + + + )} + /> + + )} ( - {t("RequestHeader")} + {form.watch("type") == 2 ? "SMTP User:Pass" : t("RequestHeader")}