- check updates

- risolto problema della generazione dei PDF, avevo modificato in CMyPageElem , se si cambia qualcosa occorre stare attenti a mettere !hideHeader
This commit is contained in:
Surya Paolo
2025-11-01 12:00:49 +01:00
parent df98ec9471
commit d179581b23
78 changed files with 3593139 additions and 304 deletions

View File

@@ -3,7 +3,7 @@
/* global workbox */
/* global cfgenv */
const VITE_APP_VERSION = '1.2.72';
const VITE_APP_VERSION = '1.2.75';
// Costanti di configurazione
const DYNAMIC_CACHE = 'dynamic-cache-v2';
@@ -38,10 +38,19 @@ const CACHE_NAME = 'pwa-cache-' + VITE_APP_VERSION; // Nome della cache
importScripts('workbox/workbox-sw.js');
import { clientsClaim } from 'workbox-core';
import { precacheAndRoute, cleanupOutdatedCaches, createHandlerBoundToURL } from 'workbox-precaching';
import {
precacheAndRoute,
cleanupOutdatedCaches,
createHandlerBoundToURL,
} from 'workbox-precaching';
import { registerRoute, NavigationRoute } from 'workbox-routing';
import { setCacheNameDetails } from 'workbox-core';
import { NetworkOnly, NetworkFirst, StaleWhileRevalidate, CacheFirst } from 'workbox-strategies';
import {
NetworkOnly,
NetworkFirst,
StaleWhileRevalidate,
CacheFirst,
} from 'workbox-strategies';
import { CacheableResponsePlugin } from 'workbox-cacheable-response';
import { ExpirationPlugin } from 'workbox-expiration';
@@ -66,12 +75,15 @@ setCacheNameDetails({
runtime: 'runtime',
});
// ✅ SOLUZIONE: Sii più specifico
const precacheList = (self.__WB_MANIFEST || []).filter((entry) => {
// Esclude tutto ciò che si trova nella cartella 'upload'
if (entry.url.includes('/upload/')) {
return false;
}
return true;
const url = entry.url;
// Escludi file grandi, upload, e risorse dinamiche
return (
!url.includes('/upload/') &&
!url.includes('/assets/videos/') &&
!url.match(/\.(mp4|webm|zip|pdf)$/)
);
});
// Precache solo i file filtrati
@@ -85,6 +97,12 @@ self.addEventListener('install', () => {
self.skipWaiting();
clientsClaim();
// Notifica il frontend che c'è un nuovo SW pronto
self.clients.matchAll().then((clients) => {
clients.forEach((client) => {
client.postMessage({ type: 'SW_UPDATED' });
});
});
});
// Attivazione del Service Worker
@@ -93,13 +111,19 @@ self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(
cacheNames.filter((name) => name !== CACHE_NAME && name !== DYNAMIC_CACHE).map((name) => caches.delete(name))
cacheNames
.filter((name) => name !== CACHE_NAME && name !== DYNAMIC_CACHE)
.map((name) => caches.delete(name))
);
})
);
});
console.log(' [ VER-' + VITE_APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker: ');
console.log(
' [ VER-' +
VITE_APP_VERSION +
' ] _---------________------ PAO: this is my custom service worker: '
);
try {
importScripts('/js/idb.js', '/js/storage.js');
@@ -170,7 +194,10 @@ if (workbox) {
/^https:\/\/fonts\.(?:googleapis|gstatic)\.com/,
new StaleWhileRevalidate({
cacheName: `${CACHE_PREFIX}-google-fonts-${CACHE_VERSION}`,
plugins: [new CacheableResponsePlugin({ statuses: [0, 200] }), new ExpirationPlugin({ maxEntries: 30 })],
plugins: [
new CacheableResponsePlugin({ statuses: [0, 200] }),
new ExpirationPlugin({ maxEntries: 30 }),
],
})
);
@@ -179,7 +206,7 @@ if (workbox) {
({ request }) => request.destination === 'document',
new NetworkFirst({
cacheName: `${CACHE_PREFIX}-html-cache-${CACHE_VERSION}`,
networkTimeoutSeconds: 5, // timeout rapido
networkTimeoutSeconds: 10, // timeout rapido
plugins: [
new CacheableResponsePlugin({ statuses: [0, 200] }),
new ExpirationPlugin({ maxEntries: 20, maxAgeSeconds: 24 * 60 * 60 }), // 1 giorno
@@ -192,7 +219,7 @@ if (workbox) {
({ url }) => url.hostname === API_DOMAIN,
new NetworkFirst({
cacheName: `${CACHE_PREFIX}-api-cache-${CACHE_VERSION}`,
networkTimeoutSeconds: 5,
networkTimeoutSeconds: 10,
fetchOptions: { credentials: 'include' },
plugins: [
new CacheableResponsePlugin({ statuses: [0, 200] }),
@@ -211,8 +238,15 @@ if (workbox) {
const syncStore = {};
self.addEventListener('message', (event) => {
if (event.data && (event.data.type === 'SKIP_WAITING' || event.data.action === 'skipWaiting')) {
if (
event.data &&
(event.data.type === 'SKIP_WAITING' || event.data.action === 'skipWaiting')
) {
self.skipWaiting();
// Opzionale: rispondi al client
if (event.ports && event.ports[0]) {
event.ports[0].postMessage({ success: true });
}
}
if (event.data.type === 'sync') {
console.log('addEventListener - message');
@@ -445,7 +479,9 @@ if (workbox) {
self.addEventListener('push', (event) => {
console.log('Push Notification received', event);
let data = event.data ? event.data.json() : { title: 'New!', content: 'Something new happened!', url: '/' };
let data = event.data
? event.data.json()
: { title: 'New!', content: 'Something new happened!', url: '/' };
const options = {
body: data.content,

View File

@@ -1,7 +1,7 @@
{
"name": "Riso",
"short_name": "Riso",
"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.",
"name": "Gruppo Macro",
"short_name": "GruppoMacro",
"description": "",
"display": "standalone",
"orientation": "portrait",
"background_color": "#fff",
@@ -11,47 +11,17 @@
"start_url": "/?homescreen=1",
"icons": [
{
"src": "/images/riso-android-icon-512x512.png",
"src": "/images/gm-android-icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/images/riso-android-icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/images/riso-android-icon-192x192.png",
"src": "/images/gm-android-icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/images/riso-android-icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/images/riso-android-icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/images/riso-apple-icon-120x120.png",
"sizes": "120x120",
"type": "image/png"
},
{
"src": "/images/riso-apple-icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/images/riso-apple-icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "/images/riso-apple-icon-180x180.png",
"src": "/images/gm-apple-touch-icon.png",
"sizes": "180x180",
"type": "image/png"
}