diff options
author | Anton L. Šijanec <sijanecantonluka@gmail.com> | 2020-05-14 21:43:04 +0200 |
---|---|---|
committer | Anton L. Šijanec <sijanecantonluka@gmail.com> | 2020-05-14 21:43:04 +0200 |
commit | 068a3541fac291885945b1fe5de58e8fe01a98d2 (patch) | |
tree | 1aeaf891707605a1a90a25038b1a88e49c8c0fe0 | |
parent | Merge branch 'dev' of https://github.com/beziapp/beziapp.github.io into dev (diff) | |
download | beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.tar beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.tar.gz beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.tar.bz2 beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.tar.lz beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.tar.xz beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.tar.zst beziapp-068a3541fac291885945b1fe5de58e8fe01a98d2.zip |
-rw-r--r-- | README.md | 22 | ||||
-rwxr-xr-x | bin/compose-html (renamed from compose-html) | bin | 22544 -> 22544 bytes | |||
-rwxr-xr-x | bin/compose-single | bin | 0 -> 22400 bytes | |||
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | global.bvr | 1 | ||||
-rwxr-xr-x | install | 3 | ||||
-rw-r--r-- | pages-src/about.bvr | 3 | ||||
-rw-r--r-- | pages-src/misc/version.bvr | 1 | ||||
-rw-r--r-- | pages/about.html | 5 | ||||
-rw-r--r-- | pages/absences.html | 1 | ||||
-rw-r--r-- | pages/changelog.html | 1 | ||||
-rw-r--r-- | pages/chats.html | 1 | ||||
-rw-r--r-- | pages/grades.html | 1 | ||||
-rw-r--r-- | pages/gradings.html | 1 | ||||
-rw-r--r-- | pages/jitsi.html | 1 | ||||
-rw-r--r-- | pages/meals.html | 1 | ||||
-rw-r--r-- | pages/messaging.html | 1 | ||||
-rw-r--r-- | pages/privacypolicy.html | 1 | ||||
-rw-r--r-- | pages/settings.html | 1 | ||||
-rw-r--r-- | pages/teachers.html | 1 | ||||
-rw-r--r-- | pages/timetable.html | 1 | ||||
-rw-r--r-- | pages/tos.html | 1 | ||||
-rw-r--r-- | sw.js | 7 | ||||
-rw-r--r-- | sw.js.bvr | 146 |
24 files changed, 195 insertions, 17 deletions
@@ -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/compose-html b/bin/compose-html Binary files differindex 4c1fe5a..4c1fe5a 100755 --- a/compose-html +++ b/bin/compose-html diff --git a/bin/compose-single b/bin/compose-single Binary files differnew file mode 100755 index 0000000..c198aec --- /dev/null +++ b/bin/compose-single 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 .. + @@ -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 @@ -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 @@ <b class="title-secondary">Beži</b><span class="title-primary">App</span> </h3> <!-- One day in the future we may have sw cache version covered by this as well --> - <h5 class="subheader"><x-su>version</x-su> <@?i version@></h5> +# I agree, will make a script + <h5 class="subheader"><x-su>version</x-su> <@?g app_version@></h5> </div> </div> <div class="row"> 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 @@ + <!DOCTYPE html> <html> <head> @@ -74,9 +75,7 @@ <b class="title-secondary">Beži</b><span class="title-primary">App</span> </h3> <!-- One day in the future we may have sw cache version covered by this as well --> - <h5 class="subheader"><x-su>version</x-su> -1.0.13-bet -</h5> + <h5 class="subheader"><x-su>version</x-su> 1.0.13-beta</h5> </div> </div> <div class="row"> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> 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 @@ + <!DOCTYPE html> <html> <head> @@ -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); + })) +}); |