From 9b9545fb8fcc2383ad098f5981544809bd67559a Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:55:13 -0300 Subject: [PATCH] fix: wrong folder name --- python_rpc/http_downloader.py | 2 +- src/main/events/cloud-save/get-game-artifacts.ts | 13 +++++++++++-- src/shared/index.ts | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/python_rpc/http_downloader.py b/python_rpc/http_downloader.py index 855d5ef4..40e30ccd 100644 --- a/python_rpc/http_downloader.py +++ b/python_rpc/http_downloader.py @@ -34,7 +34,7 @@ class HttpDownloader: download = self.aria2.get_download(self.download.gid) response = { - 'folderName': str(download.dir) + "/" + download.name, + 'folderName': download.name, 'fileSize': download.total_length, 'progress': download.completed_length / download.total_length if download.total_length else 0, 'downloadSpeed': download.download_speed, diff --git a/src/main/events/cloud-save/get-game-artifacts.ts b/src/main/events/cloud-save/get-game-artifacts.ts index fc47076a..dbdcb853 100644 --- a/src/main/events/cloud-save/get-game-artifacts.ts +++ b/src/main/events/cloud-save/get-game-artifacts.ts @@ -1,6 +1,7 @@ import { HydraApi } from "@main/services"; import { registerEvent } from "../register-event"; import type { GameArtifact, GameShop } from "@types"; +import { SubscriptionRequiredError } from "@shared"; const getGameArtifacts = async ( _event: Electron.IpcMainInvokeEvent, @@ -13,8 +14,16 @@ const getGameArtifacts = async ( }); return HydraApi.get( - `/profile/games/artifacts?${params.toString()}` - ); + `/profile/games/artifacts?${params.toString()}`, + {}, + { needsSubscription: true } + ).catch((err) => { + if (err instanceof SubscriptionRequiredError) { + return []; + } + + throw err; + }); }; registerEvent("getGameArtifacts", getGameArtifacts); diff --git a/src/shared/index.ts b/src/shared/index.ts index 699cc4d8..85868391 100644 --- a/src/shared/index.ts +++ b/src/shared/index.ts @@ -13,7 +13,7 @@ export class UserNotLoggedInError extends Error { export class SubscriptionRequiredError extends Error { constructor() { super("user does not have hydra cloud subscription"); - this.name = "UserWithoutCloudSubscriptionError"; + this.name = "SubscriptionRequiredError"; } }