From b11140197e186d2db62cc15045af545667dd1f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Z=C3=ADpek?= Date: Sat, 11 Apr 2026 20:22:18 +0200 Subject: [PATCH] NTFY integration (#2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://forgejo.cerno.ch/kamen/graphicek/pulls/2 Co-authored-by: Jan Zípek Co-committed-by: Jan Zípek --- .../components/ContactPointFormModal.tsx | 34 ++++ .../src/utils/tryParseContactPointConfig.ts | 18 +- server/integrations/ntfy.go | 158 ++++++++++++++++++ server/routes/contact_points.go | 4 +- server/services/contact_points_service.go | 12 ++ server/services/services.go | 2 + 6 files changed, 225 insertions(+), 3 deletions(-) create mode 100644 server/integrations/ntfy.go diff --git a/client/src/pages/alerts/components/ContactPointsTable/components/ContactPointFormModal.tsx b/client/src/pages/alerts/components/ContactPointsTable/components/ContactPointFormModal.tsx index 11eff34..da95203 100644 --- a/client/src/pages/alerts/components/ContactPointsTable/components/ContactPointFormModal.tsx +++ b/client/src/pages/alerts/components/ContactPointsTable/components/ContactPointFormModal.tsx @@ -20,6 +20,8 @@ type FormValues = { type: string telegramApiKey?: string telegramTargetChannel?: number + ntfyEndpoint?: string + ntfyAuthToken?: string } export const ContactPointFormModal = ({ @@ -45,6 +47,13 @@ export const ContactPointFormModal = ({ } } + if (v.type === 'ntfy') { + return { + endpoint: v.ntfyEndpoint, + authToken: v.ntfyAuthToken, + } + } + return {} } @@ -56,6 +65,10 @@ export const ContactPointFormModal = ({ telegramApiKey: parsedTypeConfig.apiKey ?? '', telegramTargetChannel: parsedTypeConfig.targetChannel, }), + ...(parsedTypeConfig?.type === 'ntfy' && { + ntfyEndpoint: parsedTypeConfig.endpoint ?? '', + ntfyAuthToken: parsedTypeConfig.authToken ?? '', + }), }), onSubmit: async (v) => { if (isLoading) { @@ -105,6 +118,7 @@ export const ContactPointFormModal = ({ @@ -132,6 +146,26 @@ export const ContactPointFormModal = ({ )} + {type === 'ntfy' && ( + <> +
+ + +
+ +
+ + +
+ + )} +