Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
AarushX committed Nov 21, 2022
1 parent 207e3e7 commit 472aef8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
16 changes: 11 additions & 5 deletions packages/main/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ app
.whenReady()
.then(async () => {
console.log("App is ready!");
await iCollection("defaults");
if (import.meta.env.PROD) {
console.log("Checking for updates:");
autoUpdater.checkForUpdatesAndNotify();
Expand All @@ -44,7 +45,7 @@ app
}
await restoreOrCreateWindow();
await disc.init();
await iCollection("defaults");

})
.catch((e) => console.error("Failed:", e));

Expand Down Expand Up @@ -80,14 +81,19 @@ ipcMain.handle("get", async (event, command, arg1, arg2) => {
.replace("\\","");
if (subCollectionName == "") continue;

const contents = await fs.readJSON(
path.join(
collectionPath, subCollectionName, "pack.json",
)
);

collection[subCollectionName] = {
"name": subCollectionName,
"version": (await fs.readJSON(
path.join(collectionPath, subCollectionName, "pack.json"),
)).version,
"version": contents.version,
"verified": contents.verified,
"info": JSON.stringify(contents),
};


}
collections.push(`{"${collectionName}": ${JSON.stringify(collection)}}`);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/main/src/modules/tools/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ const iModrinth = async (mod, version, modsPath, loader) => {
const iCollection = async (collection) => {
const collectionsPath = path.join(minecraftPath,"collections");
const filename = `${collection}.zip`;
console.log("Updating collection "+filename);
await download(
`https://github.com/AlphaUpstream/FusionRepo/raw/main/${filename}`,
path.join(tempDir,filename),
);
new Zip(path.join(tempDir,filename)).extractAllTo(collectionsPath,true);
).catch((e)=>console.error(e));
await new Zip(path.join(tempDir,filename)).extractAllTo(collectionsPath,true);
await fs.remove(path.join(tempDir, filename));
};

Expand Down
4 changes: 3 additions & 1 deletion packages/renderer/src/components/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ No Collections Installed! Report this error, please!
<p>{collectionName}</p>
{#each collections as collxion}
{@const collectionData = collection[collectionName][collxion]}
{@const name = collectionData.verified == "true" ? collectionData.name + "" : collectionData.name}
<div class= "ilModern">
<button class="button" on:click={() => {
globalData.client = collectionData.name;
globalData.clientType = "collection";
globalData.collection = collectionName;
}}>{collectionData.name}</button>
}}>{name}</button>
{collectionData.version}

</div>
{/each}
</div>
Expand Down
1 change: 0 additions & 1 deletion packages/renderer/src/data/localStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ let settings = new database(settingsFile);
export const data = writable(await settings.get());

data.subscribe((value) => {
console.log(value);
settings.set(JSON.stringify(value));
window.dbTools.overwriteJSON(settingsFile, value);
});

0 comments on commit 472aef8

Please sign in to comment.