From 96dd81ddf1188377bf1402e866c4b263dbd55d1c Mon Sep 17 00:00:00 2001 From: rstular Date: Sun, 17 May 2020 13:49:56 +0200 Subject: Fixed install script --- dist/assets/root/directory.json | 4 -- dist/assets/root/favicon.png | Bin 50 -> 0 bytes dist/assets/root/index.html | 27 -------- dist/assets/root/login.html | 66 ------------------ dist/assets/root/logout.html | 26 ------- dist/assets/root/manifest.json | 59 ---------------- dist/assets/root/sw.js.bvr | 150 ---------------------------------------- dist/pages/about.html | 2 +- dist/sw.js | 150 ++++++++++++++++++++++++++++++++++++++++ install | 12 ++-- 10 files changed, 157 insertions(+), 339 deletions(-) delete mode 100644 dist/assets/root/directory.json delete mode 100644 dist/assets/root/favicon.png delete mode 100644 dist/assets/root/index.html delete mode 100644 dist/assets/root/login.html delete mode 100644 dist/assets/root/logout.html delete mode 100644 dist/assets/root/manifest.json delete mode 100644 dist/assets/root/sw.js.bvr create mode 100644 dist/sw.js diff --git a/dist/assets/root/directory.json b/dist/assets/root/directory.json deleted file mode 100644 index f0670fd..0000000 --- a/dist/assets/root/directory.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Anton Luka Šijanec": 6326, - "Rok Štular": 5313 - diff --git a/dist/assets/root/favicon.png b/dist/assets/root/favicon.png deleted file mode 100644 index 0834007..0000000 Binary files a/dist/assets/root/favicon.png and /dev/null differ diff --git a/dist/assets/root/index.html b/dist/assets/root/index.html deleted file mode 100644 index 2a861a1..0000000 --- a/dist/assets/root/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - BežiApp - - - - - - - - - - - - - - - - - - - diff --git a/dist/assets/root/login.html b/dist/assets/root/login.html deleted file mode 100644 index bbacb7d..0000000 --- a/dist/assets/root/login.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - Login « BežiApp - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-

BežiApp -

-
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
-

bySigningInYouAgreeTo theToS and - thePrivacyPolicy -

