diff --git a/frontend/public/images/android-chrome-192x192.png b/frontend/public/images/android-chrome-192x192.png new file mode 100644 index 000000000..7896704eb Binary files /dev/null and b/frontend/public/images/android-chrome-192x192.png differ diff --git a/frontend/public/images/android-chrome-384x384.png b/frontend/public/images/android-chrome-384x384.png new file mode 100644 index 000000000..469b0896f Binary files /dev/null and b/frontend/public/images/android-chrome-384x384.png differ diff --git a/frontend/public/images/apple-touch-icon.png b/frontend/public/images/apple-touch-icon.png new file mode 100644 index 000000000..3a70037b7 Binary files /dev/null and b/frontend/public/images/apple-touch-icon.png differ diff --git a/frontend/public/images/browserconfig.xml b/frontend/public/images/browserconfig.xml new file mode 100644 index 000000000..b3930d0f0 --- /dev/null +++ b/frontend/public/images/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git a/frontend/public/images/favicon-16x16.png b/frontend/public/images/favicon-16x16.png new file mode 100644 index 000000000..c399bc701 Binary files /dev/null and b/frontend/public/images/favicon-16x16.png differ diff --git a/frontend/public/images/favicon-32x32.png b/frontend/public/images/favicon-32x32.png new file mode 100644 index 000000000..b4919b7f5 Binary files /dev/null and b/frontend/public/images/favicon-32x32.png differ diff --git a/frontend/public/images/favicon.ico b/frontend/public/images/favicon.ico new file mode 100644 index 000000000..125ec9b31 Binary files /dev/null and b/frontend/public/images/favicon.ico differ diff --git a/frontend/public/images/mstile-150x150.png b/frontend/public/images/mstile-150x150.png new file mode 100644 index 000000000..d1a852fd1 Binary files /dev/null and b/frontend/public/images/mstile-150x150.png differ diff --git a/frontend/public/images/safari-pinned-tab.svg b/frontend/public/images/safari-pinned-tab.svg new file mode 100644 index 000000000..af451c779 --- /dev/null +++ b/frontend/public/images/safari-pinned-tab.svg @@ -0,0 +1,15 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git a/frontend/public/index.html b/frontend/public/index.html index 2274656d0..d5d2d9c74 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -4,8 +4,15 @@ + + + + + + + - Mealie + Mealie @@ -14,6 +21,13 @@ We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.
+ diff --git a/frontend/public/main.js b/frontend/public/main.js new file mode 100644 index 000000000..e321a489b --- /dev/null +++ b/frontend/public/main.js @@ -0,0 +1,9 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register('/sw.js') + .then(function(registration) { + console.log('Registration successful, scope is:', registration.scope); + }) + .catch(function(error) { + console.log('Service worker registration failed, error:', error); + }); +} \ No newline at end of file diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json new file mode 100644 index 000000000..2c38c9578 --- /dev/null +++ b/frontend/public/manifest.json @@ -0,0 +1,20 @@ +{ + "name": "Mealie", + "short_name": "Mealie", + "start_url": "index.html", + "icons": [ + { + "src": "images/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "images/android-chrome-384x384.png", + "sizes": "384x384", + "type": "image/png" + } + ], + "theme_color": "#E17B20", + "background_color": "#898989", + "display": "fullscreen" +} diff --git a/frontend/public/sw.js b/frontend/public/sw.js new file mode 100644 index 000000000..88737622d --- /dev/null +++ b/frontend/public/sw.js @@ -0,0 +1,51 @@ +self.addEventListener("install", function(event) { + event.waitUntil(preLoad()); +}); + +var preLoad = function(){ + console.log("Installing web app"); + return caches.open("offline").then(function(cache) { + console.log("caching index and important routes"); + return cache.addAll([ "/","/recipes/all"]); + }); +}; + +self.addEventListener("fetch", function(event) { + event.respondWith(checkResponse(event.request).catch(function() { + return returnFromCache(event.request); + })); + event.waitUntil(addToCache(event.request)); +}); + +var checkResponse = function(request){ + return new Promise(function(fulfill, reject) { + fetch(request).then(function(response){ + if(response.status !== 404) { + fulfill(response); + } else { + reject(); + } + }, reject); + }); +}; + +var addToCache = function(request){ + return caches.open("offline").then(function (cache) { + return fetch(request).then(function (response) { + console.log(response.url + " was cached"); + return cache.put(request, response); + }); + }); +}; + +var returnFromCache = function(request){ + return caches.open("offline").then(function (cache) { + return cache.match(request).then(function (matching) { + if(!matching || matching.status == 404) { + return cache.match("offline.html"); + } else { + return matching; + } + }); + }); +}; \ No newline at end of file