Make the app an installable PWA with phone layout and Web Push
Add a generated manifest, icon set, offline page and service worker that never caches authenticated HTML, plus install and update UI. Turn the rail into a drawer below md with container-query internals, dvh and safe-area handling, and reconnect the socket after visibility/network changes. Add Web Push subscriptions, presence-aware delivery, notification settings and tests.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* A base64url VAPID public key as the bytes `PushManager.subscribe`
|
||||
* expects.
|
||||
*/
|
||||
export default function urlBase64ToUint8Array(base64_string: string) {
|
||||
const padding = "=".repeat((4 - (base64_string.length % 4)) % 4);
|
||||
const base64 = (base64_string + padding)
|
||||
.replace(/-/g, "+")
|
||||
.replace(/_/g, "/");
|
||||
const raw = atob(base64);
|
||||
const bytes = new Uint8Array(raw.length);
|
||||
|
||||
for (let index = 0; index < raw.length; index += 1) {
|
||||
bytes[index] = raw.charCodeAt(index);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
Reference in New Issue
Block a user