Skip to content

Commit

Permalink
fix caching issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Apr 9, 2024
1 parent 89935c6 commit 99fa401
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion public/anura-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ addEventListener("message", (event) => {
callback(event.data.value);
}
if (event.data.anura_target === "anura.cache") {
idbKeyval.set("cacheenabled", event.data.value);
cacheenabled = event.data.value;
idbKeyval.set("cacheenabled", event.data.value);
}
});
async function handleRequests({ url, request, event, params }) {
Expand Down
8 changes: 8 additions & 0 deletions src/oobe/OobeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class OobeView {
<button
on:click={() => {
anura.settings.set("x86-disabled", false);
anura.settings.set("use-sw-cache", true);
anura.settings.set("x86-image", "alpine");
anura.settings.set("applist", [
...anura.settings.get("applist"),
Expand All @@ -137,6 +138,7 @@ class OobeView {
<button
on:click={() => {
anura.settings.set("x86-disabled", false);
anura.settings.set("use-sw-cache", true);
anura.settings.set("x86-image", "debian");
anura.settings.set("applist", [
...anura.settings.get("applist"),
Expand All @@ -151,6 +153,7 @@ class OobeView {
<button
on:click={() => {
anura.settings.set("x86-disabled", false);
anura.settings.set("use-sw-cache", true);
anura.settings.set("x86-image", "arch");
anura.settings.set("applist", [
...anura.settings.get("applist"),
Expand All @@ -165,6 +168,7 @@ class OobeView {
<button
on:click={() => {
anura.settings.set("x86-disabled", true);
anura.settings.set("use-sw-cache", true);
anura.settings.set("applist", [
...anura.settings.get("applist"),
"anura.ashell",
Expand Down Expand Up @@ -207,6 +211,10 @@ class OobeView {
</div>
),
on: async () => {
await navigator.serviceWorker.controller!.postMessage({
anura_target: "anura.cache",
value: anura.settings.get("use-sw-cache"),
});
this.state.color = "var(--material-bg)";
this.state.text = "whitesmoke";
if (!anura.settings.get("x86-disabled")) {
Expand Down

0 comments on commit 99fa401

Please sign in to comment.