-
-
-
- - - diff --git a/dist/assets/root/logout.html b/dist/assets/root/logout.html deleted file mode 100644 index c3f9b41..0000000 --- a/dist/assets/root/logout.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - Logout « BežiApp - - - - - - - - - - - - - - - - - - diff --git a/dist/assets/root/manifest.json b/dist/assets/root/manifest.json deleted file mode 100644 index d2c833f..0000000 --- a/dist/assets/root/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "BežiApp", - "short_name": "BežiApp", - "description": "Unofficial app for GimB students", - - "start_url": "/index.html", - "scope": "/", - - "display": "standalone", - "orientation": "portrait-primary", - - "background_color": "#008053", - "theme_color": "#004d32", - "icons": [ - { - "src": "/img/icons/icon_48.png", - "type": "image/png", - "sizes": "48x48" - }, - { - "src": "/img/icons/icon_72.png", - "type": "image/png", - "sizes": "72x72" - }, - { - "src": "/img/icons/icon_96.png", - "type": "image/png", - "sizes": "96x96" - }, - { - "src": "/img/icons/icon_144.png", - "type": "image/png", - "sizes": "144x144" - }, - { - "src": "/img/icons/icon_192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "/img/icons/icon_384.png", - "type": "image/png", - "sizes": "384x384" - }, - { - "src": "/img/icons/icon_512.png", - "type": "image/png", - "sizes": "512x512" - } - ], - - "dir": "auto", - "lang": "en-US", - "categories": [ - "education", - "productivity", - "utilities" - ] - diff --git a/dist/assets/root/sw.js.bvr b/dist/assets/root/sw.js.bvr deleted file mode 100644 index 41e0112..0000000 --- a/dist/assets/root/sw.js.bvr +++ /dev/null @@ -1,150 +0,0 @@ - - - - -// Change version to cause cache refresh -const static_cache_name = "site-static-1.0.13-beta-48de23d"; -// latest commit is 48de23d1c8a36a0cd322d8a72ebdca2cb822cb24 -// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js -// sw.js NE SME BITI CACHAN, ker vsebuje verzijo! - -const assets = [ - "/css/materialize.min.css", - "/css/fontawesome.min.css", - "/css/materialicons.css", - "/css/styles.css", - "/css/fullcalendar/custom.css", - "/css/fullcalendar/daygrid/main.min.css", - "/css/fullcalendar/core/main.min.css", - "/css/fullcalendar/timegrid/main.min.css", - - "/fonts/fa-solid-900.eot", - "/fonts/fa-solid-900.woff2", - "/fonts/fa-brands-400.woff2", - "/fonts/fa-regular-400.eot", - "/fonts/fa-regular-400.woff2", - "/fonts/fa-brands-400.eot", - "/fonts/materialicons.woff2", - - "/img/avatars/asijanec.png", - "/img/avatars/rstular.png", - "/img/icons/icon_384.png", - "/img/icons/icon_192.png", - "/img/icons/icon_72.png", - "/img/icons/icon_144.png", - "/img/icons/icon_512.png", - "/img/icons/icon_96.png", - "/img/icons/icon_48.png", - - "/js/timetable.js", - "/js/gradings.js", - "/js/messaging.js", - "/js/privacypolicy.js", - "/js/teachers.js", - "/js/tos.js", - "/js/login.js", - "/js/app.js", - "/js/meals.js", - "/js/settings.js", - "/js/lang/bundle.js", - "/js/setup-storage.js", - - "/js/lib/materialize.min.js", - "/js/lib/jquery.min.js", - "/js/lib/localforage.min.js", - "/js/lib/xss.js", - "/js/lib/mergedeep.js", - - "/js/lib/fullcalendar/daygrid/main.min.js", - "/js/lib/fullcalendar/core/main.min.js", - "/js/lib/fullcalendar/timegrid/main.min.js", - "/js/grades.js", - "/js/about.js", - "/js/logout.js", - "/js/initialize.js", - "/js/absences.js", - "/js/changelog.js", - - "/pages/timetable.html", - "/pages/teachers.html", - "/pages/absences.html", - "/pages/about.html", - "/pages/changelog.html", - "/pages/messaging.html", - "/pages/gradings.html", - "/pages/grades.html", - "/pages/privacypolicy.html", - "/pages/tos.html", - "/pages/meals.html", - "/pages/settings.html", - - "/manifest.json", - "/index.html", - "/login.html", - "/logout.html", - "/favicon.png", - "/pages/jitsi.html", - "/js/jitsi.js", - "/pages/chats.html", - "/js/chats.js", - "/css/bubbles.css" -]; - -importScripts("/js/lib/localforage.min.js"); -importScripts("/js/setup-storage.js"); -self.addEventListener("install", (evt) => { - // Add localforage.clear() if storage purge is required - evt.waitUntil( - // localforage.clear() - setupStorage() - ); - - evt.waitUntil( - caches.open(static_cache_name).then((cache) => { - cache.addAll(assets); - }) - ); -}); - -// Delete old caches -self.addEventListener("activate", evt => { - evt.waitUntil( - caches.keys().then((keys) => { - return Promise.all(keys - .filter(key => key !== static_cache_name) - .map(key => caches.delete(key)) - ); - }) - ); -}); - -self.addEventListener("message", event => { - - if (event.data) { - let data = JSON.parse(event.data); // parse the message back to JSON - if (data.action == "addtocache") { // check the action - event.waitUntil( - caches.open(static_cache_name).then(function (cache) { - try { - return cache.add([data.url]); - } - catch (error) { - console.error("[sw.js] error: " + error); - } - }) - ); - } else if (data.action == "deletecaches") { - caches.keys().then(function (names) { - for (let name of names) - console.log("[sw.js] deleting cache named " + name); - caches.delete(name); - }); - } - } -}); - -self.addEventListener("fetch", (evt) => { - evt.respondWith(caches.match(evt.request).then((cache_res) => { - return cache_res || fetch(evt.request); - })) -}); diff --git a/dist/pages/about.html b/dist/pages/about.html index 9bc68ef..16b0540 100644 --- a/dist/pages/about.html +++ b/dist/pages/about.html @@ -142,7 +142,7 @@

- ^HEAD 48de23d1c8a36a0cd322d8a72ebdca2cb822cb24 + ^HEAD c2d13f23711f90b86cff6ca06552b69dd2228932

diff --git a/dist/sw.js b/dist/sw.js new file mode 100644 index 0000000..57d1646 --- /dev/null +++ b/dist/sw.js @@ -0,0 +1,150 @@ + + + + +// Change version to cause cache refresh +const static_cache_name = "site-static-1.0.13-beta-c2d13f2"; +// latest commit is c2d13f23711f90b86cff6ca06552b69dd2228932 +// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js +// sw.js NE SME BITI CACHAN, ker vsebuje verzijo! + +const assets = [ + "/css/materialize.min.css", + "/css/fontawesome.min.css", + "/css/materialicons.css", + "/css/styles.css", + "/css/fullcalendar/custom.css", + "/css/fullcalendar/daygrid/main.min.css", + "/css/fullcalendar/core/main.min.css", + "/css/fullcalendar/timegrid/main.min.css", + + "/fonts/fa-solid-900.eot", + "/fonts/fa-solid-900.woff2", + "/fonts/fa-brands-400.woff2", + "/fonts/fa-regular-400.eot", + "/fonts/fa-regular-400.woff2", + "/fonts/fa-brands-400.eot", + "/fonts/materialicons.woff2", + + "/img/avatars/asijanec.png", + "/img/avatars/rstular.png", + "/img/icons/icon_384.png", + "/img/icons/icon_192.png", + "/img/icons/icon_72.png", + "/img/icons/icon_144.png", + "/img/icons/icon_512.png", + "/img/icons/icon_96.png", + "/img/icons/icon_48.png", + + "/js/timetable.js", + "/js/gradings.js", + "/js/messaging.js", + "/js/privacypolicy.js", + "/js/teachers.js", + "/js/tos.js", + "/js/login.js", + "/js/app.js", + "/js/meals.js", + "/js/settings.js", + "/js/lang/bundle.js", + "/js/setup-storage.js", + + "/js/lib/materialize.min.js", + "/js/lib/jquery.min.js", + "/js/lib/localforage.min.js", + "/js/lib/xss.js", + "/js/lib/mergedeep.js", + + "/js/lib/fullcalendar/daygrid/main.min.js", + "/js/lib/fullcalendar/core/main.min.js", + "/js/lib/fullcalendar/timegrid/main.min.js", + "/js/grades.js", + "/js/about.js", + "/js/logout.js", + "/js/initialize.js", + "/js/absences.js", + "/js/changelog.js", + + "/pages/timetable.html", + "/pages/teachers.html", + "/pages/absences.html", + "/pages/about.html", + "/pages/changelog.html", + "/pages/messaging.html", + "/pages/gradings.html", + "/pages/grades.html", + "/pages/privacypolicy.html", + "/pages/tos.html", + "/pages/meals.html", + "/pages/settings.html", + + "/manifest.json", + "/index.html", + "/login.html", + "/logout.html", + "/favicon.png", + "/pages/jitsi.html", + "/js/jitsi.js", + "/pages/chats.html", + "/js/chats.js", + "/css/bubbles.css" +]; + +importScripts("/js/lib/localforage.min.js"); +importScripts("/js/setup-storage.js"); +self.addEventListener("install", (evt) => { + // Add localforage.clear() if storage purge is required + evt.waitUntil( + // localforage.clear() + setupStorage() + ); + + evt.waitUntil( + caches.open(static_cache_name).then((cache) => { + cache.addAll(assets); + }) + ); +}); + +// Delete old caches +self.addEventListener("activate", evt => { + evt.waitUntil( + caches.keys().then((keys) => { + return Promise.all(keys + .filter(key => key !== static_cache_name) + .map(key => caches.delete(key)) + ); + }) + ); +}); + +self.addEventListener("message", event => { + + if (event.data) { + let data = JSON.parse(event.data); // parse the message back to JSON + if (data.action == "addtocache") { // check the action + event.waitUntil( + caches.open(static_cache_name).then(function (cache) { + try { + return cache.add([data.url]); + } + catch (error) { + console.error("[sw.js] error: " + error); + } + }) + ); + } else if (data.action == "deletecaches") { + caches.keys().then(function (names) { + for (let name of names) + console.log("[sw.js] deleting cache named " + name); + caches.delete(name); + }); + } + } +}); + +self.addEventListener("fetch", (evt) => { + evt.respondWith(caches.match(evt.request).then((cache_res) => { + return cache_res || fetch(evt.request); + })) +}); diff --git a/install b/install index a563698..20d6480 100755 --- a/install +++ b/install @@ -1,9 +1,9 @@ #!/bin/bash ./bin/compose-html assets/pages-src/ dist/pages/ .html # mkdir dist # dist itak naredi compose-html -cp -r assets/css dist/css -cp -r assets/fonts dist/fonts -cp -r assets/img dist/img -cp -r assets/js dist/js -find assets/root/ \( ! -name "*.bvr" \) -exec cp "{}" dist/ \; -find assets/root/* -exec ./bin/compose-single "{}" dist/"{}" \; +cp -r assets/css dist/ +cp -r assets/fonts dist/ +cp -r assets/img dist/ +cp -r assets/js dist/ +find assets/root/ -type f \( ! -name "*.bvr" \) -exec cp -r "{}" dist/ \; +find assets/root/ -name "*.bvr" -printf "%f\n" | xargs -I % bash -c "FILE='%'; FILE_DST="dist/\${FILE/.bvr/}"; ./bin/compose-single \"assets/root/\$FILE\" \"\$FILE_DST\"" -- cgit v1.2.3