add generate-keys
Main daploy / deploy (push) Successful in 41s

This commit is contained in:
2024-11-24 13:02:27 +02:00
parent c724ab1028
commit 2cd8bf62a9
2 changed files with 30 additions and 10 deletions
@@ -37,16 +37,27 @@ const notification = {
const { rows } = await new PouchDB(
`${process.env.API_URL}/web_push_subscriptions`,
{ skip_setup: true },
).allDocs({
startkey: "web_push_subscription:",
endkey: "web_push_subscription:\uFFFF",
include_docs: true,
});
).allDocs(
process.env.WEB_PUSH_SUBSCRIPTION_ID
? {
key: process.env.WEB_PUSH_SUBSCRIPTION_ID,
include_docs: true,
}
: {
startkey: "web_push_subscription:",
endkey: "web_push_subscription:\uFFFF",
include_docs: true,
},
);
await Promise.allSettled(
rows.map(({ doc }) =>
webpush.sendNotification(doc.subscription, JSON.stringify(notification)),
),
rows.map(async ({ doc }) => {
await webpush.sendNotification(
doc.subscription,
JSON.stringify(notification),
);
console.log("sent ", doc._id);
}),
);
// issues: