From b0ce463cca453f071c54f6fd5ecbd7623efe4a0f Mon Sep 17 00:00:00 2001 From: Marwin Schulz Date: Fri, 20 Mar 2026 12:28:00 +0100 Subject: [PATCH] Debug books: show visible status at each load stage, bump SW to v7 Each step in loadBookList now updates the visible UI so the exact failure point is obvious without opening DevTools. Co-Authored-By: Claude Sonnet 4.6 --- static/js/app.js | 12 +++++------- static/js/sw.js | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index b3a76ac..43ebc22 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -2608,19 +2608,18 @@ async function loadBookList() { if (!IS_AUTHENTICATED) return; const listEl = $('book-list'); if (!listEl) return; - listEl.innerHTML = '

Loading…

'; + listEl.innerHTML = '

Loading books…

'; try { + listEl.innerHTML = '

Fetching book list from server…

'; const res = await fetch('/books/', {cache: 'no-store'}); if (!res.ok) { - console.error('loadBookList: server returned', res.status); listEl.innerHTML = `

Server error ${res.status} loading books.

`; return; } const books = await res.json(); if (!Array.isArray(books)) { - console.error('loadBookList: unexpected response', books); - listEl.innerHTML = `

Unexpected response from server.

`; + listEl.innerHTML = `

Unexpected response from server (not an array).

`; return; } if (!books.length) { @@ -2628,11 +2627,12 @@ async function loadBookList() { return; } + listEl.innerHTML = `

Found ${books.length} book(s) on server. Decrypting…

`; + let key; try { key = await getOrCreateEncKey(); } catch (e) { - console.error('loadBookList: getOrCreateEncKey failed', e); listEl.innerHTML = `

Encryption not available: ${e.message}. Make sure you are on HTTPS.

`; return; } @@ -2645,14 +2645,12 @@ async function loadBookList() { bookMetaCache[b.id] = {title: meta.title || '?', author: meta.author || '', type: meta.type || 'epub'}; decrypted.push({id: b.id, title: meta.title || '?', author: meta.author || '', type: meta.type || 'epub', scroll_fraction: b.scroll_fraction, uploaded_at: b.uploaded_at, keyOk: true}); } catch (e) { - console.warn(`loadBookList: could not decrypt book #${b.id}:`, e.message); bookMetaCache[b.id] = {title: `Book #${b.id}`, author: '', type: 'epub'}; decrypted.push({id: b.id, title: `Book #${b.id}`, author: '', type: 'epub', scroll_fraction: b.scroll_fraction, uploaded_at: b.uploaded_at, keyOk: false}); } } renderBookList(decrypted); } catch (e) { - console.error('loadBookList error:', e); if (listEl) listEl.innerHTML = `

Error loading books: ${e.message}

`; } } diff --git a/static/js/sw.js b/static/js/sw.js index f53b666..c3f67f3 100644 --- a/static/js/sw.js +++ b/static/js/sw.js @@ -2,7 +2,7 @@ * diora service worker — caches the app shell for offline use. */ -const CACHE = 'diora-v6'; +const CACHE = 'diora-v7'; const PODCAST_CACHE = 'diora-podcast-v1'; const SHELL = [ '/static/css/app.css',