fix: wrong folder name

This commit is contained in:
Zamitto 2024-12-23 18:55:13 -03:00
parent aa0321df8f
commit 9b9545fb8f
3 changed files with 13 additions and 4 deletions

View File

@ -34,7 +34,7 @@ class HttpDownloader:
download = self.aria2.get_download(self.download.gid) download = self.aria2.get_download(self.download.gid)
response = { response = {
'folderName': str(download.dir) + "/" + download.name, 'folderName': download.name,
'fileSize': download.total_length, 'fileSize': download.total_length,
'progress': download.completed_length / download.total_length if download.total_length else 0, 'progress': download.completed_length / download.total_length if download.total_length else 0,
'downloadSpeed': download.download_speed, 'downloadSpeed': download.download_speed,

View File

@ -1,6 +1,7 @@
import { HydraApi } from "@main/services"; import { HydraApi } from "@main/services";
import { registerEvent } from "../register-event"; import { registerEvent } from "../register-event";
import type { GameArtifact, GameShop } from "@types"; import type { GameArtifact, GameShop } from "@types";
import { SubscriptionRequiredError } from "@shared";
const getGameArtifacts = async ( const getGameArtifacts = async (
_event: Electron.IpcMainInvokeEvent, _event: Electron.IpcMainInvokeEvent,
@ -13,8 +14,16 @@ const getGameArtifacts = async (
}); });
return HydraApi.get<GameArtifact[]>( return HydraApi.get<GameArtifact[]>(
`/profile/games/artifacts?${params.toString()}` `/profile/games/artifacts?${params.toString()}`,
); {},
{ needsSubscription: true }
).catch((err) => {
if (err instanceof SubscriptionRequiredError) {
return [];
}
throw err;
});
}; };
registerEvent("getGameArtifacts", getGameArtifacts); registerEvent("getGameArtifacts", getGameArtifacts);

View File

@ -13,7 +13,7 @@ export class UserNotLoggedInError extends Error {
export class SubscriptionRequiredError extends Error { export class SubscriptionRequiredError extends Error {
constructor() { constructor() {
super("user does not have hydra cloud subscription"); super("user does not have hydra cloud subscription");
this.name = "UserWithoutCloudSubscriptionError"; this.name = "SubscriptionRequiredError";
} }
} }