vers: 1.1.3
- aggiornato ncu -u
This commit is contained in:
@@ -34,14 +34,14 @@ self.addEventListener('activate', (event) => {
|
||||
});
|
||||
|
||||
|
||||
const VersioneApp = "1.1.2";
|
||||
const APP_VERSION = "1.1.3";
|
||||
|
||||
console.log(' [ VER-' + VersioneApp + ' ] _---------________------ PAO: this is my custom service worker');
|
||||
console.log(' [ VER-' + APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker');
|
||||
|
||||
importScripts('js/idb.js', 'js/storage.js');
|
||||
|
||||
let port = self.location.hostname.startsWith('test') ? 3001 : 3000;
|
||||
console.log('SW- app ver ' + VersioneApp + ' on port ' + port);
|
||||
console.log('SW- app ver ' + APP_VERSION + ' on port ' + port);
|
||||
|
||||
|
||||
// Function helpers
|
||||
@@ -66,7 +66,13 @@ if (workbox) {
|
||||
const debug = false;
|
||||
workbox.setConfig({ debug });
|
||||
|
||||
const precacheList = self.__WB_MANIFEST || [];
|
||||
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;
|
||||
});
|
||||
|
||||
setCacheNameDetails({
|
||||
prefix: self.location.hostname,
|
||||
@@ -82,7 +88,7 @@ if (workbox) {
|
||||
registerRoute(
|
||||
new RegExp(/\.(?:png|gif|jpg|jpeg)$/),
|
||||
new CacheFirst({
|
||||
cacheName: 'images-upload',
|
||||
cacheName: `images-upload-${APP_VERSION}`,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({ statuses: [200] }),
|
||||
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
|
||||
@@ -93,7 +99,7 @@ if (workbox) {
|
||||
registerRoute(
|
||||
new RegExp(/\.(?:svg)$/),
|
||||
new CacheFirst({
|
||||
cacheName: 'svg',
|
||||
cacheName: `svg-${APP_VERSION}`,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({ statuses: [200] }),
|
||||
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
|
||||
@@ -104,7 +110,7 @@ if (workbox) {
|
||||
registerRoute(
|
||||
new RegExp(/.*(?:googleapis|gstatic)\.com.*$/),
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: 'google-fonts',
|
||||
cacheName: `google-fonts-${APP_VERSION}`,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({ statuses: [200] }),
|
||||
new ExpirationPlugin({ maxEntries: 30 }),
|
||||
@@ -115,7 +121,7 @@ if (workbox) {
|
||||
registerRoute(
|
||||
new RegExp(/.*\/(?:icons).*$/),
|
||||
new CacheFirst({
|
||||
cacheName: 'icon-cache',
|
||||
cacheName: `icon-cache-${APP_VERSION}`,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({ statuses: [200] }),
|
||||
new ExpirationPlugin({ maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
|
||||
@@ -126,7 +132,7 @@ if (workbox) {
|
||||
registerRoute(
|
||||
new RegExp(/\.(?:js|css|font)$/),
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: 'js-css-fonts',
|
||||
cacheName: `js-css-fonts-${APP_VERSION}`,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({ statuses: [200] }),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user