This commit is contained in:
mark committed 2026-09-04 11:52:10 -04:00
1 parent 6925c46568
commit 7127e3ff9d
27 files changed
+721 -676

No files matched your search

+9
View File
@@ -67,6 +67,15 @@
.footnotes-title { font-size: 1rem; }
.marker { font-weight: 700; }
/* The callers are * † ‡ § and ✡, and the star is the one character in the
whole corpus a browser may render as an emoji. render_books.py already
appends U+FE0E to ask for the text glyph; this asks a second way, for
renderers that ignore the variation selector. Newer property, so where it
is not supported the selector is simply dropped and the variation selector
is still doing the work. */
.noteref,
.marker { font-variant-emoji: text; }
/* The navbar is sticky, so an element scrolled to the top of the viewport
lands underneath it. These two are everything an anchor in this app points
at -- chapter headings and verse numbers -- so the offset lives on them
+15 -2
View File
@@ -213,6 +213,19 @@ async function answer(input, event) {
}
}
// Pages are always asked for with revalidation forced.
//
// server.py marks them no-cache, which asks the browser for the same thing --
// but this worker's own fetch goes through the browser's HTTP cache too, so a
// page stored under an earlier and wronger Cache-Control keeps being served
// from it until that entry expires, however many times the library version
// changes underneath. Saying it on the request is what gets past one that
// already is. Costs a conditional GET, which the response header was asking
// for anyway.
function pageRequest(url) {
return new Request(url, { cache: 'no-cache' });
}
async function readText(input, event) {
const res = await answer(input, event);
if (!res || !res.ok) throw new Error('cannot load ' + (input.url || input));
@@ -250,7 +263,7 @@ const MISSING_NOTICE = ['Not found', 'There is no page at this address.'];
async function fragmentFor(path, event) {
let res;
try {
res = await answer(path, event);
res = await answer(pageRequest(path), event);
} catch (err) {
return view.notice(...OFFLINE_NOTICE);
}
@@ -335,7 +348,7 @@ async function fillLibrary() {
while (missing.length && !stopped) {
const url = missing.pop();
try {
const res = await fromNetwork(new Request(url), DOWNLOAD_TIMEOUT_MS);
const res = await fromNetwork(pageRequest(url), DOWNLOAD_TIMEOUT_MS);
// A response that arrived but is not usable -- a page that has since
// been removed, say -- is skipped rather than retried. The connection
// is plainly fine, and stopping for it would strand everything after.