From 7021ee363afd63c6827986cbced3eb55fe954c52 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Mon, 10 Nov 2025 13:42:51 -0800 Subject: [PATCH] Fix: ntfy update correct topic usage --- functions/api/links/update.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/functions/api/links/update.js b/functions/api/links/update.js index 7712098..9e8437d 100644 --- a/functions/api/links/update.js +++ b/functions/api/links/update.js @@ -1,15 +1,15 @@ -const ntfy = (env,topic,title,msg,p=2) => - env.NTFY_TOPIC ? - fetch(`https://ntfy.sh/${topic}`,{ - method:"POST", - headers:{ - "Title":`✏️ ${title}`, - "Priority":String(p), - "Content-Type":"text/plain" - }, - body:msg - }).catch(()=>{}) : - Promise.resolve(); +const ntfy = (env,title,msg,p=2) => + env.NTFY_TOPIC + ? fetch(`https://ntfy.sh/${env.NTFY_TOPIC}`,{ + method:"POST", + headers:{ + "Title":`✏️ ${title}`, + "Priority":String(p), + "Content-Type":"text/plain" + }, + body:msg + }).catch(()=>{}) + : Promise.resolve(); export async function onRequestPost({ request, env }) { try { @@ -61,7 +61,6 @@ export async function onRequestPost({ request, env }) { env.KV_EV.put(slug,kvValue), ntfy( env, - env.NTFY_TOPIC, `link-${evt}`, `event=${evt}\nuser=${username}\nslug=${slug}\ndestination=${dest_no_proto}\nanalytics_enabled=${!!analytics_enabled}`, 2