mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
fix: security and persistence adjustments
This commit is contained in:
parent
520eb91a55
commit
e1904b853e
@ -2,10 +2,9 @@ import { gameRepository } from "@main/repository";
|
||||
|
||||
import { registerEvent } from "../register-event";
|
||||
import { shell } from "electron";
|
||||
import { exec } from "child_process";
|
||||
import { spawn } from "child_process";
|
||||
import { parseExecutablePath } from "../helpers/parse-executable-path";
|
||||
import { parseLaunchOptions } from "../helpers/parse-launch-options";
|
||||
import { logger } from "@main/services";
|
||||
|
||||
const openGame = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
@ -15,23 +14,15 @@ const openGame = async (
|
||||
) => {
|
||||
const parsedPath = parseExecutablePath(executablePath);
|
||||
const parsedParams = parseLaunchOptions(launchOptions);
|
||||
const executeCommand = `"${parsedPath}" ${parsedParams}`;
|
||||
|
||||
await gameRepository.update({ id: gameId }, { executablePath: parsedPath });
|
||||
await gameRepository.update({ id: gameId }, { executablePath: parsedPath, launchOptions });
|
||||
|
||||
if (process.platform === "linux" || process.platform === "darwin") {
|
||||
shell.openPath(parsedPath);
|
||||
}
|
||||
|
||||
if (process.platform === "win32") {
|
||||
exec(executeCommand.trim(), (err) => {
|
||||
if (err) {
|
||||
logger.error(
|
||||
`Error opening game #${gameId} with command ${executeCommand}`,
|
||||
err
|
||||
);
|
||||
}
|
||||
});
|
||||
spawn(parsedPath, parsedParams, { shell: false });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ export function GameOptionsModal({
|
||||
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [showRemoveGameModal, setShowRemoveGameModal] = useState(false);
|
||||
const [launchOptions, setLaunchOptions] = useState("");
|
||||
const [launchOptions, setLaunchOptions] = useState(game.launchOptions ?? "");
|
||||
|
||||
const {
|
||||
removeGameInstaller,
|
||||
|
Loading…
Reference in New Issue
Block a user