improve message-delivery-method-web-push, change share buttons size to text-3xl
Main daploy / deploy (push) Successful in 49s

This commit is contained in:
2024-11-29 00:23:48 +02:00
parent 8c0e0ccc96
commit a393a195d0
2 changed files with 37 additions and 31 deletions
+3 -3
View File
@@ -22,7 +22,7 @@
<div class="mb-8">
<h2 class="text-xl font-semibold mb-4">Рассказать друзьям</h2>
<p class="text-gray-600 mb-4">Поделитесь ссылкой на НаСвязи:</p>
<div class="flex justify-center gap-4">
<div class="flex justify-center gap-6">
<!-- Telegram -->
<a
:href="telegramShareUrl"
@@ -30,7 +30,7 @@
rel="noopener noreferrer"
class="p-button-rounded p-button-text p-button-lg inline-flex items-center justify-center"
>
<i class="pi pi-telegram text-xl text-blue-500"></i>
<i class="pi pi-telegram !text-3xl text-blue-500"></i>
</a>
<!-- WhatsApp -->
@@ -40,7 +40,7 @@
rel="noopener noreferrer"
class="p-button-rounded p-button-text p-button-lg inline-flex items-center justify-center"
>
<i class="pi pi-whatsapp text-xl text-green-500"></i>
<i class="pi pi-whatsapp !text-3xl text-green-500"></i>
</a>
</div>
</div>
@@ -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");