From a4706a7f9a45ea726dd66fc8f90a9cda35791ab3 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Mon, 4 Aug 2025 06:28:42 +0400 Subject: [PATCH] refactor: better handle browser download state in the create profile dialog --- src-tauri/src/browser_runner.rs | 2 +- src/components/change-version-dialog.tsx | 6 +-- src/components/create-profile-dialog.tsx | 57 +++++++++++++++++++----- 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/browser_runner.rs b/src-tauri/src/browser_runner.rs index 3661cdb..f94c00f 100644 --- a/src-tauri/src/browser_runner.rs +++ b/src-tauri/src/browser_runner.rs @@ -185,7 +185,7 @@ impl BrowserRunner { // Set proxy in camoufox config camoufox_config.proxy = Some(proxy_url); - + // Ensure geoip is always enabled for proper geolocation spoofing if camoufox_config.geoip.is_none() { camoufox_config.geoip = Some(serde_json::Value::Bool(true)); diff --git a/src/components/change-version-dialog.tsx b/src/components/change-version-dialog.tsx index ddf6ee8..a219b24 100644 --- a/src/components/change-version-dialog.tsx +++ b/src/components/change-version-dialog.tsx @@ -44,7 +44,7 @@ export function ChangeVersionDialog({ const { downloadedVersions, - isDownloading, + isBrowserDownloading, loadDownloadedVersions, downloadBrowser, isVersionDownloaded, @@ -207,7 +207,7 @@ export function ChangeVersionDialog({ onReleaseTypeSelect={setSelectedReleaseType} availableReleaseTypes={releaseTypes} browser={profile.browser} - isDownloading={isDownloading} + isDownloading={isBrowserDownloading(profile.browser)} onDownload={() => { void handleDownload(); }} @@ -247,7 +247,7 @@ export function ChangeVersionDialog({ onReleaseTypeSelect={setSelectedReleaseType} availableReleaseTypes={releaseTypes} browser={profile.browser} - isDownloading={isDownloading} + isDownloading={isBrowserDownloading(profile.browser)} onDownload={() => { void handleDownload(); }} diff --git a/src/components/create-profile-dialog.tsx b/src/components/create-profile-dialog.tsx index 8cb38b4..f07d5ae 100644 --- a/src/components/create-profile-dialog.tsx +++ b/src/components/create-profile-dialog.tsx @@ -347,6 +347,11 @@ export function CreateProfileDialog({ return bestVersion && isVersionDownloaded(bestVersion.version); }; + // Check if browser is currently downloading + const isBrowserCurrentlyDownloading = (browserStr: string) => { + return isBrowserDownloading(browserStr); + }; + // Get the selected OS for warning const selectedOS = camoufoxConfig.os?.[0]; const currentOS = getCurrentOS(); @@ -428,22 +433,38 @@ export function CreateProfileDialog({