perf(watch): a shared link loads the player, not the app
A /watch link is opened by whoever it was sent to — signed out, often on a phone on mobile data — and it booted through main.tsx: every app provider, the app's i18n (every locale of every area), the flag sprites, ~392 KB gzip before the player could start. It now has its own HTML entry, watch.html → watchMain.tsx, which imports WatchPage and what it renders; the server hands every /watch/ path that page (the OG block injected as before), and vite dev does the same. Measured on the build: /watch JS 290 → 87 KB gzip, CSS 104 → 19 KB; the app's own bytes unchanged. Two leaks had to go for that: lib/format imported the app's i18n for one "just now" string (the relative-time formatters now take `t`, like the file's other t-formatters), and the boundary's crash copy came from the same i18n (CrashBoundary takes its copy; ErrorBoundary is the app's wrapper, the watch entry gives it the page's own strings). The page's popover tree went too: it renders no popover. Held by: a contract test walking the entry's runtime imports, naming the path to anything only the app may load (red on a planted i18n import in lib/format), and holding watch.html's head equal to index.html's; a DB-lane test that every /watch/ path gets the player's page with the link's OG tags and app paths get the app (red on the old routing). Screenshots at 375 px, EN and HU, video / audio / password / gone / wrong password / unlocked: identical to the old entry's, bar the video's buffered bar.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-theme="dark" data-scheme="midnight">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<!-- resizes-content: the on-screen keyboard shrinks the layout viewport, not only the visual one,
|
||||
so a dialog's pinned footer (DESIGN C4) sits above the keyboard instead of under it. Chrome's
|
||||
default since 108 only shrinks the visual viewport; Safari ignores the key. -->
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, interactive-widget=resizes-content"
|
||||
/>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<!-- The public /watch/{token} page's own entry (src/watchMain.tsx), so a shared link does not
|
||||
download the app. Its head mirrors index.html (a contract test holds them equal) — OG:START:
|
||||
the server replaces this block per link so it unfurls with the video's title/thumbnail; an
|
||||
invalid link keeps these generic defaults. -->
|
||||
<!--OG:START-->
|
||||
<title>Siftlode</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="A self-hosted, multi-user reader, subscription organizer and media center with download capabilities."
|
||||
/>
|
||||
<meta property="og:title" content="Siftlode" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="A self-hosted, multi-user reader, subscription organizer and media center with download capabilities."
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<!--OG:END-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/watchMain.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user