feat: serve all precached data offline via DataCache fallback

- DataCache.fetchWithFallback: network-first with IDB write-through under
  the same url: keys the preload writes; falls back to precached IDB copy
  when offline — closes the preload(IDB) vs read(SW cache) gap that made
  the Bible reader (and every other view) fail offline despite precaching
- Convert all 33 raw /data fetches across bible/service/menaion/prayer/
  calendar/settings views; in-memory caches and notFound maps preserved
- fetchCommandText: switch to lowercase services/commands/ (already in
  preload manifest); tolerate both TEXT/text node casings per migrate-data
- Remove stale duplicate static/data/en/services/Command/ (15 files)
- fetchLives: fix misc fallback to real lives/misc/{N}.json bundles
This commit is contained in:
catarrh committed 2026-08-24 09:50:07 +03:00
1 parent 623c56a96f
commit a005e386a6
22 files changed
+118 -198

No files matched your search

+6 -6
View File
@@ -326,8 +326,8 @@ export class SettingsView {
// Load default Bible versions dynamically
(async () => {
try {
const resp = await fetch('/data/bible/versions.json');
const versions = await resp.json();
const versions = await DataCache.fetchWithFallback<any[]>('/data/bible/versions.json');
if (!versions || !Array.isArray(versions)) return;
const userLang = this.settings.language;
// Sort by language priority
@@ -479,8 +479,8 @@ export class SettingsView {
// Load translations on first expand
if (container.innerHTML === '') {
try {
const resp = await fetch('/data/bible/versions.json');
const versions = await resp.json();
const versions = await DataCache.fetchWithFallback<any[]>('/data/bible/versions.json');
if (!versions || !Array.isArray(versions)) throw new Error('unavailable');
const userLang = this.settings.language;
versions.sort((a: any, b: any) => {
const pa = versionPriority(a.language, userLang);
@@ -637,8 +637,8 @@ export class SettingsView {
// Count cached Bible translations
(async () => {
try {
const resp = await fetch('/data/bible/versions.json');
const versions = await resp.json();
const versions = await DataCache.fetchWithFallback<any[]>('/data/bible/versions.json');
if (!versions || !Array.isArray(versions)) return;
const total = versions.length;
let cached = 0;
for (const v of versions) {