feat(ntfy): add ntfy platform adapter#30625
Conversation
… fix, and 81 tests
12f9bed to
b904c36
Compare
|
Superseded by #30867, which reshapes this adapter into a platform plugin under |
|
Merged via #30867 — your adapter, security fixes, and original test coverage are all preserved via cherry-pick with your authorship intact on commit 16cc77c. We reshaped the integration into a platform plugin under plugins/platforms/ntfy/ instead of editing the 8 core files the original PR touched (new platforms now go through gateway/platform_registry, like IRC/SimpleX/LINE/Teams). Followup commits added fatal-error propagation for 401/404, token-whitespace hygiene, shared auth/truncation helpers between adapter and standalone-send, plus full docs (messaging guide, env-var reference, sidebar entry). Thanks for the clean adapter design — the identity-spoofing fix and the 401/404 reconnect-loop halt were exactly right. |
What does this PR do?
Adds full support for ntfy as a messaging platform. ntfy is a lightweight, open-source push notification service that works with ntfy.sh or any self-hosted server.
Reopened from #4043 with all reviewer feedback addressed.
Type of Change
Changes Made
gateway/platforms/ntfy.py— platform adapter with HTTP streaming subscription, exponential backoff reconnection, message deduplication, Bearer/Basic auth supportgateway/config.py— NTFY platform enum entry and env var loading (NTFY_TOPIC, NTFY_SERVER_URL, NTFY_TOKEN, NTFY_PUBLISH_TOPIC, NTFY_MARKDOWN)gateway/run.py— adapter factory and authorization mapscron/scheduler.py— ntfy delivery in platform maptools/send_message_tool.py— ntfy routing and_send_ntfy()toolsets.py— hermes-ntfy toolset and gateway compositehermes_cli/status.py— ntfy status displayagent/prompt_builder.py— ntfy platform hintgateway/channel_directory.py— session-based channel discoverytests/gateway/test_ntfy.py— 81 unit testsReviewer Feedback Addressed (from #4043)
@TheophileDiot:
titlefield as user identity source. ntfy is now treated as a single trusted channel;user_idis always the topic name. Addedtest_unknown_publisher_cannot_impersonate_allowed_usertest.poll=truecomment topoll=false_FatalStreamErrorexception; 401/404 responses stop the reconnect loop instead of retrying every 60slogger.warning()when message exceeds 4096 char limitcheck_ntfy_requirements()now readsNTFY_TOPICenv var directly instead of callingload_gateway_config()on every pre-check@gerrydoro:
markdown: trueunderextra:in config.yaml orNTFY_MARKDOWN=trueenv var; adapter sendsX-Markdown: trueheader. Defaults to false.How to Test
Checklist
Code
Documentation & Housekeeping