mirror of
https://github.com/4ev-link/4ev.link.git
synced 2026-01-14 08:38:39 +00:00
Feat: Add Seize action button to ntfy on update
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
const ntfy = (env,title,msg,p=2) =>
|
const ntfy = (env,title,msg,act,p=2) =>
|
||||||
env.NTFY_TOPIC
|
env.NTFY_TOPIC
|
||||||
? fetch(`https://ntfy.sh/${env.NTFY_TOPIC}`,{
|
? fetch(`https://ntfy.sh/${env.NTFY_TOPIC}`,{
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{
|
headers:{
|
||||||
"Title":`✏️ ${title}`,
|
"Title":`✏️ ${title}`,
|
||||||
"Priority":String(p),
|
"Priority":String(p),
|
||||||
"Content-Type":"text/plain"
|
"Content-Type":"text/plain",
|
||||||
|
...(act?{"Actions":`view, Seize, ${act}`}:{})
|
||||||
},
|
},
|
||||||
body:msg
|
body:msg
|
||||||
}).catch(()=>{})
|
}).catch(()=>{})
|
||||||
@@ -68,6 +69,7 @@ export async function onRequestPost({ request, env }) {
|
|||||||
env,
|
env,
|
||||||
`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}`,
|
||||||
|
`${new URL(request.url).origin}/admin?slug=${slug}`,
|
||||||
2
|
2
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
@@ -77,4 +79,3 @@ export async function onRequestPost({ request, env }) {
|
|||||||
return new Response(e.message,{ status:500 });
|
return new Response(e.message,{ status:500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user