diff --git a/notify.js b/notify.js new file mode 100644 index 0000000..0c59106 --- /dev/null +++ b/notify.js @@ -0,0 +1,14 @@ +const NTFY_URL = process.env.NTFY_URL || '' + +export function notify(msg, priority = 3, tags = []) { + if (!NTFY_URL) return + fetch(NTFY_URL, { + method: 'POST', + body: msg, + headers: { + Title: 'Sune Proxy', + Priority: `${priority}`, + Tags: tags.join(','), + }, + }).catch(e => console.error('ntfy failed:', e)) +}