diff --git a/.gitignore b/.gitignore index 450048e..4df926c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.pyc *.log /index.html +/service-worker.js /js/version.json cache.manifest tiles/ diff --git a/DEVELOPER_README.md b/DEVELOPER_README.md index 2cf294a..6f38d04 100644 --- a/DEVELOPER_README.md +++ b/DEVELOPER_README.md @@ -4,6 +4,6 @@ To get a copy of the code and run a test web server: 1. [Fork the repository](https://github.com/projecthorus/sondehub-tracker/fork) by visiting [https://github.com/projecthorus/sondehub-tracker/fork](https://github.com/projecthorus/sondehub-tracker/fork). 2. Clone the repository with your git tool of choice. -3. Run `build.sh` to generate `index.html` and `js/version.json`. +3. Run `build.sh` to generate `index.html`, `service-worker.js`, and `js/version.json`. 4. Run `python serve.py` to run a simple web server to (This requires python 3.x) 5. Visit [http://localhost:8000](http://localhost:8000) to view the local version of the server! diff --git a/build.sh b/build.sh index 096c1c0..948cde1 100755 --- a/build.sh +++ b/build.sh @@ -15,4 +15,8 @@ echo -n "Generating index.html... " sed -e "s/{VER}/$VERSION/" -e "s/{BUILD_DATE}/$BUILD_DATE/" index.template.html > index.html echo "Done!" +echo -n "Generating service-worker.js... " +sed -e "s/{VER}/$VERSION/" service-worker.template.js > service-worker.js +echo "Done!" + echo "Build version: $VERSION Build date: $BUILD_DATE" diff --git a/index.template.html b/index.template.html index e24fbe0..8a10079 100644 --- a/index.template.html +++ b/index.template.html @@ -50,7 +50,7 @@ - +
@@ -150,9 +150,9 @@

Contribute

github/sondehub-tracker. Bug reports, suggestions and pull requests are welcome. A huge thanks to RGP for developing the mobile tracker that this site is based on.

- Tracker Revision: + Tracker Revision: {VER}
- Build Date: + Build Date: {BUILD_DATE}

diff --git a/js/app.js b/js/app.js index 8c87e0f..5c16cfc 100644 --- a/js/app.js +++ b/js/app.js @@ -493,10 +493,6 @@ $(window).ready(function() { updateTime(new Date()); }, 1000); - // Update Tracker version info - $('#build_version').text(document.body.dataset.version); - $('#build_date').text(document.body.dataset.buildDate); - // resize elements if needed checkSize(); diff --git a/service-worker.js b/service-worker.template.js similarity index 96% rename from service-worker.js rename to service-worker.template.js index 6416051..e615350 100644 --- a/service-worker.js +++ b/service-worker.template.js @@ -1,6 +1,6 @@ self.addEventListener('install', function(event) { event.waitUntil( - caches.open(document.body.dataset.version).then(function(cache) { + caches.open("{VER}").then(function(cache) { return cache.addAll( [ '/css/base.css',