Skip to content

Commit

Permalink
project V2 closed!
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreaubert committed Jul 7, 2024
1 parent 3b313f5 commit ed216f8
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 24 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Spinorama : a library to display speaker frequency response and similar graphs

![image](https://github.com/pierreaubert/spinorama/workflows/Spinorama/badge.svg?branch=master)
![image](https://github.com/pierreaubert/spinorama/workflows/pythonapp.yml/badge.svg?branch=develop&event=push)
![image](https://github.com/pierreaubert/spinorama/workflows/webappapp.yml/badge.svg?branch=develop&event=push)
[![DeepSource](https://deepsource.io/gh/pierreaubert/spinorama.svg/?label=active+issues&show_trend=true)](https://deepsource.io/gh/pierreaubert/spinorama/?ref=repository-badge)
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://gitHub.com/pierreaubert/spinorama/graphs/commit-activity)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"fuse.js": "^7.0.0",
"handlebars": "^4.7.8",
"npm": "^10.7.0",
"plotly.js-dist-min": "^2.32.0",
"plotly.js-dist-min": "^2.33.0",
"workbox-cli": "^7.1.0",
"workbox-window": "^7.1.0"
},
Expand Down
1 change: 0 additions & 1 deletion scripts/update_prod.sh → scripts/update_prod_ch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

[email protected]:/var/www/html/spinorama-prod
[email protected]:/var/www/html/spinorama-prod
[email protected]:/var/www/html/spinorama-prod
[email protected]:/var/www/html/spinorama-prod

Expand Down
43 changes: 43 additions & 0 deletions scripts/update_prod_es.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
# A library to display spinorama charts
#
# Copyright (C) 2020-2024 Pierre Aubert pierre(at)spinorama(dot)org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

[email protected]:/var/www/html/spinorama-prod

# check
command=$(grep dev.spinorama.org docs/*.html | wc -l)
if [ "${command}" -ne 0 ]; then
echo "KO found DEV url in PROD site"
exit 1;
else
echo "OK checking for DEV site in PROD"
fi
command=$(grep spinorama.internet-box.ch docs/*.html | wc -l)
if [ "${command}" -ne 0 ]; then
echo "KO found old dev url in prod site"
exit 1;
else
echo "OK checking for dev site in prod"
fi

# copy
echo "Sync starts:"
for target in "$TARGET2"; do
rsync -avrz --exclude '*.png' --delete ./docs/* "$target"
rsync -arvz --include '*.png' --delete ./docs/pictures/* "$target/pictures"
rsync -arvz --include '*.png' --delete ./docs/help_pictures/* "$target/help_pictures"
done
39 changes: 19 additions & 20 deletions src/website/head_sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,38 @@ import { Workbox } from "/js3rd/workbox-window-${versions['WORKBOX']}${min}.js";

function matchOldJS(names) {
if (names.length > 0) {
const name = names[0];
const js = name.match(/\/js\/[a-z]*.min.js/);
const v4 = name.match(/-v4-/);
// js file and v4 not in the name
if (js.length === 1 && v4.length !== 1) {
return true;
}
const name = names[0];
const js = name.match(/\/js\/[a-z]*.min.js/);
const v4 = name.match(/-v4-/);
// js file and v4 not in the name
if (js.length === 1 && v4.length !== 1) {
return true;
}
}
return false;
}

function cleanupCache() {
caches.keys().then( name => {
// not correct
if (matchOldJS(name)) {
console.debug('cleanup caches for entry: '+name);
caches.delete(name);
}
})
caches.keys().then((name) => {
// not correct
if (matchOldJS(name)) {
console.debug('cleanup caches for entry: ' + name);
caches.delete(name);
}
});
}

if ('serviceWorker' in navigator) {

const wb = new Workbox('/sw.js');

wb.addEventListener('install', (event) => {
console.log('sw install');
console.log('sw install');
self.skipWaiting();
cleanupCache();
cleanupCache();
});

wb.addEventListener('activate', (event) => {
console.log('sw activate');
console.log('sw activate');
self.clients
.matchAll({
type: 'window',
Expand All @@ -47,7 +46,7 @@ if ('serviceWorker' in navigator) {
if (!event.isUpdate) {
console.log('Service worker activated for the first time!');
} else {
}
}
});

wb.addEventListener('waiting', () => {
Expand All @@ -58,7 +57,7 @@ if ('serviceWorker' in navigator) {
});

wb.addEventListener('message', (event) => {
console.log('sw message');
console.log('sw message');
if (event.data.type === 'CACHE_UPDATED') {
const { updatedURL } = event.data.payload;
console.log('A newer version of ' + updatedURL + ' is available!');
Expand Down

0 comments on commit ed216f8

Please sign in to comment.