- fixed problema sull'aggiornamento del service-worker, con iPhone (e non solo) compariva schermata bianca.

This commit is contained in:
Surya Paolo
2024-05-27 17:17:13 +02:00
parent 1a4eec634f
commit 6459aaa4c4
37 changed files with 2257 additions and 2753 deletions

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="18" APP_ID="18"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="17" APP_ID="17"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="18" APP_ID="18"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="17" APP_ID="17"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,5 +1,5 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker_1.0.39.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet
DIRECTORY_SERVER=/var/www/testriso.freeplanet_serverside DIRECTORY_SERVER=/var/www/testriso.freeplanet_serverside

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="15" APP_ID="15"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="15" APP_ID="15"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,6 +1,6 @@
{ {
"name": "fioredellavita", "name": "fioredellavita",
"version": "0.6.1", "version": "1.0.43",
"description": "Fiore Della Vita", "description": "Fiore Della Vita",
"productName": "Fiore Della Vita", "productName": "Fiore Della Vita",
"author": "Paolo Arena", "author": "Paolo Arena",

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="18" APP_ID="18"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="16" APP_ID="16"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,6 +1,6 @@
{ {
"name": "gruppomacro", "name": "gruppomacro",
"version": "0.6.1", "version": "1.0.43",
"description": "Gruppo Macro Editori", "description": "Gruppo Macro Editori",
"productName": "Gruppo Macro", "productName": "Gruppo Macro",
"author": "Paolo Arena", "author": "Paolo Arena",

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="17" APP_ID="17"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="16" APP_ID="16"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,6 +1,6 @@
{ {
"name": "riso", "name": "riso",
"version": "0.6.1", "version": "1.0.43",
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
"productName": "Riso", "productName": "Riso",
"author": "Paolo Arena", "author": "Paolo Arena",

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.37" APP_VERSION="1.0.43"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="14" APP_ID="14"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -19,7 +19,7 @@ npm run buildpwa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' -a --exclude 'upload' dist/pwa/ suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/ sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' -a --exclude 'upload' dist/pwa/ suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' dist/pwa/index.html suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/ rsync -e 'ssh -p 8855' -av --delete dist/pwa/js/ suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -19,6 +19,7 @@ npm run buildpwa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
rsync -e 'ssh -p 8822' -av --delete dist/pwa/js/ pcbuser@pcb:$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -19,6 +19,7 @@ npm run buildpwa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
rsync -e 'ssh -p 8822' -av --delete dist/pwa/js/ pcbuser@pcb:$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -20,6 +20,7 @@ npm run buildpwa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' -a --exclude 'upload' dist/pwa/ ftpadmin@servereng:/var/www/$SERVERDIR_WEBSITE/ sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' -a --exclude 'upload' dist/pwa/ ftpadmin@servereng:/var/www/$SERVERDIR_WEBSITE/
rsync -e 'ssh -p 8855' -av --delete dist/pwa/js/ ftpadmin@servereng:/var/www/$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -19,6 +19,7 @@ npm run buildpwa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
rsync -e 'ssh -p 8822' -av --delete dist/pwa/js/ pcbuser@pcb:$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -19,6 +19,8 @@ npm run buildpwa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
rsync -e 'ssh -p 8822' -av --delete dist/pwa/js/ pcbuser@pcb:$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -20,6 +20,7 @@ npm run buildspa
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..." echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' -a --exclude 'upload' dist/spa/ ftpadmin@servereng:/var/www/$SERVERDIR_WEBSITE/ sshpass -p $SERVERPW_WEBSITE rsync -e 'ssh -p 8855' -a --exclude 'upload' dist/spa/ ftpadmin@servereng:/var/www/$SERVERDIR_WEBSITE/
rsync -e 'ssh -p 8855' -av --delete dist/spa/js/ ftpadmin@servereng:/var/www/$SERVERDIR_WEBSITE/js
cp .env.prod.bak .env.production cp .env.prod.bak .env.production

View File

@@ -1,6 +1,6 @@
{ {
"name": "riso", "name": "riso",
"version": "0.6.1", "version": "1.0.43",
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
"productName": "Riso", "productName": "Riso",
"author": "Paolo Arena", "author": "Paolo Arena",

View File

@@ -1,6 +1,6 @@
{ {
"name": "riso", "name": "riso",
"version": "0.6.1", "version": "1.0.43",
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
"productName": "Riso", "productName": "Riso",
"author": "Paolo Arena", "author": "Paolo Arena",

View File

@@ -1,6 +1,6 @@
{ {
"name": "riso", "name": "riso",
"version": "0.6.1", "version": "1.0.43",
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
"productName": "Riso", "productName": "Riso",
"author": "Paolo Arena", "author": "Paolo Arena",
@@ -27,27 +27,27 @@
"@babel/plugin-proposal-export-namespace-from": "^7.18.9", "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-json-strings": "^7.18.6", "@babel/plugin-proposal-json-strings": "^7.18.6",
"@babel/plugin-proposal-numeric-separator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6",
"@cubejs-client/core": "^0.35.0", "@cubejs-client/core": "^0.35.23",
"@quasar/extras": "^1.16.9", "@quasar/extras": "^1.16.11",
"@quasar/quasar-ui-qcalendar": "^4.0.0-beta.19", "@quasar/quasar-ui-qcalendar": "^4.0.0-beta.19",
"@types/leaflet": "^1.9.8", "@types/leaflet": "^1.9.12",
"@vue/compat": "^3.4.21", "@vue/compat": "^3.4.27",
"@vue/compiler-sfc": "^3.4.21", "@vue/compiler-sfc": "^3.4.27",
"@vue/eslint-config-standard": "^7.0.0", "@vue/eslint-config-standard": "8.0.1",
"@vuelidate/core": "^2.0.3", "@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4", "@vuelidate/validators": "^2.0.4",
"acorn": "^8.11.3", "acorn": "^8.11.3",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"axios": "^1.6.8", "axios": "^1.7.2",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"chart.js": "^4.4.2", "chart.js": "^4.4.3",
"core-js": "^3.36.1", "core-js": "^3.37.1",
"crypto-browserify": "^3.12.0", "crypto-browserify": "^3.12.0",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"echarts": "5.5.0", "echarts": "5.5.0",
"eslint-plugin-n": "^15.0.0", "eslint-plugin-n": "^17.7.0",
"eslint-plugin-quasar": "^1.1.0", "eslint-plugin-quasar": "^1.1.0",
"graphql": "^16.8.1", "graphql": "^16.8.1",
"graphql-tag": "^2.12.6", "graphql-tag": "^2.12.6",
@@ -59,25 +59,25 @@
"localforage": "^1.10.0", "localforage": "^1.10.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"npm": "^10.5.0", "npm": "^10.8.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"prerender-spa-plugin": "^3.4.0", "prerender-spa-plugin": "^3.4.0",
"quasar": "^2.15.1", "quasar": "^2.16.4",
"quasar-extras": "^2.0.9", "quasar-extras": "^2.0.9",
"register-service-worker": "^1.7.2", "register-service-worker": "^1.7.2",
"typescript-eslint": "^7.3.1", "typescript-eslint": "^7.10.0",
"vee-validate": "^4.12.6", "vee-validate": "^4.12.8",
"vue": "^3.4.21", "vue": "^3.4.27",
"vue-class-component": "^8.0.0-rc.1", "vue-class-component": "^8.0.0-rc.1",
"vue-country-code": "^1.1.3", "vue-country-code": "^1.1.3",
"vue-echarts": "^6.6.9", "vue-echarts": "^6.7.2",
"vue-i18n": "^9.10.2", "vue-i18n": "^9.13.1",
"vue-idb": "^0.2.0", "vue-idb": "^0.2.0",
"vue-image-zoomer": "^2.2.3", "vue-image-zoomer": "^2.3.0",
"vue-loader": "^17.4.2", "vue-loader": "^17.4.2",
"vue-property-decorator": "^10.0.0-rc.3", "vue-property-decorator": "^10.0.0-rc.3",
"vue-router": "^4.3.0", "vue-router": "^4.3.2",
"vue-scroll-reveal": "^2.1.0", "vue-scroll-reveal": "^2.1.0",
"vue-social-sharing": "^4.0.0-alpha4", "vue-social-sharing": "^4.0.0-alpha4",
"vue-svgicon": "^4.0.0-alpha.3", "vue-svgicon": "^4.0.0-alpha.3",
@@ -88,45 +88,53 @@
"vuex-router-sync": "^6.0.0-rc.1" "vuex-router-sync": "^6.0.0-rc.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.24.3", "@babel/core": "^7.24.6",
"@quasar/app-webpack": "^3.12.4", "@babel/plugin-proposal-decorators": "^7.24.6",
"@babel/plugin-proposal-function-sent": "^7.24.6",
"@babel/plugin-proposal-throw-expressions": "^7.24.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"@quasar/app-webpack": "^3.13.2",
"@types/bcryptjs": "^2.4.6", "@types/bcryptjs": "^2.4.6",
"@types/dotenv": "^8.2.0", "@types/dotenv": "^8.2.0",
"@types/googlemaps": "^3.43.3", "@types/googlemaps": "^3.43.3",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/js-cookie": "^3.0.6", "@types/js-cookie": "^3.0.6",
"@types/node": "20.11.30", "@types/node": "20.12.12",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/vue-tel-input": "^2.1.6", "@types/vue-tel-input": "^2.1.6",
"@types/vuelidate": "^0.7.21", "@types/vuelidate": "^0.7.21",
"@typescript-eslint/eslint-plugin": "^7.3.1", "@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.3.1", "@typescript-eslint/parser": "^7.10.0",
"eslint": "^8.37.0", "babel-loader": "^9.1.3",
"eslint": "^9.3.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1", "eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^8.7.1", "eslint-plugin-vue": "^9.26.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.0", "html-webpack-plugin": "^5.6.0",
"http-proxy-middleware": "^2.0.6", "http-proxy-middleware": "^3.0.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"node-sass": "^9.0.0", "node-sass": "^9.0.0",
"npm-check-updates": "^16.14.17", "npm-check-updates": "^16.14.20",
"optimize-css-assets-webpack-plugin": "^6.0.1", "optimize-css-assets-webpack-plugin": "^6.0.1",
"parcel": "^2.12.0", "parcel": "^2.12.0",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"postcss-loader": "^8.1.1", "postcss-loader": "^8.1.1",
"sass-loader": "^14.1.1", "sass-loader": "^14.2.1",
"strip-ansi": "=7.1.0", "strip-ansi": "=7.1.0",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.3",
"ts-loader": "^9.5.1", "ts-loader": "^9.5.1",
"typescript": "5.3.2", "typescript": "5.4.5",
"vue-cli-plugin-element-ui": "^1.1.4", "vue-cli-plugin-element-ui": "^1.1.4",
"vueify": "^9.4.1", "vueify": "^9.4.1",
"webpack": "^5.91.0", "webpack": "^5.91.0",
"workbox-webpack-plugin": "^6.5.4" "workbox-webpack-plugin": "6.5.4"
}, },
"browser": { "browser": {
"crypto": false "crypto": false
@@ -145,7 +153,7 @@
"not dead" "not dead"
], ],
"engines": { "engines": {
"node": ">= 18.18.0", "node": "^20 || ^18 || ^16",
"npm": ">= 6.14.8", "npm": ">= 6.14.8",
"yarn": ">= 1.21.1" "yarn": ">= 1.21.1"
} }

View File

@@ -17,6 +17,8 @@ const webpack = require('webpack')
const helpers = require('./helpers') const helpers = require('./helpers')
const envparser = require('./config/envparser') const envparser = require('./config/envparser')
const package = require('./package.json');
// const ESLintPlugin = require('eslint-webpack-plugin') // const ESLintPlugin = require('eslint-webpack-plugin')
module.exports = configure((ctx) => ({ module.exports = configure((ctx) => ({
@@ -87,6 +89,7 @@ module.exports = configure((ctx) => ({
// Full list of options: https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build // Full list of options: https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build
build: { build: {
env: envparser(), env: envparser(),
versionCode: package.version,
vueRouterMode: 'history', vueRouterMode: 'history',
vueCompiler: true, vueCompiler: true,
gzip: false, // gzip true gzip: false, // gzip true

View File

@@ -5,4 +5,5 @@ source .env.test.risosrv
echo "Sincronizzazione in remoto $SERVERDIR_WEBSITE ..." echo "Sincronizzazione in remoto $SERVERDIR_WEBSITE ..."
echo "SERVERDIR_WEBSITE = $SERVERDIR_WEBSITE" echo "SERVERDIR_WEBSITE = $SERVERDIR_WEBSITE"
rsync -e 'ssh -p 8822' -a --exclude 'upload' dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE rsync -e 'ssh -p 8822' -a --exclude 'upload' dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
rsync -e 'ssh -p 8822' -av --delete dist/pwa/js/ pcbuser@pcb:$SERVERDIR_WEBSITE/js
echo "Finito $SERVERDIR_WEBSITE" echo "Finito $SERVERDIR_WEBSITE"

View File

@@ -1,667 +1,296 @@
import { cleanupOutdatedCaches, precacheAndRoute } from 'workbox-precaching' importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.5.4/workbox-sw.js');
import { registerRoute } from 'workbox-routing'
import { clientsClaim, setCacheNameDetails, skipWaiting } from 'workbox-core'
import { cleanupOutdatedCaches, precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { clientsClaim, setCacheNameDetails, skipWaiting } from 'workbox-core';
import { import {
NetworkFirst, NetworkFirst,
NetworkOnly, NetworkOnly,
StaleWhileRevalidate, StaleWhileRevalidate,
CacheFirst, CacheFirst,
} from 'workbox-strategies' } from 'workbox-strategies';
const ENABLE_DYNAMIC_CACHING = false; const ENABLE_DYNAMIC_CACHING = false;
import { CacheableResponsePlugin } from 'workbox-cacheable-response';
// Used for filtering matches based on status code, header, or both import { ExpirationPlugin } from 'workbox-expiration';
import { CacheableResponsePlugin } from 'workbox-cacheable-response'
// Used to limit entries in cache, remove entries after a certain period of time
import { ExpirationPlugin } from 'workbox-expiration'
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
self.addEventListener('install', () => {
self.skipWaiting();
});
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (event) => { self.addEventListener('activate', (event) => {
event.waitUntil(self.clients.claim()); // console.log('CLAIM');
//event.waitUntil(self.clients.claim())
event.waitUntil(async () => {
// Check for a new service worker version
const registration = await navigator.serviceWorker.getRegistration();
if (registration && registration.waiting) {
// A new service worker is waiting, trigger a page reload
await registration.waiting.postMessage({ type: 'SKIP_WAITING' });
self.skipWaiting();
}
});
}); });
console.log( const VersioneApp = '1.0.42';
' [ VER-0.5.4 ] _---------________------ PAO: this is my custom service worker')
importScripts('js/idb.js')
importScripts('js/storage.js')
importScripts('js/workbox-sw.js')
// importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.4/workbox-sw.js');
console.log(' [ VER-' + VersioneApp + ' ] _---------________------ PAO: this is my custom service worker');
// importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.0.0/workbox-sw.js'); importScripts('js/idb.js', 'js/storage.js');
// importScripts('./ChabokSDKWorker.js', 'https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js'); let port = self.location.hostname.startsWith('test') ? 3001 : 3000;
console.log('SW- app ver ' + VersioneApp + ' on port ' + port);
let port = 3000
if (self.location.hostname.startsWith('test')) {
port = 3001
}
console.log('SW- app ver 1.0.21')
const cfgenv = {
serverweb: `${self.location.protocol}//${self.location.hostname}:${port}`,
dbname: 'mydb3',
dbversion: 11,
}
// console.log('serverweb', cfgenv.serverweb)
// Function helpers
async function writeData(table, data) { async function writeData(table, data) {
console.log('writeData', table, data); console.log('writeData', table, data);
await idbKeyval.setdata(table, data) await idbKeyval.setdata(table, data);
} }
async function readAllData(table) { async function readAllData(table) {
// console.log('readAllData', table); return idbKeyval.getalldata(table);
return idbKeyval.getalldata(table)
} }
async function clearAllData(table) { async function clearAllData(table) {
// console.log('clearAllData', table); await idbKeyval.clearalldata(table);
await idbKeyval.clearalldata(table)
} }
async function deleteItemFromData(table, id) { async function deleteItemFromData(table, id) {
// console.log('deleteItemFromData', table, 'ID:', id); await idbKeyval.deletedata(table, id);
await idbKeyval.deletedata(table, id)
}
// self.addEventListener('activate', function(event) {
// event.waitUntil(
// // createDB()
// );
// });
if (!workbox) {
const workbox = new self.WorkboxSW()
} }
if (workbox) { if (workbox) {
const debug = false const debug = false;
workbox.setConfig({ debug }) workbox.setConfig({ debug });
const precacheList = self.__WB_MANIFEST || []; const precacheList = self.__WB_MANIFEST || [];
setCacheNameDetails({ setCacheNameDetails({
prefix: self.location.hostname, prefix: self.location.hostname,
suffix: 'v1', suffix: 'v1',
precache: 'precache', precache: 'precache',
runtime: 'runtime' runtime: 'runtime',
}) });
// clientsClaim() precacheAndRoute(precacheList);
// skipWaiting()
precacheAndRoute(precacheList)
// cleanupOutdatedCaches()
// Cache strategy registrations
registerRoute( registerRoute(
new RegExp(/\.(?:png|gif|jpg|jpeg)$/), new RegExp(/\.(?:png|gif|jpg|jpeg)$/),
new CacheFirst({ new CacheFirst({
cacheName: 'images-upload', cacheName: 'images-upload',
plugins: [ plugins: [
// Ensure that only requests that result in a 200 status are cached new CacheableResponsePlugin({ statuses: [200] }),
new CacheableResponsePlugin({ new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
statuses: [200],
}),
new ExpirationPlugin({
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
}),
], ],
}), })
) );
registerRoute( registerRoute(
new RegExp(/\.(?:svg)$/), new RegExp(/\.(?:svg)$/),
new CacheFirst({ new CacheFirst({
cacheName: 'svg', cacheName: 'svg',
plugins: [ plugins: [
// Ensure that only requests that result in a 200 status are cached new CacheableResponsePlugin({ statuses: [200] }),
new CacheableResponsePlugin({ new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
statuses: [200],
}),
new ExpirationPlugin({
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
}),
],
}),
)
/*
// Per Articoli....
const articleHandler = new NetworkFirst({
cacheName: 'articles-cache',
plugins: [
// Ensure that only requests that result in a 200 status are cached
new CacheableResponsePlugin({
statuses: [200],
}),
new ExpirationPlugin({
maxEntries: 50,
}),
], ],
}) })
);
registerRoute(
new RegExp(/(.*)article(.*)\.html/), args => articleHandler.handle(args),
) */
registerRoute( registerRoute(
new RegExp(/.*(?:googleapis|gstatic)\.com.*$/), new RegExp(/.*(?:googleapis|gstatic)\.com.*$/),
new StaleWhileRevalidate({ new StaleWhileRevalidate({
cacheName: 'google-fonts', cacheName: 'google-fonts',
plugins: [ plugins: [
// Ensure that only requests that result in a 200 status are cached new CacheableResponsePlugin({ statuses: [200] }),
new CacheableResponsePlugin({ new ExpirationPlugin({ maxEntries: 30 }),
statuses: [200],
}),
new ExpirationPlugin({
maxEntries: 30,
}),
], ],
}),
)
// console.log(' routing.registerRoute function declaration:')
function Execute_Fetch(table, args) {
console.log('Execute_Fetch registerRoute! ',
`${cfgenv.serverweb}/${table}/`)
// console.log('DATABODY:', args.event.request.body)
let myres = null
// return fetch(args.event.request, args.event.headers)
return fetch(args.event.request, args.event.headers)
.then((res) => {
myres = res
if (res.status === 200) {
const clonedRes = res.clone()
let secondatab = ''
if (table === 'todos') {
secondatab = 'categories'
}
console.log('1) clearAllData: ', table)
return clearAllData(table)
.then(() => {
if (secondatab !== '') {
// console.log('2) clearAllData(todos)')
return clearAllData(secondatab)
.then(() =>
// console.log('3) ....return clonedRes')
clonedRes)
}
return clonedRes
}) })
} );
})
.then((clonedRes) => {
// console.log(' 3) ')
if (clonedRes) return clonedRes.json()
return null
})
.then(data => {
// console.log(' 4) data = ', data)
if (data) {
const myarr = idbKeyval.getArrayByTable(table, data)
if (myarr) {
let promiseChain = Promise.resolve()
console.log('*********+++++++++++++++++********** Records ',
`${table} Received from Server [`, myarr.length, 'record]', myarr)
if (table === 'todos') {
for (const cat in data.categories) {
promiseChain = promiseChain.then(() => writeData('categories', {
_id: cat,
valore: data.categories[cat],
}))
}
for (const arrsing of myarr) {
for (const rec of arrsing) {
promiseChain = promiseChain.then(() => writeData(table, rec))
}
}
} else {
// Others tables
for (const rec of myarr) {
promiseChain = promiseChain.then(() => writeData(table, rec))
}
}
// console.log('promiseChain', promiseChain)
return promiseChain
}
}
})
.then(() => myres)
.catch(err => {
console.log('ERROR registerRoute FETCH:', err)
return myres
})
}
for (const table of MainTables) {
registerRoute(
new RegExp(`${cfgenv.serverweb}/${table}/`),
(args) => {
Execute_Fetch(table, args)
},
)
}
registerRoute(
(routeData) => (routeData.event.request.headers.get('accept')
.includes('text/html')), (args) => caches.match(args.event.request)
.then((response) => {
if (response) {
return response
}
return fetch(args.event.request)
.then((res) => caches.open('dynamic')
.then((cache) => {
console.log('fetch cache')
console.log('cache', args.event.request.url)
cache.put(args.event.request.url, res.clone())
return res
}))
.catch((err) => caches.match('/offline')
.then((res) => res))
}),
)
registerRoute( registerRoute(
new RegExp(/.*\/(?:icons).*$/), new RegExp(/.*\/(?:icons).*$/),
new CacheFirst({ new CacheFirst({
cacheName: 'icon-cache', cacheName: 'icon-cache',
plugins: [ plugins: [
// Ensure that only requests that result in a 200 status are cached new CacheableResponsePlugin({ statuses: [200] }),
new CacheableResponsePlugin({ new ExpirationPlugin({ maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
statuses: [200],
}),
new ExpirationPlugin({
maxAgeSeconds: 30 * 24 * 60 * 60,
}),
], ],
}), })
) );
registerRoute( registerRoute(
new RegExp(/\.(?:js|css|font)$/), new RegExp(/\.(?:js|css|font)$/),
new StaleWhileRevalidate({ new StaleWhileRevalidate({
cacheName: 'js-css-fonts', cacheName: 'js-css-fonts',
// Ensure that only requests that result in a 200 status are cached
plugins: [ plugins: [
new CacheableResponsePlugin({ new CacheableResponsePlugin({ statuses: [200] }),
statuses: [200],
}),
], ],
}), })
) );
// Storage
registerRoute(
new RegExp(/.*(?:storage)/),
new StaleWhileRevalidate({
cacheName: 'storage',
plugins: [
// Ensure that only requests that result in a 200 status are cached
new CacheableResponsePlugin({
statuses: [200],
}),
new ExpirationPlugin({
maxAgeSeconds: 30 * 24 * 60 * 60,
// Only cache 10 requests.
maxEntries: 200,
}),
],
}),
)
registerRoute( registerRoute(
new RegExp(/.*\/(?:public).*$/), (routeData) => routeData.event.request.headers.get('accept').includes('text/html'),
new CacheFirst({ async (args) => {
cacheName: 'public', let response = await caches.match(args.event.request);
plugins: [ if (response) return response;
// Ensure that only requests that result in a 200 status are cached
new CacheableResponsePlugin({
statuses: [200],
}),
new ExpirationPlugin({
maxAgeSeconds: 10 * 24 * 60 * 60,
// Only cache 10 requests.
}),
],
}),
)
registerRoute(
new RegExp('/admin/'),
new NetworkOnly(),
)
/*registerRoute(
new RegExp('/owa/'),
new NetworkOnly(),
)
*/
try {
response = await fetch(args.event.request);
const cache = await caches.open('dynamic');
cache.put(args.event.request.url, response.clone());
return response;
} catch (err) {
return caches.match('/offline');
} }
if ('serviceWorker' in navigator) {
// console.log('***************** Entering in custom-service-worker.js:')
} }
);
/* self.addEventListener('fetch', (event) => { registerRoute(new RegExp('/admin/'), new NetworkOnly());
if (event.request.url === '/') {
const StaleWhileRevalidate = new StaleWhileRevalidate(); const syncStore = {};
event.respondWith(StaleWhileRevalidate.handle({ event })); self.addEventListener('message', event => {
if (event.data && (event.data.type === 'SKIP_WAITING' || event.data.action === 'skipWaiting')) {
window.location.reload();
} }
if (event.data.type === 'sync') {
console.log('addEventListener - message');
const id = uuid();
syncStore[id] = event.data;
self.registration.sync.register(id);
}
console.log(event.data);
}); });
*/ self.addEventListener('fetch', (event) => {
if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') return;
self.addEventListener('fetch', function (event) { event.respondWith(async () => {
console.log('[Service Worker] Fetching something ....', event); let cachedResponse = await caches.match(event.request);
console.log('event.request.cache=', event.request.cache) if (cachedResponse) return cachedResponse;
if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') {
console.log('SAME ORIGIN!', event);
return;
}
event.respondWith((async () => {
const cachedResponse = await caches.match(event.request);
if (cachedResponse) {
return cachedResponse;
}
console.log('*** REQUEST', event.request);
try { try {
const response = await fetch(event.request); const response = await fetch(event.request);
if (!response || response.status !== 200 || response.type !== 'basic') return response;
if (!response || response.status !== 200 || response.type !== 'basic') {
return response;
}
if (ENABLE_DYNAMIC_CACHING) { if (ENABLE_DYNAMIC_CACHING) {
const responseToCache = response.clone(); const cache = await caches.open(DYNAMIC_CACHE);
const cache = await caches.open(DYNAMIC_CACHE) cache.put(event.request, response.clone());
await cache.put(event.request, response.clone());
} }
return response; return response;
} catch (e) { } catch (e) {
return ''; return '';
} }
})()); });
}); });
self.addEventListener('sync', event => {
const syncStore = {}
self.addEventListener('message', event => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting()
}
if (event.data.type === 'sync') {
console.log('addEventListener - message')
// get a unique id to save the data
const id = uuid()
syncStore[id] = event.data
// register a sync and pass the id as tag for it to get the data
self.registration.sync.register(id)
console.log('self.registration.sync.register(id)')
}
console.log(event.data)
})
addEventListener('fetch', event => {
// Prevent the default, and handle the request ourselves.
event.respondWith(async function () {
// Try to get the response from a cache.
const cachedResponse = await caches.match(event.request);
// Return it if we found one.
if (cachedResponse && (event.request.cache !== 'no-cache'))
return cachedResponse;
// If we didn't find a match in the cache, use the network.
return fetch(event.request);
}());
});
self.addEventListener('fetch', function (event) {
event.respondWith(
fetch(event.request, event.headers)
.catch(err => {
console.log('_______________________ ERRORE FETCH SW: ', event.request, err)
writeData('config', { _id: 2, stateconn: 'offline' })
return caches.match(event.request);
})
);
});
self.addEventListener('sync', function (event) {
console.log('[Service Worker V5] Background syncing', event); console.log('[Service Worker V5] Background syncing', event);
console.log('event:', event);
let mystrparam = event.tag let mystrparam = event.tag;
let multiparams = mystrparam.split('|') let multiparams = mystrparam.split('|');
if (multiparams) { if (multiparams && multiparams.length > 3) {
if (multiparams.length > 3) { let [cmd, table, method, token, refreshToken] = multiparams;
let cmd = multiparams[0]
let table = multiparams[1]
let method = multiparams[2]
let token = multiparams[3]
let refreshToken = multiparams[4]
// let lang = multiparams[3]
if (cmd === 'sync-todos') { if (cmd === 'sync-todos') {
console.log('[Service Worker] Syncing', cmd, table, method); console.log('[Service Worker] Syncing', cmd, table, method);
const headers = new Headers() const headers = new Headers();
headers.append('content-Type', 'application/json') headers.append('content-Type', 'application/json');
headers.append('Accept', 'application/json') headers.append('Accept', 'application/json');
headers.append('x-auth', token) headers.append('x-auth', token);
headers.append('x-refrtok', refreshToken) headers.append('x-refrtok', refreshToken);
// console.log('A1) INIZIO.............................................................');
event.waitUntil( event.waitUntil(
readAllData(table) readAllData(table).then(alldata => {
.then(function (alldata) { const myrecs = [...alldata];
const myrecs = [...alldata] let errorfromserver = false;
console.log('----------------------- LEGGO QUALCOSA DAL WAITUNTIL ')
let errorfromserver = false
if (myrecs) { if (myrecs) {
let promiseChain = Promise.resolve();
for (let rec of myrecs) { for (let rec of myrecs) {
//console.log('syncing', table, '', rec.descr) let link = cfgenv.serverweb + '/todos';
let link = cfgenv.serverweb + '/todos' if (method !== 'POST') link += '/' + rec._id;
if (method !== 'POST') promiseChain = promiseChain.then(() =>
link += '/' + rec._id
console.log('++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
// console.log('DATATOSAVE:', JSON.stringify(rec))
// Insert/Delete/Update table to the server
fetch(link, { fetch(link, {
method: method, method: method,
headers: headers, headers: headers,
cache: 'no-cache', cache: 'no-cache',
mode: 'cors', // 'no-cors', mode: 'cors',
body: JSON.stringify(rec) body: JSON.stringify(rec),
}).then(() => {
deleteItemFromData(table, rec._id);
deleteItemFromData('swmsg', mystrparam);
}) })
.then(() => { .catch(err => {
deleteItemFromData(table, rec._id)
})
.then(() => {
deleteItemFromData('swmsg', mystrparam)
})
.catch(function (err) {
console.log('!!!!!!!!!!!!!!! Error while sending data', err, err.message);
if (err.message === 'Failed to fetch') { if (err.message === 'Failed to fetch') {
errorfromserver = true errorfromserver = true;
} }
}) })
}
return errorfromserver
}
})
.then((errorfromserver) => {
const mystate = !errorfromserver ? 'online' : 'offline'
writeData('config', { _id: 2, stateconn: mystate })
})
); );
// console.log('A2) ?????????????????????????? ESCO DAL LOOP !!!!!!!!! err=')
}
} }
return promiseChain.then(() => {
const mystate = !errorfromserver ? 'online' : 'offline';
writeData('config', { _id: 2, stateconn: mystate });
});
} }
}) })
; );
/*
// send message to serviceWorker
function sync (url, options) {
navigator.serviceWorker.controller.postMessage({type: 'sync', url, options})
} }
const syncStore = {}
self.addEventListener('message', event => {
if(event.data.type === 'sync') {
// get a unique id to save the data
const id = uuid()
syncStore[id] = event.data
// register a sync and pass the id as tag for it to get the data
self.registration.sync.register(id)
} }
console.log(event.data) });
})
self.addEventListener('sync', event => {
// get the data by tag
const {url, options} = syncStore[event.tag]
event.waitUntil(fetch(url, options))
})
*/
// Notifications
self.addEventListener('notificationclick', (event) => { self.addEventListener('notificationclick', (event) => {
const { notification } = event const { notification } = event;
const { action } = event const { action } = event;
console.log(notification)
if (action === 'confirm') { if (action === 'confirm') {
console.log('Confirm was chosen') notification.close();
notification.close()
} else { } else {
console.log(action)
event.waitUntil( event.waitUntil(
clients.matchAll() clients.matchAll().then((clis) => {
.then((clis) => { const client = clis.find((c) => c.visibilityState === 'visible');
const client = clis.find((c) => c.visibilityState === 'visible')
if (client) { if (client) {
client.navigate(notification.data.url) client.navigate(notification.data.url);
client.focus() client.focus();
} else { } else {
clients.openWindow(notification.data.url) clients.openWindow(notification.data.url);
} }
notification.close() notification.close();
}), }),
) );
} }
}) });
self.addEventListener('notificationclose', (event) => { self.addEventListener('notificationclose', (event) => {
console.log('Notification was closed', event) console.log('Notification was closed', event);
}) });
self.addEventListener('push', (event) => { self.addEventListener('push', (event) => {
console.log('Push Notification received', event) console.log('Push Notification received', event);
let data = event.data ? event.data.json() : { title: 'New!', content: 'Something new happened!', url: '/' };
let data = { const options = {
title: 'New!',
content: 'Something new happened!',
url: '/',
}
try {
let isobj = false
if (event.data) {
try {
data = JSON.parse(event.data.text())
isobj = true
} catch (e) {
data = event.data.text()
}
}
console.log('event.data', data)
let options = {}
let myid = '0'
if (isobj) {
if (data.id) {
myid = data.id
}
options = {
body: data.content, body: data.content,
icon: data.icon ? data.icon : '/images/android-chrome-192x192.png', icon: data.icon ? data.icon : '/images/android-chrome-192x192.png',
badge: data.badge ? data.badge : '/images/badge-96x96.png', badge: data.badge ? data.badge : '/images/badge-96x96.png',
data: { data: { url: data.url },
url: data.url,
},
tag: data.tag, tag: data.tag,
renitify: true, // vibrate also with others messages. };
}
event.waitUntil( event.waitUntil(self.registration.showNotification(data.title, options));
self.registration.showNotification(data.title ? data.title : data.content, options),
) const myid = data.id || '0';
self.registration.sync.register(myid);
writeData('notifications', { _id: myid, tag: options.tag });
});
} else { } else {
let text = data; console.warn('Workbox could not be loaded.');
options = {
body: text,
icon: '/images/android-chrome-192x192.png',
badge: '/images/badge-96x96.png',
data: {
url: '/',
},
tag: 'notif',
renitify: true, // vibrate also with others messages.
} }
event.waitUntil(
self.registration.showNotification('', options),
)
}
self.registration.sync.register(myid)
writeData('notifications', { _id: myid, tag: options.tag })
} catch (e) {
console.log('Error on event push:', e)
}
})

View File

@@ -1,20 +1,32 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><%= productName %></title> <title>
<%= productName %>
</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="description" content="<%= productDescription %>"> <meta name="description" content="<%= productDescription %>">
<meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no"> <meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>"> <meta name="version" content="1.0.43">
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
<!-- Aggiungi le intestazioni di controllo della cache -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
<link rel="icon" type="image/ico" href="favicon.ico"> <link rel="icon" type="image/ico" href="favicon.ico">
</head> </head>
<body> <body>
<!-- DO NOT touch the following DIV --> <!-- DO NOT touch the following DIV -->
<div id="q-app"></div> <div id="q-app"></div>
</body> </body>
</html> </html>

4078
yarn.lock

File diff suppressed because it is too large Load Diff