diff --git a/.guides/content/Progressive-Web-App-Template-1ec2.md b/.guides/content/Progressive-Web-App-Template-1ec2.md index 16cb903..469b579 100644 --- a/.guides/content/Progressive-Web-App-Template-1ec2.md +++ b/.guides/content/Progressive-Web-App-Template-1ec2.md @@ -5,7 +5,7 @@ It only runs on Codio boxes. To install, run the following command from inside the Codio box: ``` -$ curl -sL https://bit.ly/XXXXXXX | sudo -E bash - +$ curl -sL https://bit.ly/3kZ56Kd | sudo -E bash - ``` > Note this will delete ALL the existing content from your Codio Box. diff --git a/README.md b/README.md index d503bc1..2882fcb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It only runs on Codio boxes. To install, run the following command from inside the Codio box: ``` -$ curl -sL https://bit.ly/XXXXXXX | sudo -E bash - +$ curl -sL https://bit.ly/3kZ56Kd | sudo -E bash - ``` > Note this will delete ALL the existing content from your Codio Box. diff --git a/icons/icon-1024.png b/icons/icon-1024.png new file mode 100644 index 0000000..2f001e6 Binary files /dev/null and b/icons/icon-1024.png differ diff --git a/icons/icon-120.png b/icons/icon-120.png new file mode 100644 index 0000000..460a8e9 Binary files /dev/null and b/icons/icon-120.png differ diff --git a/icons/icon-128.png b/icons/icon-128.png new file mode 100644 index 0000000..488c04a Binary files /dev/null and b/icons/icon-128.png differ diff --git a/icons/icon-144.png b/icons/icon-144.png new file mode 100644 index 0000000..f26edb9 Binary files /dev/null and b/icons/icon-144.png differ diff --git a/icons/icon-152.png b/icons/icon-152.png new file mode 100644 index 0000000..22ba145 Binary files /dev/null and b/icons/icon-152.png differ diff --git a/icons/icon-16.png b/icons/icon-16.png new file mode 100644 index 0000000..ab4859d Binary files /dev/null and b/icons/icon-16.png differ diff --git a/icons/icon-167.png b/icons/icon-167.png new file mode 100644 index 0000000..ac2d4f9 Binary files /dev/null and b/icons/icon-167.png differ diff --git a/icons/icon-180.png b/icons/icon-180.png new file mode 100644 index 0000000..8ee561d Binary files /dev/null and b/icons/icon-180.png differ diff --git a/icons/icon-192.png b/icons/icon-192.png new file mode 100644 index 0000000..5997127 Binary files /dev/null and b/icons/icon-192.png differ diff --git a/icons/icon-384.png b/icons/icon-384.png new file mode 100644 index 0000000..53cc7c9 Binary files /dev/null and b/icons/icon-384.png differ diff --git a/icons/icon-512.png b/icons/icon-512.png new file mode 100644 index 0000000..a67031a Binary files /dev/null and b/icons/icon-512.png differ diff --git a/icons/icon-72.png b/icons/icon-72.png new file mode 100644 index 0000000..7492d9b Binary files /dev/null and b/icons/icon-72.png differ diff --git a/icons/icon-96.png b/icons/icon-96.png new file mode 100644 index 0000000..c40a7c7 Binary files /dev/null and b/icons/icon-96.png differ diff --git a/icons/maskable_icon.png b/icons/maskable_icon.png new file mode 100644 index 0000000..7c9e447 Binary files /dev/null and b/icons/maskable_icon.png differ diff --git a/index.html b/index.html index 035c94c..5a1f0b9 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,18 @@ + + + + + + + + + + + + diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..213eea2 --- /dev/null +++ b/manifest.json @@ -0,0 +1,18 @@ + +{ + "name": "PWA", + "short_name": "Simple PWA", + "lang": "en-GB", + "start_url": "index.html", + "display": "standalone", + "background_color": "#005EB8", + "theme_color": "#005EB8", + "icons": [ + { + "src": "icons/maskable_icon.png", + "type": "image/png", + "purpose": "any maskable", + "sizes": "72x72 96x96 120x120 128x128 144x144 152x152 180x180 192x192 256x256 384x384 512x512 1024x1024" + } + ] +} diff --git a/sw.js b/sw.js new file mode 100644 index 0000000..831b580 --- /dev/null +++ b/sw.js @@ -0,0 +1,35 @@ + +const cacheName = 'hello-pwa' +const filesToCache = ['index.html'] + +/* Start the service worker and cache all of the app's content */ +self.addEventListener('install', event => { + console.log('service worker installing') + event.waitUntil( + caches.open(cacheName).then( cache => cache.addAll(filesToCache)) + ) +}) + +/* Serve cached content when offline */ +self.addEventListener('fetch', event => { + event.respondWith( + caches.match(event.request).then( response => response || fetch(event.request)) + ) +}) + +self.addEventListener('activate', function(event) { + + var cacheAllowlist = ['pages-cache-v1', 'blog-posts-cache-v1']; + + event.waitUntil( + caches.keys().then(function(cacheNames) { + return Promise.all( + cacheNames.map(function(cacheName) { + if (cacheAllowlist.indexOf(cacheName) === -1) { + return caches.delete(cacheName) + } + }) + ) + }) + ) +})