From 896b2a01334c4b4cc88151ae0eb6fb6fbd7805f0 Mon Sep 17 00:00:00 2001 From: sky Date: Tue, 4 Nov 2025 22:09:32 -0500 Subject: [PATCH] add clear caching --- js/all.min.js | 12 +++++++++++- settings.html | 15 ++++++++++++++- sw.js | 4 ++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/js/all.min.js b/js/all.min.js index 42314ee..6f7d1c5 100755 --- a/js/all.min.js +++ b/js/all.min.js @@ -9,7 +9,17 @@ loadAnalytics.unami = function() { script.setAttribute("data-website-id", "cdb79ddd-06a6-478f-b726-be39b502d6a5"); document.head.appendChild(script); }; +loadAnalytics.cloudflare = function() { + // + let script = document.createElement("script"); + script.setAttribute("defer", ""); + script.setAttribute("src", "https://static.cloudflareinsights.com/beacon.min.js"); + script.setAttribute("data-cf-beacon", '{"token": "e5b0ef8807e74cef81287ac77bd18938"}'); + document.head.appendChild(script); +}; document.addEventListener("DOMContentLoaded", () => { - loadAnalytics.unami(); + // yo why are all analytic providers mid + // loadAnalytics.unami(); + // loadAnalytics.cloudflare(); }) \ No newline at end of file diff --git a/settings.html b/settings.html index 3c885ab..35dcfad 100755 --- a/settings.html +++ b/settings.html @@ -158,6 +158,18 @@ alert("not completed"); } } + async function deleteAllCaches() { + try { + const cacheNames = await caches.keys(); + + await Promise.all( + cacheNames.map(cacheName => { + console.log(`Deleting cache: ${cacheName}`); + return caches.delete(cacheName); + }) + ); + } catch {} + } @@ -208,10 +220,11 @@

manage data

-

not implemented

+

download & upload currently unfinished, use the cloud backups

+
diff --git a/sw.js b/sw.js index e42c2fe..78d7edd 100644 --- a/sw.js +++ b/sw.js @@ -12,7 +12,7 @@ if(workbox) { cacheName: 'images-cache', plugins: [ new workbox.expiration.ExpirationPlugin({ - maxEntries: 500, + maxEntries: 600, maxAgeSeconds: 365 * 24 * 60 * 60, }), ], @@ -37,7 +37,7 @@ if(workbox) { cacheName: 'json-cache', plugins: [ new workbox.expiration.ExpirationPlugin({ - maxAgeSeconds: 24 * 60 * 60, + maxAgeSeconds: 3 * 60 * 60, maxEntries: 2, }), ],