mirror of
https://github.com/4ev-link/4ev.link.git
synced 2026-01-13 16:18:05 +00:00
Feat: Add Seize action button to ntfy notifications
This commit is contained in:
@@ -6,14 +6,15 @@ const RESERVED = new Set([
|
|||||||
"settings","profile","password","user","users","link","links","url","urls",
|
"settings","profile","password","user","users","link","links","url","urls",
|
||||||
"robots","sitemap","favicon","well-known","assets","static","img","js","css","public"
|
"robots","sitemap","favicon","well-known","assets","static","img","js","css","public"
|
||||||
]);
|
]);
|
||||||
const ntfy = (env,title,msg,p=3) =>
|
const ntfy = (env,title,msg,act,p=3) =>
|
||||||
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(()=>{})
|
||||||
@@ -78,6 +79,7 @@ export async function onRequestPost({ request, env }) {
|
|||||||
env,
|
env,
|
||||||
"link-create",
|
"link-create",
|
||||||
`event=create\nuser=${username}\nslug=${finalSlug}\ndestination=${dest_no_proto}`,
|
`event=create\nuser=${username}\nslug=${finalSlug}\ndestination=${dest_no_proto}`,
|
||||||
|
`${new URL(request.url).origin}/admin?slug=${finalSlug}`,
|
||||||
3
|
3
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user