Merge branch 'feature/cloud-sync' into feature/game-achievements

# Conflicts:
#	src/main/services/achievements/achievement-watcher.ts
#	src/main/services/achievements/update-local-unlocked-achivements.ts
#	src/main/services/hydra-api.ts
This commit is contained in:
Zamitto 2024-10-21 15:31:26 -03:00
commit f2d66df34f
24 changed files with 288 additions and 255 deletions

View file

@ -15,7 +15,7 @@ const getCatalogue = async (
});
const response = await HydraApi.get<{ objectId: string; shop: GameShop }[]>(
`/games/${category}?${params.toString()}`,
`/catalogue/${category}?${params.toString()}`,
{},
{ needsAuth: false }
);

View file

@ -11,7 +11,6 @@ const getGameBackupPreview = async (
) => {
const backupPath = path.join(backupsPath, `${shop}-${objectId}`);
console.log("preview invoked>>");
return Ludusavi.getBackupPreview(shop, objectId, backupPath);
};

View file

@ -67,6 +67,7 @@ import "./cloud-save/upload-save-game";
import "./cloud-save/delete-game-artifact";
import "./notifications/publish-new-repacks-notification";
import { isPortableVersion } from "@main/helpers";
import "./misc/show-item-in-folder";
ipcMain.handle("ping", () => "pong");
ipcMain.handle("getVersion", () => appVersion);

View file

@ -9,9 +9,8 @@ import { uploadGamesBatch } from "./library-sync";
import { clearGamesRemoteIds } from "./library-sync/clear-games-remote-id";
import { logger } from "./logger";
import { UserNotLoggedInError, SubscriptionRequiredError } from "@shared";
// import { omit } from "lodash-es";
import { appVersion } from "@main/constants";
import { omit } from "lodash-es";
import { appVersion } from "@main/constants";
interface HydraApiOptions {
needsAuth?: boolean;

View file

@ -7,9 +7,6 @@ import path from "node:path";
import YAML from "yaml";
import ludusaviWorkerPath from "../workers/ludusavi.worker?modulePath";
import axios from "axios";
let a: Record<string, string> | null = null;
export class Ludusavi {
private static ludusaviPath = path.join(app.getPath("appData"), "ludusavi");
@ -65,26 +62,14 @@ export class Ludusavi {
}
static async getBackupPreview(
_shop: GameShop,
shop: GameShop,
objectId: string,
backupPath: string
): Promise<LudusaviBackup | null> {
if (!a) {
await axios
.get(
"https://gist.githubusercontent.com/thegrannychaseroperation/b23d53e654e3ea060066a5c01b0cacc8/raw/57bf254a1c99dab9315136f660ff7b3d547de215/keys.json"
)
.then((response) => {
a = response.data;
return response.data;
});
}
const games = await this.findGames(shop, objectId);
const game = a?.[objectId];
// if (!games.length) return null;
// const [game] = games;
if (!games.length) return null;
const [game] = games;
const backupData = await this.worker.run(
{ title: game, backupPath, preview: true },