add clear caching
This commit is contained in:
12
js/all.min.js
vendored
12
js/all.min.js
vendored
@ -9,7 +9,17 @@ loadAnalytics.unami = function() {
|
||||
script.setAttribute("data-website-id", "cdb79ddd-06a6-478f-b726-be39b502d6a5");
|
||||
document.head.appendChild(script);
|
||||
};
|
||||
loadAnalytics.cloudflare = function() {
|
||||
// <script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "e5b0ef8807e74cef81287ac77bd18938"}'></script>
|
||||
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();
|
||||
})
|
||||
@ -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 {}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -208,10 +220,11 @@
|
||||
</section>
|
||||
<section>
|
||||
<h2>manage data</h2>
|
||||
<p>not implemented</p>
|
||||
<p>download & upload currently unfinished, use the cloud backups</p>
|
||||
<button id="downloadData">download</button>
|
||||
<button id="uploadData">upload</button>
|
||||
<button onclick="wipeData()">wipe (erases all game data)</button>
|
||||
<button onclick="deleteAllCaches()">wipe all cache</button>
|
||||
</section>
|
||||
</sections>
|
||||
</body>
|
||||
|
||||
4
sw.js
4
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,
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user