set default page title when manifest not available
Hunter
Tuesday, December 30th, 2025 at 6:43 PM
45 let isPreloadingPriority = false;
46 let totalBytesLoaded = 0; // Track total filesize of all preloaded songs
47 let cachedTracks = new Set(); // Track which songs are cached for offline use
-let CACHE_NAME = null; // Will be loaded from manifest.json
48 +let CACHE_NAME = 'my-mixapp'; // Default fallback
49
50 // Load cache name from manifest.json first, then load tracks
51 fetch('manifest.json')
- .then(response => response.json())
52 + .then(response => {
53 + if (!response.ok) return null;
54 + return response.json();
55 + })
56 .then(manifest => {
- CACHE_NAME = manifest.cache_name || manifest.name;
- console.log('Using cache name:', CACHE_NAME);
57 + if (manifest) {
58 + CACHE_NAME = manifest.cache_name || manifest.name || CACHE_NAME;
59 + console.log('Using cache name:', CACHE_NAME);
60
- // Set page title from manifest
- if (manifest.name) {
- document.title = manifest.name;
61 + if (manifest.name) {
62 + document.title = manifest.name;
63 + }
64 }
65
- // Now that we have CACHE_NAME, load tracks
66 return fetch('mix/tracks.json');
67 })
68 .then(response => {
89 }
90 })
91 .catch(error => {
- console.error('Error loading manifest or tracks:', error);
92 + console.error('Error loading tracks:', error);
93 updateCurrentSongDisplay('Unable to load tracks. Please check your connection.');
94 });
95