Fix: ntfy update correct topic usage

This commit is contained in:
2025-11-10 13:42:51 -08:00
parent 72aeb573b2
commit 7021ee363a

View File

@@ -1,6 +1,6 @@
const ntfy = (env,topic,title,msg,p=2) => const ntfy = (env,title,msg,p=2) =>
env.NTFY_TOPIC ? env.NTFY_TOPIC
fetch(`https://ntfy.sh/${topic}`,{ ? fetch(`https://ntfy.sh/${env.NTFY_TOPIC}`,{
method:"POST", method:"POST",
headers:{ headers:{
"Title":`✏️ ${title}`, "Title":`✏️ ${title}`,
@@ -8,8 +8,8 @@ const ntfy = (env,topic,title,msg,p=2) =>
"Content-Type":"text/plain" "Content-Type":"text/plain"
}, },
body:msg body:msg
}).catch(()=>{}) : }).catch(()=>{})
Promise.resolve(); : Promise.resolve();
export async function onRequestPost({ request, env }) { export async function onRequestPost({ request, env }) {
try { try {
@@ -61,7 +61,6 @@ export async function onRequestPost({ request, env }) {
env.KV_EV.put(slug,kvValue), env.KV_EV.put(slug,kvValue),
ntfy( ntfy(
env, env,
env.NTFY_TOPIC,
`link-${evt}`, `link-${evt}`,
`event=${evt}\nuser=${username}\nslug=${slug}\ndestination=${dest_no_proto}\nanalytics_enabled=${!!analytics_enabled}`, `event=${evt}\nuser=${username}\nslug=${slug}\ndestination=${dest_no_proto}\nanalytics_enabled=${!!analytics_enabled}`,
2 2