Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydra authored Apr 23, 2024
2 parents 6348813 + 80f69f3 commit 3fa18a4
Show file tree
Hide file tree
Showing 14 changed files with 1,310 additions and 57 deletions.
6 changes: 3 additions & 3 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const linuxPkgConfig = {
icon: "images/icon.png",
genericName: "Games Launcher",
name: "hydra-launcher",
productName: "Hydra"
productName: "Hydra",
};

const config: ForgeConfig = {
Expand Down Expand Up @@ -50,10 +50,10 @@ const config: ForgeConfig = {
}),
new MakerZIP({}, ["darwin", "linux"]),
new MakerRpm({
options: linuxPkgConfig
options: linuxPkgConfig,
}),
new MakerDeb({
options: linuxPkgConfig
options: linuxPkgConfig,
}),
],
publishers: [
Expand Down
8 changes: 7 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@
"play": "Play",
"deleting": "Deleting installer…",
"close": "Close",
"playing_now": "Playing now"
"playing_now": "Playing now",
"change": "Change",
"repacks_modal_description": "Choose the repack you want to download",
"downloads_path": "Downloads path",
"select_folder_hint": "To change the default folder, access the",
"hydra_settings": "Hydra settings",
"download_now": "Download now"
},
"activation": {
"title": "Activate Hydra",
Expand Down
8 changes: 7 additions & 1 deletion src/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@
"not_played_yet": "Você ainda não jogou {{title}}",
"close": "Fechar",
"deleting": "Excluindo instalador…",
"playing_now": "Jogando agora"
"playing_now": "Jogando agora",
"change": "Mudar",
"repacks_modal_description": "Escolha o repack do jogo que deseja baixar",
"downloads_path": "Diretório do download",
"select_folder_hint": "Para trocar a pasta padrão, acesse as ",
"hydra_settings": "Configurações do Hydra",
"download_now": "Baixe agora"
},
"activation": {
"title": "Ativação",
Expand Down
7 changes: 4 additions & 3 deletions src/main/events/hardware/get-disk-free-space.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
16 changes: 7 additions & 9 deletions src/main/events/torrenting/start-game-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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({
Expand All @@ -37,8 +37,6 @@ const startGameDownload = async (

writePipe.write({ action: "pause" });

const downloadsPath = game?.downloadPath ?? (await getDownloadsPath());

await gameRepository.update(
{
status: In([
Expand All @@ -57,7 +55,7 @@ const startGameDownload = async (
},
{
status: GameStatus.DownloadingMetadata,
downloadPath: downloadsPath,
downloadPath: downloadPath,
repack: { id: repackId },
}
);
Expand All @@ -66,7 +64,7 @@ const startGameDownload = async (
action: "start",
game_id: game.id,
magnet: repack.magnet,
save_path: downloadsPath,
save_path: downloadPath,
});

game.status = GameStatus.DownloadingMetadata;
Expand All @@ -75,7 +73,7 @@ const startGameDownload = async (
action: "start",
game_id: game.id,
magnet: repack.magnet,
save_path: downloadsPath,
save_path: downloadPath,
});

return game;
Expand All @@ -88,15 +86,15 @@ const startGameDownload = async (
objectID,
shop: gameShop,
status: GameStatus.DownloadingMetadata,
downloadPath: downloadsPath,
downloadPath: downloadPath,
repack: { id: repackId },
});

writePipe.write({
action: "start",
game_id: createdGame.id,
magnet: repack.magnet,
save_path: downloadsPath,
save_path: downloadPath,
});

const { repack: _, ...rest } = createdGame;
Expand Down
16 changes: 13 additions & 3 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ contextBridge.exposeInMainWorld("electron", {
repackId: number,
objectID: string,
title: string,
shop: GameShop
) => ipcRenderer.invoke("startGameDownload", repackId, objectID, title, shop),
shop: GameShop,
downloadPath: string
) =>
ipcRenderer.invoke(
"startGameDownload",
repackId,
objectID,
title,
shop,
downloadPath
),
cancelGameDownload: (gameId: number) =>
ipcRenderer.invoke("cancelGameDownload", gameId),
pauseGameDownload: (gameId: number) =>
Expand Down Expand Up @@ -90,7 +99,8 @@ contextBridge.exposeInMainWorld("electron", {
},

/* Hardware */
getDiskFreeSpace: () => ipcRenderer.invoke("getDiskFreeSpace"),
getDiskFreeSpace: (path: string) =>
ipcRenderer.invoke("getDiskFreeSpace", path),

/* Misc */
getOrCacheImage: (url: string) => ipcRenderer.invoke("getOrCacheImage", url),
Expand Down
Loading

0 comments on commit 3fa18a4

Please sign in to comment.