From d3d94b69a9f98a0a4b68dc6ee830466471adf26d Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Mon, 1 Jun 2026 11:28:03 +0900 Subject: feat(notifications): topic-only input (drop URL validation) The Settings field is now a plain topic name (e.g. `my-secret-topic`) instead of a full URL. The transport always posts to `https://ntfy.sh/` (URL-encoded), and the only server-side check is "non-empty when enabled". Removes the user-visible "string does not match the expected pattern" error people hit when typing a bare topic. - packages/core/src/notifications/ntfy.ts: drop validateTopicUrl; add buildNtfyUrl(topic) + exported NTFY_BASE_URL. - packages/core/src/notifications/types.ts, config.ts: rename topicUrl -> topic; update docs. - packages/api/src/routes/notifications.ts: only validates non-empty topic when enabled. Also fixes a latent bug where notifySubagents was dropped on every PUT (was not passed to normalizeNtfyConfig). - packages/frontend/src/lib/components/SettingsPanel.svelte: relabel field "Topic URL" -> "Topic"; placeholder "your-secret-topic"; updated helper copy. - Tests updated: rewrote validateTopicUrl coverage as buildNtfyUrl coverage + proof that previously-rejected topics (dots, spaces, unicode, "Any Topic Whatsoever") now POST cleanly. - HANDOFF.md: added a short "topic-only input" section. --- packages/api/tests/routes.test.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'packages/api/tests') diff --git a/packages/api/tests/routes.test.ts b/packages/api/tests/routes.test.ts index 1fad690..5606754 100644 --- a/packages/api/tests/routes.test.ts +++ b/packages/api/tests/routes.test.ts @@ -282,7 +282,7 @@ vi.mock("@dispatch/core", () => ({ loadNtfyConfig() { return { enabled: false, - topicUrl: "", + topic: "", authToken: "", events: { "turn-completed": true, @@ -300,7 +300,7 @@ vi.mock("@dispatch/core", () => ({ defaultNtfyConfig() { return { enabled: false, - topicUrl: "", + topic: "", authToken: "", events: { "turn-completed": true, @@ -318,9 +318,6 @@ vi.mock("@dispatch/core", () => ({ async sendNtfy() { return { ok: true }; }, - validateTopicUrl() { - return null; - }, })); const { app } = await import("../src/app.js"); -- cgit v1.2.3