mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-09-27 11:41:51 +02:00
refactor: make mullvad handle links the same way tor browser does
This commit is contained in:
@@ -605,9 +605,25 @@ pub async fn smart_open_url(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Mullvad browser: skip if running (can't open URLs in running Mullvad)
|
// For Mullvad browser: Check if any other Mullvad browser is running
|
||||||
if profile.browser == "mullvad-browser" {
|
if profile.browser == "mullvad-browser" {
|
||||||
continue;
|
let mut other_mullvad_running = false;
|
||||||
|
for p in &profiles {
|
||||||
|
if p.browser == "mullvad-browser"
|
||||||
|
&& p.name != profile.name
|
||||||
|
&& runner
|
||||||
|
.check_browser_status(app_handle.clone(), p)
|
||||||
|
.await
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
other_mullvad_running = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if other_mullvad_running {
|
||||||
|
continue; // Skip this one, can't have multiple Mullvad instances
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to open the URL with this running profile
|
// Try to open the URL with this running profile
|
||||||
|
|||||||
@@ -83,12 +83,21 @@ export function ProfileSelectorDialog({
|
|||||||
return isRunning;
|
return isRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Mullvad browser: never allow if running
|
// For Mullvad browser: Check if any Mullvad browser is running
|
||||||
if (profile.browser === "mullvad-browser" && isRunning) {
|
if (profile.browser === "mullvad-browser") {
|
||||||
return false;
|
const runningMullvadProfiles = allProfiles.filter(
|
||||||
|
(p) => p.browser === "mullvad-browser" && runningProfiles.has(p.name),
|
||||||
|
);
|
||||||
|
|
||||||
|
// If no Mullvad browser is running, allow any Mullvad profile
|
||||||
|
if (runningMullvadProfiles.length === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If Mullvad browser(s) are running, only allow the running one(s)
|
||||||
|
return isRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For other browsers: always allow
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
@@ -148,18 +157,14 @@ export function ProfileSelectorDialog({
|
|||||||
const getProfileTooltipContent = (profile: BrowserProfile): string => {
|
const getProfileTooltipContent = (profile: BrowserProfile): string => {
|
||||||
const isRunning = runningProfiles.has(profile.name);
|
const isRunning = runningProfiles.has(profile.name);
|
||||||
|
|
||||||
if (profile.browser === "tor-browser") {
|
if (
|
||||||
// If another TOR profile is running, this one is not available
|
profile.browser === "tor-browser" ||
|
||||||
|
profile.browser === "mullvad-browser"
|
||||||
|
) {
|
||||||
|
// If another TOR/Mullvad profile is running, this one is not available
|
||||||
return "Only 1 instance can run at a time";
|
return "Only 1 instance can run at a time";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.browser === "mullvad-browser") {
|
|
||||||
if (isRunning) {
|
|
||||||
return "Only launching the browser is supported, opening them in a running browser is not yet available";
|
|
||||||
}
|
|
||||||
return "Only launching the browser is supported, opening them in a running browser is not yet available";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
return "URL will open in a new tab in the existing browser window";
|
return "URL will open in a new tab in the existing browser window";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user