diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..5fa389f --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,9 @@ + + Options -MultiViews + RewriteEngine On + + SetEnvIf X-Forwarded-Proto "https" HTTPS=on + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php [QSA,L] + \ No newline at end of file diff --git a/public/images/Notes-icon-192x192.png b/public/images/Notes-icon-192x192.png new file mode 100644 index 0000000..d74c319 Binary files /dev/null and b/public/images/Notes-icon-192x192.png differ diff --git a/public/images/Notes-icon-512x512.png b/public/images/Notes-icon-512x512.png new file mode 100644 index 0000000..0b683fe Binary files /dev/null and b/public/images/Notes-icon-512x512.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..e419be2 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "Sermon Notes", + "short_name": "Sermon Notes", + "description": "A personal note-taking app for sermons with reference material", + "start_url": "/", + "display": "standalone", + "orientation": "landscape", + "background_color": "#ffffff", + "theme_color": "#000000", + "icons": [ + { + "src": "/images/Notes-icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/images/Notes-icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "screenshots": [ + { + "src": "/images/Notes-icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "/images/Notes-icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "form_factor": "wide" + } + ] +} \ No newline at end of file diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000..b800de9 --- /dev/null +++ b/public/sw.js @@ -0,0 +1,56 @@ +// public/sw.js +const CACHE_NAME = 'app-cache-v1'; +const ASSETS_TO_CACHE = [ + '/', + '/manifest.json', + // Add paths to your main CSS and JS files here + // e.g., '/build/app.css', '/build/app.js' +]; + +// Install Event: Cache core static assets +self.addEventListener('install', event => { + event.waitUntil( + caches.open(CACHE_NAME) + .then(cache => { + return cache.addAll(ASSETS_TO_CACHE); + }) + ); + self.skipWaiting(); +}); + +// Activate Event: Clean up old caches if you change the CACHE_NAME version +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(cacheNames => { + return Promise.all( + cacheNames.map(cache => { + if (cache !== CACHE_NAME) { + return caches.delete(cache); + } + }) + ); + }) + ); + self.clients.claim(); +}); + +// Fetch Event: Network First, Fallback to Cache +self.addEventListener('fetch', event => { + // Only cache GET requests + if (event.request.method !== 'GET') return; + + event.respondWith( + fetch(event.request) + .then(networkResponse => { + // If the network request succeeds, clone it and put it in the cache + return caches.open(CACHE_NAME).then(cache => { + cache.put(event.request, networkResponse.clone()); + return networkResponse; + }); + }) + .catch(() => { + // If the network fails (offline), try to serve from cache + return caches.match(event.request); + }) + ); +}); \ No newline at end of file