summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-03 20:43:46 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-03 20:43:46 +0200
commit709919a9624ed4336e9e5ae382e29cd34c795a82 (patch)
tree5562aa8a08048666c162db008db9b69dc554d4c6 /public
parent9f3b80a859a8e54856dd283b635a4abfe377feb9 (diff)
Experimental PWA support (#13)
Diffstat (limited to 'public')
-rw-r--r--public/service-worker.js47
-rw-r--r--public/static/icons/icon-128x128.pngbin0 -> 1456 bytes
-rw-r--r--public/static/icons/icon-144x144.pngbin0 -> 1565 bytes
-rw-r--r--public/static/icons/icon-152x152.pngbin0 -> 1738 bytes
-rw-r--r--public/static/icons/icon-192x192.pngbin0 -> 2139 bytes
-rw-r--r--public/static/icons/icon-256x256.pngbin0 -> 2923 bytes
-rw-r--r--public/static/icons/icon-512x512.pngbin0 -> 6611 bytes
-rw-r--r--public/static/manifest.json34
8 files changed, 81 insertions, 0 deletions
diff --git a/public/service-worker.js b/public/service-worker.js
new file mode 100644
index 0000000..2b5c556
--- /dev/null
+++ b/public/service-worker.js
@@ -0,0 +1,47 @@
+const CACHE_NAME = 'static-cache-v10';
+const FILES_TO_CACHE = [
+ '/offline.html',
+ '/static/v10/css/materialize.min.css',
+ '/static/v10/css/material-icons.css',
+ '/static/v10/css/local.css',
+ '/static/v10/js/jquery-2.2.4.min.js',
+ '/static/v10/js/materialize.min.js',
+ '/static/v10/js/travelynx-actions.min.js',
+];
+
+self.addEventListener('install', (evt) => {
+ evt.waitUntil(
+ caches.open(CACHE_NAME).then((cache) => {
+ return cache.addAll(FILES_TO_CACHE);
+ })
+ );
+ self.skipWaiting();
+});
+
+self.addEventListener('activate', (evt) => {
+ evt.waitUntil(
+ caches.keys().then((keyList) => {
+ return Promise.all(keyList.map((key) => {
+ if (key !== CACHE_NAME) {
+ return caches.delete(key);
+ }
+ }));
+ })
+ );
+ self.clients.claim();
+});
+
+self.addEventListener('fetch', (evt) => {
+ if (evt.request.mode !== 'navigate') {
+ return;
+ }
+ evt.respondWith(
+ fetch(evt.request)
+ .catch(() => {
+ return caches.open(CACHE_NAME)
+ .then((cache) => {
+ return cache.match('offline.html');
+ });
+ })
+ );
+});
diff --git a/public/static/icons/icon-128x128.png b/public/static/icons/icon-128x128.png
new file mode 100644
index 0000000..2dfa5b4
--- /dev/null
+++ b/public/static/icons/icon-128x128.png
Binary files differ
diff --git a/public/static/icons/icon-144x144.png b/public/static/icons/icon-144x144.png
new file mode 100644
index 0000000..151e555
--- /dev/null
+++ b/public/static/icons/icon-144x144.png
Binary files differ
diff --git a/public/static/icons/icon-152x152.png b/public/static/icons/icon-152x152.png
new file mode 100644
index 0000000..a5a034d
--- /dev/null
+++ b/public/static/icons/icon-152x152.png
Binary files differ
diff --git a/public/static/icons/icon-192x192.png b/public/static/icons/icon-192x192.png
new file mode 100644
index 0000000..a00418e
--- /dev/null
+++ b/public/static/icons/icon-192x192.png
Binary files differ
diff --git a/public/static/icons/icon-256x256.png b/public/static/icons/icon-256x256.png
new file mode 100644
index 0000000..e9493a3
--- /dev/null
+++ b/public/static/icons/icon-256x256.png
Binary files differ
diff --git a/public/static/icons/icon-512x512.png b/public/static/icons/icon-512x512.png
new file mode 100644
index 0000000..074e828
--- /dev/null
+++ b/public/static/icons/icon-512x512.png
Binary files differ
diff --git a/public/static/manifest.json b/public/static/manifest.json
new file mode 100644
index 0000000..7e856f2
--- /dev/null
+++ b/public/static/manifest.json
@@ -0,0 +1,34 @@
+{
+ "name": "travelynx",
+ "short_name": "travelynx",
+ "scope": "/",
+ "icons": [{
+ "src": "/static/icons/icon-128x128.png",
+ "sizes": "128x128",
+ "type": "image/png"
+ }, {
+ "src": "/static/icons/icon-144x144.png",
+ "sizes": "144x144",
+ "type": "image/png"
+ }, {
+ "src": "/static/icons/icon-152x152.png",
+ "sizes": "152x152",
+ "type": "image/png"
+ }, {
+ "src": "/static/icons/icon-192x192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ }, {
+ "src": "/static/icons/icon-256x256.png",
+ "sizes": "256x256",
+ "type": "image/png"
+ }, {
+ "src": "/static/icons/icon-512x512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }],
+ "start_url": "/",
+ "display": "standalone",
+ "background_color": "#ffffff",
+ "theme_color": "#673ab7"
+}