diff --git a/functions/api/links/create.js b/functions/api/links/create.js index 3d62b1a..247435f 100644 --- a/functions/api/links/create.js +++ b/functions/api/links/create.js @@ -6,18 +6,18 @@ const RESERVED = new Set([ "settings","profile","password","user","users","link","links","url","urls", "robots","sitemap","favicon","well-known","assets","static","img","js","css","public" ]); -const ntfy = (env,topic,title,msg,p=3) => - 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=3) => + 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 { @@ -76,7 +76,6 @@ export async function onRequestPost({ request, env }) { .run(), ntfy( env, - env.NTFY_TOPIC, "link-create", `event=create\nuser=${username}\nslug=${finalSlug}\ndestination=${dest_no_proto}`, 3