From 068a3541fac291885945b1fe5de58e8fe01a98d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20L=2E=20=C5=A0ijanec?= Date: Thu, 14 May 2020 21:43:04 +0200 Subject: version is now updated in sw.js and about.bvr --- README.md | 22 +++---- bin/compose-html | Bin 0 -> 22544 bytes bin/compose-single | Bin 0 -> 22400 bytes compose-html | Bin 22544 -> 0 bytes configure | 11 ++++ global.bvr | 1 + install | 3 +- pages-src/about.bvr | 3 +- pages-src/misc/version.bvr | 1 - pages/about.html | 5 +- pages/absences.html | 1 + pages/changelog.html | 1 + pages/chats.html | 1 + pages/grades.html | 1 + pages/gradings.html | 1 + pages/jitsi.html | 1 + pages/meals.html | 1 + pages/messaging.html | 1 + pages/privacypolicy.html | 1 + pages/settings.html | 1 + pages/teachers.html | 1 + pages/timetable.html | 1 + pages/tos.html | 1 + sw.js | 7 ++- sw.js.bvr | 146 +++++++++++++++++++++++++++++++++++++++++++++ 25 files changed, 195 insertions(+), 17 deletions(-) create mode 100755 bin/compose-html create mode 100755 bin/compose-single delete mode 100755 compose-html create mode 100755 configure delete mode 100644 pages-src/misc/version.bvr create mode 100644 sw.js.bvr diff --git a/README.md b/README.md index d44d618..ed69792 100644 --- a/README.md +++ b/README.md @@ -10,22 +10,24 @@ navigation@>` in a .bvr file in [pages-src](pages-src) will include [`navigation `<@?s variable_name variable value@>` and read with `<@?s variable_name@>`. To execute a command and surpress output, use `<@#?x arg@>` where `x` is the command. -So now pages are now in pages-src and before deployment, `./compose_html pages-src/ pages/` has to be run to update the pages +So pages are now in pages-src and before deployment, `./compose_html pages-src/ pages/` has to be run to update the pages dir. idkr, it seemed like a good idea, but feel free not to use it (write about it here so I won't override your commits). -the compiled binary works on "`Linux kondenzator 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 +the compiled binaries work on "`Linux kondenzator 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux`". -this is close to how I compiled it: +there's now a configure script (bash) that compiles all binaries (use if the prebuilt binaries don't work). + ``` -idrk=`pwd` -cd /tmp -git clone https://github.com/sijanec/bverbose -cd bverbose -gcc test/compose-all-in-dir.c -I lib -I src -mv a.out $idrk/compose_html -cd $idrk +# install dependencies +sudo apt install git gcc +# run from project directory +./configure ``` +creates binaries so you can use the ./install everytime you make changes (and hook to post-commit) + +should there be any conflicts with the developers on different platforms, .gitignore files will be created to ignore binaries +from being comitted every time. diff --git a/bin/compose-html b/bin/compose-html new file mode 100755 index 0000000..4c1fe5a Binary files /dev/null and b/bin/compose-html differ diff --git a/bin/compose-single b/bin/compose-single new file mode 100755 index 0000000..c198aec Binary files /dev/null and b/bin/compose-single differ diff --git a/compose-html b/compose-html deleted file mode 100755 index 4c1fe5a..0000000 Binary files a/compose-html and /dev/null differ diff --git a/configure b/configure new file mode 100755 index 0000000..0d51c9b --- /dev/null +++ b/configure @@ -0,0 +1,11 @@ +#!/bin/bash +cd tmp +rm -rf bverbose +git clone https://github.com/sijanec/bverbose +cd bverbose +gcc test/tape-test.c -I lib -I src -o ../../bin/compose-single +gcc test/compose-all-in-dir.c -I lib -I src -o ../../bin/compose-html +cd .. +rm -rf bverbose +cd .. + diff --git a/global.bvr b/global.bvr index c7fb12b..70449ee 100644 --- a/global.bvr +++ b/global.bvr @@ -1,2 +1,3 @@ <@?s bvr_include_path pages-src/ pages-src/misc/@> +<@?s app_version 1.0.13-beta@> # adding something to remove DO NOT MERGE commit message diff --git a/install b/install index b2169fa..27defbd 100755 --- a/install +++ b/install @@ -1,2 +1,3 @@ #!/bin/bash -./compose-html pages-src/ pages/ +./bin/compose-html pages-src/ pages/ +./bin/compose-single sw.js.bvr sw.js diff --git a/pages-src/about.bvr b/pages-src/about.bvr index 0830b9f..8f4da92 100644 --- a/pages-src/about.bvr +++ b/pages-src/about.bvr @@ -52,7 +52,8 @@ BežiApp -
version <@?i version@>
+# I agree, will make a script +
version <@?g app_version@>
diff --git a/pages-src/misc/version.bvr b/pages-src/misc/version.bvr deleted file mode 100644 index e892a4f..0000000 --- a/pages-src/misc/version.bvr +++ /dev/null @@ -1 +0,0 @@ -1.0.13-beta \ No newline at end of file diff --git a/pages/about.html b/pages/about.html index 08c9c47..57372db 100644 --- a/pages/about.html +++ b/pages/about.html @@ -2,6 +2,7 @@ + @@ -74,9 +75,7 @@ BežiApp -
version -1.0.13-bet -
+
version 1.0.13-beta
diff --git a/pages/absences.html b/pages/absences.html index 65212d8..0e829a3 100644 --- a/pages/absences.html +++ b/pages/absences.html @@ -2,6 +2,7 @@ + diff --git a/pages/changelog.html b/pages/changelog.html index 6f4ed95..b3c981b 100644 --- a/pages/changelog.html +++ b/pages/changelog.html @@ -2,6 +2,7 @@ + diff --git a/pages/chats.html b/pages/chats.html index d3c6d04..d85c8ce 100644 --- a/pages/chats.html +++ b/pages/chats.html @@ -2,6 +2,7 @@ + diff --git a/pages/grades.html b/pages/grades.html index df574ad..45ba988 100644 --- a/pages/grades.html +++ b/pages/grades.html @@ -2,6 +2,7 @@ + diff --git a/pages/gradings.html b/pages/gradings.html index 75775d8..bc06469 100644 --- a/pages/gradings.html +++ b/pages/gradings.html @@ -2,6 +2,7 @@ + diff --git a/pages/jitsi.html b/pages/jitsi.html index bdb4112..e9f4d63 100644 --- a/pages/jitsi.html +++ b/pages/jitsi.html @@ -2,6 +2,7 @@ + diff --git a/pages/meals.html b/pages/meals.html index 6b512f1..1163324 100644 --- a/pages/meals.html +++ b/pages/meals.html @@ -2,6 +2,7 @@ + diff --git a/pages/messaging.html b/pages/messaging.html index 7c4ae04..0ee2129 100644 --- a/pages/messaging.html +++ b/pages/messaging.html @@ -2,6 +2,7 @@ + diff --git a/pages/privacypolicy.html b/pages/privacypolicy.html index 24048d4..6472d75 100644 --- a/pages/privacypolicy.html +++ b/pages/privacypolicy.html @@ -2,6 +2,7 @@ + diff --git a/pages/settings.html b/pages/settings.html index ab40c02..3ebcc58 100644 --- a/pages/settings.html +++ b/pages/settings.html @@ -2,6 +2,7 @@ + diff --git a/pages/teachers.html b/pages/teachers.html index 562f6f5..afc2536 100644 --- a/pages/teachers.html +++ b/pages/teachers.html @@ -2,6 +2,7 @@ + diff --git a/pages/timetable.html b/pages/timetable.html index cc43755..49b35db 100644 --- a/pages/timetable.html +++ b/pages/timetable.html @@ -2,6 +2,7 @@ + diff --git a/pages/tos.html b/pages/tos.html index ad4b23b..4f250ba 100644 --- a/pages/tos.html +++ b/pages/tos.html @@ -2,6 +2,7 @@ + diff --git a/sw.js b/sw.js index 7664266..1df1e86 100644 --- a/sw.js +++ b/sw.js @@ -1,5 +1,10 @@ + + + + + // Change version to cause cache refresh -const static_cache_name = "site-static-v1.0.13.2"; +const static_cache_name = "site-static-1.0.13-beta"; // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! diff --git a/sw.js.bvr b/sw.js.bvr new file mode 100644 index 0000000..37ddcbd --- /dev/null +++ b/sw.js.bvr @@ -0,0 +1,146 @@ +<@?i global@> +// Change version to cause cache refresh +const static_cache_name = "site-static-<@?g app_version@>"; +// 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); + })) +}); -- cgit v1.2.3