improve message-delivery-method-web-push, change share buttons size to text-3xl
Main daploy / deploy (push) Successful in 49s
Main daploy / deploy (push) Successful in 49s
This commit is contained in:
@@ -62,40 +62,46 @@ const start = async () => {
|
||||
|
||||
if (rows.length === 0) {
|
||||
console.log("NO SUBSCRIPTIONS");
|
||||
} else {
|
||||
console.log(`sending to ${rows.length} devices`);
|
||||
}
|
||||
|
||||
for (const row of rows) {
|
||||
const subscription = row.doc.subscription;
|
||||
const topic = `chat-${msgDoc.qr_code_uri}-${msgDoc.chat}`;
|
||||
const tag = `${topic}-${(new Date(msgDoc.created_at).getTime() - new Date(qrDoc.created_at).getTime()).toString(36)}`;
|
||||
try {
|
||||
const subscription = row.doc.subscription;
|
||||
const topic = `chat-${msgDoc.qr_code_uri}-${msgDoc.chat}`;
|
||||
const tag = `${topic}-${(new Date(msgDoc.created_at).getTime() - new Date(qrDoc.created_at).getTime()).toString(36)}`;
|
||||
|
||||
const options: NotificationOptions = {
|
||||
icon: "/images/qr-code-logo-200x200.jpg",
|
||||
body: msgDoc.body,
|
||||
tag,
|
||||
requireInteraction: true,
|
||||
data: {
|
||||
url: `/manage/${msgDoc.qr_code_uri}/chat/${msgDoc.chat}`,
|
||||
payload: { tag },
|
||||
},
|
||||
} as const;
|
||||
|
||||
await webpush.sendNotification(
|
||||
subscription,
|
||||
JSON.stringify({
|
||||
type: "notification",
|
||||
notification: {
|
||||
title: qrDoc.name,
|
||||
options,
|
||||
const options: NotificationOptions = {
|
||||
icon: "/images/qr-code-logo-200x200.jpg",
|
||||
body: msgDoc.body,
|
||||
tag,
|
||||
requireInteraction: true,
|
||||
data: {
|
||||
url: `/manage/${msgDoc.qr_code_uri}/chat/${msgDoc.chat}`,
|
||||
payload: { tag },
|
||||
},
|
||||
}),
|
||||
{
|
||||
urgency: "high",
|
||||
topic,
|
||||
},
|
||||
);
|
||||
} as const;
|
||||
|
||||
console.log("sent");
|
||||
await webpush.sendNotification(
|
||||
subscription,
|
||||
JSON.stringify({
|
||||
type: "notification",
|
||||
notification: {
|
||||
title: qrDoc.name,
|
||||
options,
|
||||
},
|
||||
}),
|
||||
{
|
||||
urgency: "high",
|
||||
topic,
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Error sending notification to ${row.id} - ${JSON.stringify(error)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (msgDoc.from === "owner") {
|
||||
console.log("FROM OWNER");
|
||||
|
||||
Reference in New Issue
Block a user