Choose a cover in two parts, and let the app be installed
A cover is a colour *and* a pattern now, chosen in turn. Offering every combination as its own entry meant fifteen colours times a dozen patterns in a grid nobody could take in — and in practice only the handful someone had thought to write out. Each pattern is previewed over the colour in hand, so what is on screen is the cover as it will be. `cover_pattern` is its own column: they are two decisions, and folding them into one number would mean renumbering every cover the day a pattern is added. For one day the patterns *were* twelve appended entries. Those indices are read back as the colour-and-pattern pair they were drawn as, so nothing chosen then looks different now. And three separate reasons the install button never appeared, none of them in anyone's configuration: - `beforeinstallprompt` fires once, early — usually before React has mounted — and is never fired again. A listener added from inside a component simply missed it. It is caught at the top of index.html now. - A `<link rel="manifest">` is fetched with credentials omitted unless it says otherwise. Behind a reverse proxy that authenticates in front of the app, that one request comes back as the proxy's login page and the browser reads it as an invalid manifest — while the app itself works perfectly, because its own requests carry the cookie. - The service worker cached whatever came back, so a lapsed session could be stored as the application itself. The app would then "work offline" by showing a login screen it could never get past, curable only by clearing the site's data. Only successful, unredirected responses are cached now, and the cache name is bumped to drop anything already stored under the old rules. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d8d1180de
commit
8ca1ed6e06
17 files changed
+455
-221
No files matched your search
+22
-1
@@ -10,11 +10,32 @@
|
||||
<meta name="apple-mobile-web-app-title" content="InkNote" />
|
||||
<meta name="description" content="Write & draw — notes that sync everywhere" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<link rel="manifest" href="./manifest.json" />
|
||||
<!-- `use-credentials` because the manifest is otherwise fetched with
|
||||
credentials omitted, cookies and all. Behind an authenticating reverse
|
||||
proxy that request comes back as the proxy's login page, the browser
|
||||
reads it as an invalid manifest, and no install is ever offered — while
|
||||
the app itself works perfectly, because its own requests do carry the
|
||||
cookie. Harmless without a proxy. -->
|
||||
<link rel="manifest" href="./manifest.json" crossorigin="use-credentials" />
|
||||
<link rel="apple-touch-icon" href="./apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="./icon-192.png" />
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✏️</text></svg>" />
|
||||
<title>InkNote</title>
|
||||
<script>
|
||||
/* Catch the browser's install offer before anything else runs.
|
||||
*
|
||||
* `beforeinstallprompt` is fired once, early — usually before React has
|
||||
* mounted — and is never fired again. Listening for it from inside a
|
||||
* component meant it was simply missed, and the install button never
|
||||
* appeared however correctly the site was served. It is stashed here, at
|
||||
* the top of the document, and the app picks it up when it is ready. */
|
||||
window.__inknoteInstallPrompt = null;
|
||||
window.addEventListener("beforeinstallprompt", function (e) {
|
||||
e.preventDefault();
|
||||
window.__inknoteInstallPrompt = e;
|
||||
window.dispatchEvent(new Event("inknote:installable"));
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
body { margin: 0; padding: 0; overflow: hidden; overscroll-behavior: none; }
|
||||
#root { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); height: 100vh; }
|
||||
|
||||
Reference in new issue
Block a user