Skip to content

Commit

Permalink
Merge branch 'main' into feature/check-directory-permission
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrannychaseroperation authored Jan 2, 2025
2 parents 31feb4a + 59bc23b commit 1cfe3dc
Show file tree
Hide file tree
Showing 13 changed files with 396 additions and 404 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydralauncher",
"version": "3.1.4",
"version": "3.1.5",
"description": "Hydra",
"main": "./out/main/index.js",
"author": "Los Broxas",
Expand Down
735 changes: 375 additions & 360 deletions src/locales/ar/translation.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/locales/bg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"game_details": {
"launch_options": "Опции за стартиране",
"launch_options_description": "Напредналите потребители могат да въведат модификации на своите опции за стартиране",
"launch_options_description": "Напредналите потребители могат да въведат модификации на своите опции за стартиране (экспериментальный)",
"launch_options_placeholder": "Няма зададен параметър",
"open_download_options": "Варианти за изтегляне",
"download_options_zero": "Няма варианти за изтегляне",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"wine_prefix": "Wine Prefix",
"wine_prefix_description": "The Wine prefix used to run this game",
"launch_options": "Launch Options",
"launch_options_description": "Advanced users may choose to enter modifications to their launch options",
"launch_options_description": "Advanced users may choose to enter modifications to their launch options (experimental feature)",
"launch_options_placeholder": "No parameter specified",
"no_download_option_info": "No information available",
"backup_deletion_failed": "Failed to delete backup",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/pt-BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"wine_prefix": "Prefixo Wine",
"wine_prefix_description": "O prefixo Wine que foi utilizado para instalar o jogo",
"launch_options": "Opções de Inicialização",
"launch_options_description": "Usuários avançados podem adicionar opções de inicialização no jogo",
"launch_options_description": "Usuários avançados podem adicionar opções de inicialização no jogo (experimental)",
"launch_options_placeholder": "Nenhum parâmetro informado",
"no_download_option_info": "Sem informações disponíveis",
"backup_deletion_failed": "Falha ao apagar backup",
Expand Down
2 changes: 2 additions & 0 deletions src/main/events/auth/get-session-hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const getSessionHash = async (_event: Electron.IpcMainInvokeEvent) => {
if (!auth) return null;
const payload = jwt.decode(auth.accessToken) as jwt.JwtPayload;

if (!payload) return null;

return payload.sessionId;
};

Expand Down
6 changes: 5 additions & 1 deletion src/main/events/cloud-save/get-game-artifacts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HydraApi } from "@main/services";
import { registerEvent } from "../register-event";
import type { GameArtifact, GameShop } from "@types";
import { SubscriptionRequiredError } from "@shared";
import { SubscriptionRequiredError, UserNotLoggedInError } from "@shared";

const getGameArtifacts = async (
_event: Electron.IpcMainInvokeEvent,
Expand All @@ -22,6 +22,10 @@ const getGameArtifacts = async (
return [];
}

if (err instanceof UserNotLoggedInError) {
return [];
}

throw err;
});
};
Expand Down
9 changes: 0 additions & 9 deletions src/main/events/helpers/parse-launch-options.ts

This file was deleted.

12 changes: 2 additions & 10 deletions src/main/events/library/open-game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,23 @@ import { gameRepository } from "@main/repository";

import { registerEvent } from "../register-event";
import { shell } from "electron";
import { spawn } from "child_process";
import { parseExecutablePath } from "../helpers/parse-executable-path";
import { parseLaunchOptions } from "../helpers/parse-launch-options";

const openGame = async (
_event: Electron.IpcMainInvokeEvent,
gameId: number,
executablePath: string,
launchOptions: string | null
) => {
// TODO: revisit this for launchOptions
const parsedPath = parseExecutablePath(executablePath);
const parsedParams = parseLaunchOptions(launchOptions);

await gameRepository.update(
{ id: gameId },
{ executablePath: parsedPath, launchOptions }
);

if (process.platform === "linux" || process.platform === "darwin") {
shell.openPath(parsedPath);
}

if (process.platform === "win32") {
spawn(parsedPath, parsedParams, { shell: false, detached: true });
}
shell.openPath(parsedPath);
};

registerEvent("openGame", openGame);
11 changes: 2 additions & 9 deletions src/main/events/misc/open-checkout.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { shell } from "electron";
import { registerEvent } from "../register-event";
import {
userAuthRepository,
userPreferencesRepository,
} from "@main/repository";
import { userAuthRepository } from "@main/repository";
import { HydraApi } from "@main/services";

const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => {
const [userAuth, userPreferences] = await Promise.all([
userAuthRepository.findOne({ where: { id: 1 } }),
userPreferencesRepository.findOne({ where: { id: 1 } }),
]);
const userAuth = await userAuthRepository.findOne({ where: { id: 1 } });

if (!userAuth) {
return;
Expand All @@ -22,7 +16,6 @@ const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => {

const params = new URLSearchParams({
token: paymentToken,
lng: userPreferences?.language || "en",
});

shell.openExternal(
Expand Down
10 changes: 3 additions & 7 deletions src/renderer/src/context/game-details/game-details.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ export function GameDetailsContextProvider({
abortControllerRef.current = abortController;

window.electron
.getGameShopDetails(
objectId!,
shop as GameShop,
getSteamLanguage(i18n.language)
)
.getGameShopDetails(objectId, shop, getSteamLanguage(i18n.language))
.then((result) => {
if (abortController.signal.aborted) return;

Expand All @@ -140,14 +136,14 @@ export function GameDetailsContextProvider({
setIsLoading(false);
});

window.electron.getGameStats(objectId, shop as GameShop).then((result) => {
window.electron.getGameStats(objectId, shop).then((result) => {
if (abortController.signal.aborted) return;
setStats(result);
});

if (userDetails) {
window.electron
.getUnlockedAchievements(objectId, shop as GameShop)
.getUnlockedAchievements(objectId, shop)
.then((achievements) => {
if (abortController.signal.aborted) return;
setAchievements(achievements);
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/pages/catalogue/game-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export function GameItem({ game }: GameItemProps) {

const genres = useMemo(() => {
return game.genres?.map((genre) => {
const index = steamGenres["en"].findIndex(
const index = steamGenres["en"]?.findIndex(
(steamGenre) => steamGenre === genre
);

if (steamGenres[language] && steamGenres[language][index]) {
if (index && steamGenres[language] && steamGenres[language][index]) {
return steamGenres[language][index];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ export function GameOptionsModal({
const shouldShowWinePrefixConfiguration =
window.electron.platform === "linux";

const shouldShowLaunchOptionsConfiguration =
window.electron.platform === "win32";
const shouldShowLaunchOptionsConfiguration = false;

return (
<>
Expand Down

0 comments on commit 1cfe3dc

Please sign in to comment.