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:
2026-10-19 17:12:16 +01:00
parent 61098a114c
commit dbfe48796b
100 changed files with 3573 additions and 117 deletions
+18
View File
@@ -9,8 +9,10 @@ import botsQueue from "./bots-queue";
import liveRelay from "./live-relay";
import enableForeignKeys from "./functions/backend/db/enable-foreign-keys";
import handleComputerProxy from "./functions/server/computers/handle-computer-proxy";
import handlePwaFile from "./functions/server/pwa/handle-pwa-file";
import { ComputerProxyPrefix } from "./dict/computer-dict";
import ensureDockerNetwork from "./functions/backend/docker/ensure-docker-network";
import { ensureVapidKeys } from "./push/vapid";
declare global {}
@@ -22,6 +24,18 @@ const port = process.env.PORT || 7227;
await enableForeignKeys();
await bunext.bunextInit();
/**
* Web Push needs a key pair; the first start of the main install creates
* it (in the Environment settings) so notifications work without setup.
*/
if (process.env.NODE_ENV != "production" || process.env.MAIN_SERVER) {
await ensureVapidKeys().catch((error) =>
logError({ title: "Could not prepare Web Push keys", error }).catch(
() => {},
),
);
}
/**
* Computers are docker containers on this network, so the app doesn't
* start without docker.
@@ -39,6 +53,10 @@ const server = Bun.serve({
try {
const url = new URL(req.url);
const pwa_file = await handlePwaFile({ pathname: url.pathname });
if (pwa_file) return pwa_file;
if (url.pathname.startsWith("/media")) {
try {
return await handleMediaServer({ req });