pwa: fix offline caching for prayer/faith routes
All checks were successful
CI / update (push) Successful in 1m53s
All checks were successful
CI / update (push) Successful in 1m53s
The glob in sync.ts targeted a nonexistent /src/routes/glaube/ directory instead of the actual [faithLang=faithLang] parameterized route. This meant zero prayer pages were ever precached for offline use. - Fix glob to match [faithLang=faithLang] and expand param segments to both language variants (glaube/faith, gebete/prayers, rosenkranz/rosary) - Extract validPrayerSlugs to shared module for build-time route enumeration - Add faith to service worker cacheable route regex
This commit is contained in:
@@ -1,32 +1,9 @@
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import { error } from "@sveltejs/kit";
|
||||
|
||||
// Valid prayer slugs (both languages)
|
||||
const validSlugs = new Set([
|
||||
'das-heilige-kreuzzeichen', 'the-sign-of-the-cross',
|
||||
'gloria-patri',
|
||||
'paternoster', 'our-father',
|
||||
'credo', 'nicene-creed',
|
||||
'ave-maria', 'hail-mary',
|
||||
'salve-regina',
|
||||
'das-fatimagebet', 'fatima-prayer',
|
||||
'gloria',
|
||||
'gebet-zum-hl-erzengel-michael', 'prayer-to-st-michael-the-archangel',
|
||||
'bruder-klaus-gebet', 'prayer-of-st-nicholas-of-flue',
|
||||
'josephgebet-des-hl-papst-pius-x', 'prayer-to-st-joseph-by-pope-st-pius-x',
|
||||
'das-confiteor', 'the-confiteor',
|
||||
'postcommunio',
|
||||
'anima-christi',
|
||||
'prayer-before-a-crucifix', 'gebet-vor-einem-kruzifix',
|
||||
'schutzengel-gebet', 'guardian-angel-prayer',
|
||||
'apostolisches-glaubensbekenntnis', 'apostles-creed',
|
||||
'tantum-ergo',
|
||||
'angelus',
|
||||
'regina-caeli',
|
||||
]);
|
||||
import { validPrayerSlugs } from '$lib/data/prayerSlugs';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, url }) => {
|
||||
if (!validSlugs.has(params.prayer)) {
|
||||
if (!validPrayerSlugs.has(params.prayer)) {
|
||||
throw error(404, 'Prayer not found');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user