mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-22 10:02:17 -05:00
The legacy client got its manifest and icons from vite-plugin-pwa. client_v2 has no such plugin, and nothing replaced them: static/ held only favicon.svg, spoolman.svg and the Ko-fi logo. So the upgrade silently un-installs the app for everyone who had added Spoolman to a home screen -- no manifest means no standalone display mode, no home-screen icon, and no install prompt ever offered again. The manifest and icons are plain files in static/ rather than plugin output. The icons are the v1 set, unchanged, so an already-installed app keeps the icon it had; name, colors and display mode are v1's too, and start_url resolves to the same URL at a root deploy, which keeps the app identity stable across the upgrade instead of orphaning the old install. Every URL inside the manifest is relative to the manifest itself, so the one file is correct under any SPOOLMAN_BASE_PATH with no rebuild. Only the document's link to it needs help: the prerendered pages emit "./manifest.webmanifest" and resolve fine, but the SPA fallback (200.html, which serves deep routes like the /spool/show/<id> a printed QR points at) carries absolute paths, so the existing base-path fixup gains two patterns for the manifest and the touch icon. Also register the .webmanifest media type. StaticFiles takes Content-Type from the stdlib mimetypes registry, whose built-in table only learned this extension in recent Pythons and otherwise falls back to the host's /etc/mime.types -- absent in slim images. We support 3.10+, so leaving it to the environment means some installs serve the manifest as text/plain. Claude-Session: https://claude.ai/code/session_01UB5KocsTBm9GL5x3Uuup5F
59 lines
2.2 KiB
HTML
59 lines
2.2 KiB
HTML
<!doctype html>
|
|
|
|
<html lang="en" data-theme="dark" dir="ltr">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
|
|
<link rel="apple-touch-icon" href="%sveltekit.assets%/apple-touch-icon-180x180.png" />
|
|
|
|
<!-- Installability. The manifest sits at the deploy root and states start_url,
|
|
scope and its icon sources relative to itself, so an operator running under
|
|
SPOOLMAN_BASE_PATH gets a correctly scoped app without a build-time rebuild.
|
|
%sveltekit.assets% is relative on the prerendered documents; on the SPA
|
|
fallback (200.html) it is absolute and gets rewritten server-side — see
|
|
load_and_rewrite_fallback_base_path in spoolman/client.py. -->
|
|
<link rel="manifest" href="%sveltekit.assets%/manifest.webmanifest" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
|
|
<meta name="theme-color" content="#1f1f1f" />
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
<title>Spoolman</title>
|
|
|
|
<!-- Resolve the saved color theme before first paint to avoid a flash of the
|
|
wrong theme. Mirrors lib/stores/theme.svelte.ts. -->
|
|
<script>
|
|
(function () {
|
|
try {
|
|
var p = localStorage.getItem('spoolman-v2-theme') || 'system';
|
|
var t =
|
|
p === 'light' || p === 'dark'
|
|
? p
|
|
: window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
? 'dark'
|
|
: 'light';
|
|
document.documentElement.setAttribute('data-theme', t);
|
|
var m = document.querySelector('meta[name="theme-color"]');
|
|
if (m) m.setAttribute('content', t === 'light' ? '#f2f1ee' : '#1f1f1f');
|
|
} catch (e) {}
|
|
})();
|
|
</script>
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
|
|
%sveltekit.head%
|
|
</head>
|
|
|
|
<body data-sveltekit-preload-data="hover">
|
|
<div style="display: contents">%sveltekit.body%</div>
|
|
</body>
|
|
</html>
|