Skip to content

Commit

Permalink
make marketplace use libpersist instead of anura.settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Sep 26, 2024
1 parent 06e2070 commit 7963ef4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/marketplace.app/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import RepoList from "./screens/RepoList.mjs";
import ItemList from "./screens/ItemList.mjs";
import Overview from "./screens/Overview.mjs";
const { Store } = await anura.import("[email protected]");
const persist = await anura.import("anura.persistence");
const loader = persist.buildLoader(anura);
await loader.locate();
const persistence = await loader.build(instance);

if (anura.settings.get("workstore-repos")) {
await persistence.set("repos", anura.settings.get("workstore-repos"));
anura.settings.set("workstore-repos", null);
}

const branding = anura.settings.get("marketplace-branding") || {
repoList: "Marketplace",
Expand All @@ -21,7 +30,7 @@ document.addEventListener("anura-theme-change", () => {

window.saved = $state({
repos: Object.entries(
anura.settings.get("workstore-repos") || {
(await persistence.get("repos")) || {
"Anura App Repository":
"https://raw.githubusercontent.com/MercuryWorkshop/anura-repo/master/",
"Anura Games": "https://games.anura.pro/",
Expand All @@ -32,7 +41,7 @@ window.saved = $state({
});

instanceWindow.addEventListener("close", () => {
anura.settings.set("workstore-repos", Object.fromEntries(saved.repos));
persistence.set("repos", Object.fromEntries(saved.repos));
});

window.state = $state({
Expand Down

0 comments on commit 7963ef4

Please sign in to comment.