Додан моніторінг застосунку

Додани веб компоненти карточок територій та повідомлень
This commit is contained in:
2025-12-08 00:14:56 +02:00
parent e41590546c
commit 85483b85bb
206 changed files with 2370 additions and 595 deletions

View File

@@ -1,4 +1,4 @@
const STATIC_CACHE_NAME = 'v2.0.40';
const STATIC_CACHE_NAME = 'v2.0.103';
const FILES_TO_CACHE = [
'/',
@@ -7,6 +7,8 @@ const FILES_TO_CACHE = [
"/lib/router/router.js",
"/lib/router/routes.js",
"/lib/customElements/notification.js",
"/lib/components/leaflet/leaflet.css",
"/lib/components/leaflet/leaflet.js",
@@ -17,6 +19,8 @@ const FILES_TO_CACHE = [
"/lib/components/cloud.js",
"/lib/components/metrics.js",
"/lib/components/clipboard.js",
"/lib/components/colorGroup.js",
"/lib/components/makeid.js",
@@ -91,6 +95,10 @@ const FILES_TO_CACHE = [
"/lib/pages/schedule/list/style.css",
"/lib/pages/schedule/list/index.html",
"/lib/pages/schedule/constructor/script.js",
"/lib/pages/schedule/constructor/style.css",
"/lib/pages/schedule/constructor/index.html",
"/lib/app.js"
];
@@ -102,7 +110,7 @@ self.addEventListener('install', event => {
fetch(url).then(res => {
if (!res.ok) throw new Error(`${url} not found`);
return cache.put(url, res);
}).catch(err => console.warn(err))
}).catch(err => console.warn('[ServiceWorker] ', err))
));
})
);
@@ -130,12 +138,12 @@ self.addEventListener('fetch', event => {
// ----------------------- PUSH -----------------------
self.addEventListener("push", event => {
let data = {};
try { data = event.data.json(); } catch { data = { title: "Уведомлення", body: event.data?.text() }; }
try { data = event.data.json(); } catch { data = { title: "Повідомлення", body: event.data?.text() }; }
console.log(data);
console.log('[ServiceWorker] ', data);
const title = data.title || "Уведомлення";
const title = data.title || "Повідомлення";
const options = {
body: data.body || "",
icon: "/img/icon.png",
@@ -177,7 +185,7 @@ async function updateALL() {
fetch(url).then(res => {
if (!res.ok) throw new Error(`${url} not found`);
return cache.put(url, res);
}).catch(err => console.warn(err))
}).catch(err => console.warn('[ServiceWorker] ', err))
));
console.log('All caches updated');
console.log('[ServiceWorker] All caches updated');
}