From 1a018fb6874b0395f547e6130d9c2a424749a1be Mon Sep 17 00:00:00 2001 From: John Harrington <84741727+harr1424@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:22:42 -0700 Subject: [PATCH] revert breaking changes from review suggestions --- .../src/chromium/platform/sandbox.rs | 14 +++++++++----- apps/desktop/desktop_native/napi/index.d.ts | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/desktop/desktop_native/chromium_importer/src/chromium/platform/sandbox.rs b/apps/desktop/desktop_native/chromium_importer/src/chromium/platform/sandbox.rs index d28989c85a3..5bd138bdef0 100644 --- a/apps/desktop/desktop_native/chromium_importer/src/chromium/platform/sandbox.rs +++ b/apps/desktop/desktop_native/chromium_importer/src/chromium/platform/sandbox.rs @@ -19,9 +19,10 @@ const BROWSER_BUNDLE_IDS: &[(&str, &str)] = &[ #[derive(Debug, Deserialize)] #[serde(tag = "type")] enum CommandResult { - #[serde(rename_all = "camelCase")] + // rename = "camelCase" was a review suggestion with breaking changes + #[serde(rename = "success")] Success { value: T }, - #[serde(rename_all = "camelCase")] + #[serde(rename = "error")] Error { error: String }, } @@ -175,8 +176,11 @@ async fn is_browser_installed(browser_name: &str) -> Result { let bundle_id = BROWSER_BUNDLE_IDS .iter() .find(|(name, _)| *name == browser_name) - .map(|(_, id)| *id) - .ok_or(true); + .map(|(_, id)| *id); + + let Some(bundle_id) = bundle_id else { + return Ok(true); // ok_or(true) was a review suggestion with breaking changes + // Avoid ok_or(true): serializes Result as {"Ok": "..."} instead of string value let input = CommandInput { namespace: "chromium_importer".to_string(), @@ -195,7 +199,7 @@ async fn is_browser_installed(browser_name: &str) -> Result { match result { CommandResult::Success { value } => Ok(value.is_installed), - CommandResult::Error { error } => Err(anyhow!("{}", error)), + CommandResult::Error { error} => Err(anyhow!("{}", error)), } } diff --git a/apps/desktop/desktop_native/napi/index.d.ts b/apps/desktop/desktop_native/napi/index.d.ts index 375c65edb8d..f0cfafaf213 100644 --- a/apps/desktop/desktop_native/napi/index.d.ts +++ b/apps/desktop/desktop_native/napi/index.d.ts @@ -130,10 +130,10 @@ export declare namespace biometrics_v2 { } export declare namespace chromium_importer { - export function getAvailableProfiles(browser: string): Array + export function getAvailableProfiles(browser: string, masBuild: boolean): Promise> /** Returns OS aware metadata describing supported Chromium based importers as a JSON string. */ - export function getMetadata(): Record - export function importLogins(browser: string, profileId: string): Promise> + export function getMetadata(masBuild: boolean): Record + export function importLogins(browser: string, profileId: string, masBuild: boolean): Promise> export interface Login { url: string username: string @@ -158,6 +158,7 @@ export declare namespace chromium_importer { id: string name: string } + export function requestBrowserAccess(browser: string, masBuild: boolean): Promise } export declare namespace clipboards {