From 820cf65d1383b69fc71b6125b33781bab30a9419 Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser <> Date: Mon, 13 May 2024 22:01:34 +0100 Subject: [PATCH] fix: fixing named pipes on windows --- .eslintrc.cjs | 6 +++++ .husky/commit-msg | 1 - .../downloaders/torrent.downloader.ts | 25 +++++++++---------- src/main/services/steam-grid.ts | 2 +- .../src/pages/settings/settings-general.tsx | 11 ++++---- 5 files changed, 25 insertions(+), 20 deletions(-) delete mode 100644 .husky/commit-msg diff --git a/.eslintrc.cjs b/.eslintrc.cjs index e23081dc..6ec93984 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -19,5 +19,11 @@ module.exports = { }, ], "@typescript-eslint/no-explicit-any": "warn", + "prettier/prettier": [ + "error", + { + endOfLine: "auto", + }, + ], }, }; diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100644 index 0a4b97de..00000000 --- a/.husky/commit-msg +++ /dev/null @@ -1 +0,0 @@ -npx --no -- commitlint --edit $1 diff --git a/src/main/services/downloaders/torrent.downloader.ts b/src/main/services/downloaders/torrent.downloader.ts index 0590f6bf..9476711b 100644 --- a/src/main/services/downloaders/torrent.downloader.ts +++ b/src/main/services/downloaders/torrent.downloader.ts @@ -124,21 +124,20 @@ export class TorrentDownloader extends Downloader { stdio: "inherit", windowsHide: true, }); - return; + } else { + const scriptPath = path.join( + __dirname, + "..", + "..", + "torrent-client", + "main.py" + ); + + cp.spawn("python3", [scriptPath, ...commonArgs], { + stdio: "inherit", + }); } - const scriptPath = path.join( - __dirname, - "..", - "..", - "torrent-client", - "main.py" - ); - - cp.spawn("python3", [scriptPath, ...commonArgs], { - stdio: "inherit", - }); - Promise.all([writePipe.createPipe(), readPipe.createPipe()]).then( async () => { this.attachListener(); diff --git a/src/main/services/steam-grid.ts b/src/main/services/steam-grid.ts index 9cb51d73..d5519342 100644 --- a/src/main/services/steam-grid.ts +++ b/src/main/services/steam-grid.ts @@ -29,7 +29,7 @@ export const getSteamGridData = async ( const searchParams = new URLSearchParams(params); if (!import.meta.env.MAIN_VITE_STEAMGRIDDB_API_KEY) { - throw new Error("STEAMGRIDDB_API_KEY is not set"); + throw new Error("MAIN_VITE_STEAMGRIDDB_API_KEY is not set"); } const response = await axios.get( diff --git a/src/renderer/src/pages/settings/settings-general.tsx b/src/renderer/src/pages/settings/settings-general.tsx index e9b680c8..434093d3 100644 --- a/src/renderer/src/pages/settings/settings-general.tsx +++ b/src/renderer/src/pages/settings/settings-general.tsx @@ -45,6 +45,11 @@ export function SettingsGeneral({ const { t } = useTranslation("settings"); + const handleChange = (values: Partial) => { + setForm((prev) => ({ ...prev, ...values })); + updateUserPreferences(values); + }; + const handleChooseDownloadsPath = async () => { const { filePaths } = await window.electron.showOpenDialog({ defaultPath: form.downloadsPath, @@ -53,15 +58,11 @@ export function SettingsGeneral({ if (filePaths && filePaths.length > 0) { const path = filePaths[0]; + handleChange({ downloadsPath: path }); updateUserPreferences({ downloadsPath: path }); } }; - const handleChange = (values: Partial) => { - setForm((prev) => ({ ...prev, ...values })); - updateUserPreferences(values); - }; - return ( <>