From b4488ee3eceb1225911805d23045b81fa222a481 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Mon, 16 Mar 2026 02:57:08 +0400 Subject: [PATCH] refactor: make bypass of paid plan harder --- src-tauri/src/browser_runner.rs | 27 ++++++++++++++++++--------- src/components/profile-data-table.tsx | 13 +++++++++---- src/hooks/use-browser-state.ts | 11 ++++++++--- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src-tauri/src/browser_runner.rs b/src-tauri/src/browser_runner.rs index 5426c64..d33899b 100644 --- a/src-tauri/src/browser_runner.rs +++ b/src-tauri/src/browser_runner.rs @@ -2157,11 +2157,14 @@ impl BrowserRunner { .find(|p| p.id.to_string() == profile_id) .ok_or_else(|| format!("Profile '{profile_id}' not found"))?; - if profile.is_cross_os() { + if profile.is_cross_os() + && !crate::cloud_auth::CLOUD_AUTH + .is_fingerprint_os_allowed(profile.host_os.as_deref()) + .await + { return Err(format!( - "Cannot open URL with profile '{}': it was created on {} and is not supported on this system", + "Cannot open URL with profile '{}': cross-OS fingerprints require a paid subscription", profile.name, - profile.host_os.as_deref().unwrap_or("unknown") )); } @@ -2193,11 +2196,14 @@ pub async fn launch_browser_profile( profile.id ); - if profile.is_cross_os() { + if profile.is_cross_os() + && !crate::cloud_auth::CLOUD_AUTH + .is_fingerprint_os_allowed(profile.host_os.as_deref()) + .await + { return Err(format!( - "Cannot launch profile '{}': it was created on {} and is not supported on this system", + "Cannot launch profile '{}': cross-OS fingerprints require a paid subscription", profile.name, - profile.host_os.as_deref().unwrap_or("unknown") )); } @@ -2510,11 +2516,14 @@ pub async fn launch_browser_profile_with_debugging( remote_debugging_port: Option, headless: bool, ) -> Result { - if profile.is_cross_os() { + if profile.is_cross_os() + && !crate::cloud_auth::CLOUD_AUTH + .is_fingerprint_os_allowed(profile.host_os.as_deref()) + .await + { return Err(format!( - "Cannot launch profile '{}': it was created on {} and is not supported on this system", + "Cannot launch profile '{}': cross-OS fingerprints require a paid subscription", profile.name, - profile.host_os.as_deref().unwrap_or("unknown") )); } diff --git a/src/components/profile-data-table.tsx b/src/components/profile-data-table.tsx index fd6c227..5d8d6fd 100644 --- a/src/components/profile-data-table.tsx +++ b/src/components/profile-data-table.tsx @@ -1100,6 +1100,7 @@ export function ProfilesDataTable({ isUpdating, launchingProfiles, stoppingProfiles, + crossOsUnlocked, ); // Listen for sync status events @@ -2016,12 +2017,13 @@ export function ProfilesDataTable({ ); const isCrossOs = isCrossOsProfile(profile); + const isCrossOsBlocked = isCrossOs && !meta.crossOsUnlocked; const isRunning = meta.isClient && meta.runningProfiles.has(profile.id); const isLaunching = meta.launchingProfiles.has(profile.id); const isStopping = meta.stoppingProfiles.has(profile.id); const isDisabled = - isRunning || isLaunching || isStopping || isCrossOs; + isRunning || isLaunching || isStopping || isCrossOsBlocked; const lockedEmail = meta.getProfileLockEmail(profile.id); const isLocked = meta.isProfileLockedByAnother(profile.id); @@ -2076,12 +2078,13 @@ export function ProfilesDataTable({ const meta = table.options.meta as TableMeta; const profile = row.original; const isCrossOs = isCrossOsProfile(profile); + const isCrossOsBlocked = isCrossOs && !meta.crossOsUnlocked; const isRunning = meta.isClient && meta.runningProfiles.has(profile.id); const isLaunching = meta.launchingProfiles.has(profile.id); const isStopping = meta.stoppingProfiles.has(profile.id); const isDisabled = - isRunning || isLaunching || isStopping || isCrossOs; + isRunning || isLaunching || isStopping || isCrossOsBlocked; return ( boolean, launchingProfiles: Set, stoppingProfiles: Set, + crossOsUnlocked = false, ) { const [isClient, setIsClient] = useState(false); @@ -52,7 +53,7 @@ export function useBrowserState( (profile: BrowserProfile): boolean => { if (!isClient) return false; - if (isCrossOsProfile(profile)) return false; + if (isCrossOsProfile(profile) && !crossOsUnlocked) return false; const isRunning = runningProfiles.has(profile.id); const isLaunching = launchingProfiles.has(profile.id); @@ -80,6 +81,7 @@ export function useBrowserState( isAnyInstanceRunning, launchingProfiles, stoppingProfiles, + crossOsUnlocked, ], ); @@ -157,8 +159,10 @@ export function useBrowserState( if (!isClient) return "Loading..."; if (isCrossOsProfile(profile) && profile.host_os) { - const osName = getOSDisplayName(profile.host_os); - return `This profile was created on ${osName} and is not supported on this system`; + if (!crossOsUnlocked) { + const osName = getOSDisplayName(profile.host_os); + return `This profile was created on ${osName}. A paid subscription is required to launch cross-OS profiles.`; + } } const isRunning = runningProfiles.has(profile.id); @@ -193,6 +197,7 @@ export function useBrowserState( canLaunchProfile, launchingProfiles, stoppingProfiles, + crossOsUnlocked, ], );