From 148e272c4d2dd2871d56f8149d9b0f7020eb0aed Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Sat, 12 Apr 2025 21:34:40 +0100 Subject: [PATCH] fix: removing out from start download --- python_rpc/main.py | 4 ++-- src/renderer/src/hooks/use-feature.ts | 19 +++++++++++-------- .../modals/download-settings-modal.tsx | 4 ++++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/python_rpc/main.py b/python_rpc/main.py index 7646e4ca..173ad460 100644 --- a/python_rpc/main.py +++ b/python_rpc/main.py @@ -148,11 +148,11 @@ def action(): torrent_downloader.start_download(url, data['save_path']) else: if existing_downloader and isinstance(existing_downloader, HttpDownloader): - existing_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'), data.get('allow_multiple_connections', False), data.get('connections_limit', 24)) + existing_downloader.start_download(url, data['save_path'], data.get('header'), data.get('allow_multiple_connections', False), data.get('connections_limit', 24)) else: http_downloader = HttpDownloader(hydra_httpdl_bin) downloads[game_id] = http_downloader - http_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'), data.get('allow_multiple_connections', False), data.get('connections_limit', 24)) + http_downloader.start_download(url, data['save_path'], data.get('header'), data.get('allow_multiple_connections', False), data.get('connections_limit', 24)) downloading_game_id = game_id diff --git a/src/renderer/src/hooks/use-feature.ts b/src/renderer/src/hooks/use-feature.ts index 233c1f30..463cfc36 100644 --- a/src/renderer/src/hooks/use-feature.ts +++ b/src/renderer/src/hooks/use-feature.ts @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useState, useCallback } from "react"; enum Feature { CheckDownloadWritePermission = "CHECK_DOWNLOAD_WRITE_PERMISSION", @@ -16,14 +16,17 @@ export function useFeature() { }); }, []); - const isFeatureEnabled = (feature: Feature) => { - if (!features) { - const features = JSON.parse(localStorage.getItem("features") ?? "[]"); - return features.includes(feature); - } + const isFeatureEnabled = useCallback( + (feature: Feature) => { + if (!features) { + const features = JSON.parse(localStorage.getItem("features") ?? "[]"); + return features.includes(feature); + } - return features.includes(feature); - }; + return features.includes(feature); + }, + [features] + ); return { isFeatureEnabled, diff --git a/src/renderer/src/pages/game-details/modals/download-settings-modal.tsx b/src/renderer/src/pages/game-details/modals/download-settings-modal.tsx index 397af8ce..c06f280b 100644 --- a/src/renderer/src/pages/game-details/modals/download-settings-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/download-settings-modal.tsx @@ -114,11 +114,15 @@ export function DownloadSettingsModal({ return userPreferences?.realDebridApiToken; if (downloader === Downloader.TorBox) return userPreferences?.torBoxApiToken; + if (downloader === Downloader.Hydra) + return isFeatureEnabled(Feature.Nimbus); return true; }); setSelectedDownloader(getDefaultDownloader(filteredDownloaders)); }, [ + Feature, + isFeatureEnabled, getDefaultDownloader, userPreferences?.downloadsPath, downloaders,