Merge branch 'main' of https://github.com/hydralauncher/hydra into refactor/change-game-delete-to-soft-delete

This commit is contained in:
JackEnx 2024-04-23 13:31:35 -03:00
commit cf44acbf31
13 changed files with 1265 additions and 53 deletions

View file

@ -1,10 +1,11 @@
import checkDiskSpace from "check-disk-space";
import { registerEvent } from "../register-event";
import { getDownloadsPath } from "../helpers/get-downloads-path";
const getDiskFreeSpace = async (_event: Electron.IpcMainInvokeEvent) =>
checkDiskSpace(await getDownloadsPath());
const getDiskFreeSpace = async (
_event: Electron.IpcMainInvokeEvent,
path: string
) => checkDiskSpace(path);
registerEvent(getDiskFreeSpace, {
name: "getDiskFreeSpace",

View file

@ -5,7 +5,6 @@ import { GameStatus } from "@main/constants";
import { registerEvent } from "../register-event";
import type { GameShop } from "@types";
import { getDownloadsPath } from "../helpers/get-downloads-path";
import { getImageBase64 } from "@main/helpers";
import { In } from "typeorm";
@ -14,7 +13,8 @@ const startGameDownload = async (
repackId: number,
objectID: string,
title: string,
gameShop: GameShop
gameShop: GameShop,
downloadPath: string
) => {
const [game, repack] = await Promise.all([
gameRepository.findOne({
@ -37,8 +37,6 @@ const startGameDownload = async (
writePipe.write({ action: "pause" });
const downloadsPath = game?.downloadPath ?? (await getDownloadsPath());
await gameRepository.update(
{
status: In([
@ -57,7 +55,7 @@ const startGameDownload = async (
},
{
status: GameStatus.DownloadingMetadata,
downloadPath: downloadsPath,
downloadPath: downloadPath,
repack: { id: repackId },
isDeleted: false,
}
@ -67,7 +65,7 @@ const startGameDownload = async (
action: "start",
game_id: game.id,
magnet: repack.magnet,
save_path: downloadsPath,
save_path: downloadPath,
});
game.status = GameStatus.DownloadingMetadata;
@ -82,7 +80,7 @@ const startGameDownload = async (
objectID,
shop: gameShop,
status: GameStatus.DownloadingMetadata,
downloadPath: downloadsPath,
downloadPath: downloadPath,
repack: { id: repackId },
});
@ -90,7 +88,7 @@ const startGameDownload = async (
action: "start",
game_id: createdGame.id,
magnet: repack.magnet,
save_path: downloadsPath,
save_path: downloadPath,
});
const { repack: _, ...rest } = createdGame;