- fix: nModified è stato sostituito con modifiedCount
- .ok con .acknowledged - coretto la chiamata per il REFRESH TOKEN !
This commit is contained in:
4
.env
4
.env
@@ -1,6 +1,6 @@
|
||||
VITE_APP_VERSION="1.2.18"
|
||||
VITE_APP_VERSION="1.2.19"
|
||||
VITE_LANG_DEFAULT="it"
|
||||
VITE_PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
|
||||
VITE_SERVICE_WORKER_FILE="sw-1.2.18.js"
|
||||
VITE_SERVICE_WORKER_FILE="sw-1.2.19.js"
|
||||
VITE_PROJECT_ID_MAIN="5cc0a13fe5c9d156728f400a"
|
||||
VITE_VUE_ROUTER_MODE="history"
|
||||
@@ -10,7 +10,7 @@
|
||||
<meta name="description" content="<%= productDescription %>">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="version" content="1.2.18">
|
||||
<meta name="version" content="1.2.19">
|
||||
<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<% } %>">
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "riso",
|
||||
"version": "1.2.18",
|
||||
"version": "1.2.19",
|
||||
"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",
|
||||
"author": "Surya",
|
||||
|
||||
@@ -366,9 +366,10 @@ export default defineConfig((ctx) => {
|
||||
// https://v2.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
|
||||
pwa: {
|
||||
workboxMode: 'InjectManifest', // 'GenerateSW' or 'InjectManifest'
|
||||
swFilename: 'sw-' + "1.2.18" + '.js',
|
||||
swFilename: 'sw-' + "1.2.19" + '.js',
|
||||
workboxOptions: {
|
||||
swSrc: 'src-pwa/custom-service-worker.js', // Assicurati che il file esista
|
||||
include: [/\.html$/, /\.js$/, /\.css$/, /\.png$/, /\.svg$/, /\.json$/], // File da precacheare
|
||||
},
|
||||
/*extendGenerateSWOptions(cfg) {
|
||||
cfg.skipWaiting = false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "riso",
|
||||
"version": "1.2.18",
|
||||
"version": "1.2.19",
|
||||
"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",
|
||||
"author": "Surya",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gruppomacro",
|
||||
"version": "1.2.18",
|
||||
"version": "1.2.19",
|
||||
"description": "Gruppo Macro",
|
||||
"productName": "Gruppo Macro",
|
||||
"author": "Surya",
|
||||
|
||||
@@ -360,9 +360,10 @@ export default defineConfig((ctx) => {
|
||||
|
||||
pwa: {
|
||||
workboxMode: 'InjectManifest', // 'GenerateSW' or 'InjectManifest'
|
||||
swFilename: 'sw-' + "1.2.18" + '.js',
|
||||
swFilename: 'sw-' + "1.2.19" + '.js',
|
||||
workboxOptions: {
|
||||
swSrc: 'src-pwa/custom-service-worker.js', // Assicurati che il file esista
|
||||
include: [/\.html$/, /\.js$/, /\.css$/, /\.png$/, /\.svg$/, /\.json$/], // File da precacheare
|
||||
},
|
||||
/*extendGenerateSWOptions(cfg) {
|
||||
cfg.skipWaiting = false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "piuchebuono",
|
||||
"version": "1.2.18",
|
||||
"version": "1.2.19",
|
||||
"description": "PiuCheBuono",
|
||||
"productName": "PiuCheBuono",
|
||||
"author": "Surya",
|
||||
|
||||
@@ -360,9 +360,10 @@ export default defineConfig((ctx) => {
|
||||
|
||||
pwa: {
|
||||
workboxMode: 'InjectManifest', // 'GenerateSW' or 'InjectManifest'
|
||||
swFilename: 'sw-' + "1.2.18" + '.js',
|
||||
swFilename: 'sw-' + "1.2.19" + '.js',
|
||||
workboxOptions: {
|
||||
swSrc: 'src-pwa/custom-service-worker.js', // Assicurati che il file esista
|
||||
include: [/\.html$/, /\.js$/, /\.css$/, /\.png$/, /\.svg$/, /\.json$/], // File da precacheare
|
||||
},
|
||||
/*extendGenerateSWOptions(cfg) {
|
||||
cfg.skipWaiting = false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "riso",
|
||||
"version": "1.2.18",
|
||||
"version": "1.2.19",
|
||||
"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",
|
||||
"author": "Surya",
|
||||
|
||||
@@ -366,9 +366,10 @@ export default defineConfig((ctx) => {
|
||||
// https://v2.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
|
||||
pwa: {
|
||||
workboxMode: 'InjectManifest', // 'GenerateSW' or 'InjectManifest'
|
||||
swFilename: 'sw-' + "1.2.18" + '.js',
|
||||
swFilename: 'sw-' + "1.2.19" + '.js',
|
||||
workboxOptions: {
|
||||
swSrc: 'src-pwa/custom-service-worker.js', // Assicurati che il file esista
|
||||
include: [/\.html$/, /\.js$/, /\.css$/, /\.png$/, /\.svg$/, /\.json$/], // File da precacheare
|
||||
},
|
||||
/*extendGenerateSWOptions(cfg) {
|
||||
cfg.skipWaiting = false
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
/* global workbox */
|
||||
/* global cfgenv */
|
||||
|
||||
const CACHE_NAME = 'pwa-cache-v2'; // Nome della cache
|
||||
const VITE_APP_VERSION = "1.2.19";
|
||||
|
||||
const ORA = "12.57"
|
||||
const CACHE_NAME = 'pwa-cache-' + VITE_APP_VERSION; // Nome della cache
|
||||
|
||||
importScripts('workbox/workbox-sw.js')
|
||||
|
||||
@@ -31,7 +31,7 @@ if (workbox) {
|
||||
|
||||
workbox.loadModule('workbox-strategies');
|
||||
|
||||
console.log('Workbox ESISTE ✅ ' + ORA);
|
||||
console.log('Workbox ESISTE ✅ ');
|
||||
|
||||
} else {
|
||||
console.error('Workbox NON CARICATO ! ❌');
|
||||
@@ -73,16 +73,15 @@ self.addEventListener('activate', (event) => {
|
||||
caches.keys().then((cacheNames) => {
|
||||
return Promise.all(
|
||||
cacheNames
|
||||
.filter((name) => name !== CACHE_NAME)
|
||||
.filter(name => name !== CACHE_NAME && name !== DYNAMIC_CACHE)
|
||||
.map((name) => caches.delete(name))
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
const VITE_APP_VERSION = "1.2.18";
|
||||
|
||||
console.log(' [ VER-' + VITE_APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker: ' + ORA);
|
||||
console.log(' [ VER-' + VITE_APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker: ');
|
||||
|
||||
try {
|
||||
importScripts('/js/idb.js', '/js/storage.js');
|
||||
@@ -127,6 +126,12 @@ if (workbox) {
|
||||
)
|
||||
}*/
|
||||
|
||||
// Gestione richieste statiche
|
||||
registerRoute(
|
||||
({ request }) => request.destination === 'document' || request.destination === 'script' || request.destination === 'style',
|
||||
new StaleWhileRevalidate({ cacheName: CACHE_NAME })
|
||||
);
|
||||
|
||||
// Cache strategy registrations
|
||||
registerRoute(
|
||||
new RegExp(/\.(?:png|gif|jpg|jpeg)$/),
|
||||
@@ -182,7 +187,13 @@ if (workbox) {
|
||||
})
|
||||
);
|
||||
|
||||
// Gestione API
|
||||
registerRoute(
|
||||
({ url }) => url.hostname === API_DOMAIN,
|
||||
new NetworkOnly({ fetchOptions: { credentials: 'include' } })
|
||||
);
|
||||
|
||||
/*registerRoute(
|
||||
(routeData) => routeData.event.request.headers.get('accept').includes('text/html'),
|
||||
async (args) => {
|
||||
let response = await caches.match(args.event.request);
|
||||
@@ -197,7 +208,7 @@ if (workbox) {
|
||||
return caches.match('/offline');
|
||||
}
|
||||
}
|
||||
);
|
||||
);*/
|
||||
|
||||
registerRoute(new RegExp('/admin/'), new NetworkOnly());
|
||||
|
||||
@@ -268,7 +279,6 @@ if (workbox) {
|
||||
method: request.method,
|
||||
headers: {
|
||||
...Object.fromEntries(request.headers.entries()),
|
||||
'Origin': `https://${APP_DOMAIN}`,
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
mode: 'cors',
|
||||
@@ -278,13 +288,15 @@ if (workbox) {
|
||||
try {
|
||||
const response = await fetch(modifiedRequest);
|
||||
|
||||
if (!response.ok) {
|
||||
console.warn('[SW] API Response Error:', response.status, response.statusText);
|
||||
}
|
||||
|
||||
// Se la risposta è valida, restituiscila
|
||||
if (response.ok) {
|
||||
return response;
|
||||
}
|
||||
|
||||
// Logga eventuali errori
|
||||
console.warn('[Service Worker] API response not OK:', response.status, response.statusText);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error('[Service Worker] API request error ❌:', error);
|
||||
|
||||
@@ -121,7 +121,7 @@ export const Api = {
|
||||
}
|
||||
},
|
||||
|
||||
async checkTokenScaduto(status, evitaloop, resolve, reject, url, method, mydata, setAuthToken = false) {
|
||||
async checkTokenScaduto(status, evitaloop, url, method, mydata, setAuthToken = false) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
if (status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
@@ -134,12 +134,12 @@ export const Api = {
|
||||
|
||||
if (!evitaloop) {
|
||||
console.log('Nuovo token ottenuto. Riprovo la richiesta...');
|
||||
return resolve(this.SendReq(url, method, mydata, setAuthToken, true));
|
||||
return await this.SendReq(url, method, mydata, setAuthToken, true);
|
||||
}
|
||||
} else {
|
||||
// Se il refresh token fallisce, logout dell'utente
|
||||
userStore.setAuth('', '');
|
||||
return reject({ code: toolsext.ERR_AUTHENTICATION });
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
}
|
||||
} catch (err2) {
|
||||
console.error('Errore durante il refresh token:', err2);
|
||||
@@ -147,11 +147,11 @@ export const Api = {
|
||||
if (err2?.code === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
userStore.setAuth('', '');
|
||||
return reject({ code: toolsext.ERR_AUTHENTICATION });
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
}
|
||||
|
||||
// Gestione di altri errori critici
|
||||
return reject(err2);
|
||||
throw err2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ export const Api = {
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
}
|
||||
|
||||
// Verifica sul token (funzione custom, che deve restituire un valore se serve un nuovo flusso)
|
||||
const ret = await this.checkTokenScaduto(res.status, evitaloop, res, null, url, method, mydata, setAuthToken);
|
||||
// Verifica sul token (funzione custom)
|
||||
const ret = await this.checkTokenScaduto(res.status, evitaloop, url, method, mydata, setAuthToken);
|
||||
if (ret) return ret;
|
||||
|
||||
if (tools.isDebug()) console.log(' ----> ', res);
|
||||
@@ -206,8 +206,9 @@ export const Api = {
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
const ret = await this.checkTokenScaduto(error.status, evitaloop, null, error, url, method, mydataout, setAuthToken);
|
||||
const ret = await this.checkTokenScaduto(error.status, evitaloop, url, method, mydataout, setAuthToken);
|
||||
if (ret) return ret;
|
||||
|
||||
console.error('Errore nella richiesta:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user