From 06b2773a0079c978b4b6193fc2705f7aaa66733a Mon Sep 17 00:00:00 2001 From: Sam Rolfe Date: Fri, 31 Jul 2026 14:53:17 +1000 Subject: [PATCH] dashboard.ts: add local notify-send popups (desktop notifications) alongside NTFY/Apprise --- extensions/dashboard.ts | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/extensions/dashboard.ts b/extensions/dashboard.ts index 3327b81..14db828 100644 --- a/extensions/dashboard.ts +++ b/extensions/dashboard.ts @@ -211,6 +211,19 @@ export default function (pi: ExtensionAPI) { } function notify(title: string, body: string) { + // Desktop notification (local machine popup) + try { + const child = spawn( + "notify-send", + ["-a", "Pi Dashboard", title, body], + { stdio: "ignore", timeout: 3000 } + ); + child.on("error", () => {}); + child.unref(); + } catch { + // notify-send unavailable (e.g. headless server) + } + // NTFY notification const ntfyTopic = process.env.PI_NTFY_TOPIC; if (ntfyTopic) { @@ -236,16 +249,31 @@ export default function (pi: ExtensionAPI) { } } - // Apprise notification + // Apprise notification (HTTP API on .35 — fans out to Telegram/ntfy/email/callmebot) + const appriseApi = + process.env.APPRISE_API_URL || + "http://192.168.20.35:8210/notify/eaef201fc995964c8a4013892563ae79879df4ecddbabdc4f4af1e549d3366e1"; try { - const child = spawn("apprise", ["-b", `${title}: ${body}`], { - stdio: "ignore", - timeout: 3000, - }); + const child = spawn( + "curl", + [ + "-s", + "-o", + "/dev/null", + "-X", + "POST", + "-H", + "Content-Type: application/json", + "-d", + JSON.stringify({ title, body }), + appriseApi, + ], + { stdio: "ignore", timeout: 5000 } + ); child.on("error", () => {}); child.unref(); } catch { - // Apprise not installed + // Apprise unavailable } }