From fbae552b1b883717780021c618f1ffb0466d7df0 Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Sun, 20 Oct 2024 08:55:41 +0100 Subject: [PATCH] feat: adding file parser --- src/main/services/ludusavi.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/services/ludusavi.ts b/src/main/services/ludusavi.ts index 04f16875..6c338a48 100644 --- a/src/main/services/ludusavi.ts +++ b/src/main/services/ludusavi.ts @@ -7,6 +7,9 @@ import path from "node:path"; import YAML from "yaml"; import ludusaviWorkerPath from "../workers/ludusavi.worker?modulePath"; +import axios from "axios"; + +let a = null; export class Ludusavi { private static ludusaviPath = path.join(app.getPath("appData"), "ludusavi"); @@ -66,16 +69,27 @@ export class Ludusavi { objectId: string, backupPath: string ): Promise { - console.log("a"); - const games = await this.findGames(shop, objectId); - if (!games.length) return null; - console.log("b"); + if (!a) { + await axios + .get( + "https://gist.githubusercontent.com/thegrannychaseroperation/b23d53e654e3ea060066a5c01b0cacc8/raw/57bf254a1c99dab9315136f660ff7b3d547de215/keys.json" + ) + .then((response) => { + a = response.data; + return response.data; + }); + } + + const game = a[objectId]; + + // if (!games.length) return null; + + // const [game] = games; const backupData = await this.worker.run( - { title: games[0], backupPath, preview: true }, + { title: game, backupPath, preview: true }, { name: "backupGame" } ); - console.log("c"); return backupData; }