From 3046e413cd77b90694d16f84577479af08706aee Mon Sep 17 00:00:00 2001 From: Bawbby Date: Mon, 30 Aug 2021 17:11:04 -0400 Subject: [PATCH 1/2] Clean up invalid invite page. - Make it look like a valid invite page. - Add arrow to go back to home. --- src/pages/invite/Invite.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/pages/invite/Invite.tsx b/src/pages/invite/Invite.tsx index fb4abb9d..63380d9a 100644 --- a/src/pages/invite/Invite.tsx +++ b/src/pages/invite/Invite.tsx @@ -54,7 +54,29 @@ export default function Invite() {
{error ? ( - +
+
+

Invalid invite!

+

+ The invite may not exist or you don't have + permission to join. +

+
+ +
+
+
) : ( )} From 591df837d5c5d818154e43d3dfaea80d2b21f258 Mon Sep 17 00:00:00 2001 From: Yannick Funk Date: Thu, 2 Sep 2021 23:24:22 +0200 Subject: [PATCH 2/2] Parse push notification packet of client --- src/sw.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/sw.ts b/src/sw.ts index f4810629..b513f47e 100644 --- a/src/sw.ts +++ b/src/sw.ts @@ -11,10 +11,19 @@ precacheAndRoute(self.__WB_MANIFEST); self.addEventListener("push", (event) => { async function process() { - if (event.data === null) return; - // Need to write notification generator on server. - } + if (event.data) { + const data = event.data.json(); + await self.registration.showNotification(data.author, { + icon: data.icon, + image: data.image, + body: data.body, + timestamp: data.timestamp, + tag: data.tag, + badge: "https://app.revolt.chat/assets/icons/android-chrome-512x512.png" + }); + } + } event.waitUntil(process()); });