1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 21:33:27 +00:00

[PM-25521] Move importer metadata to native code (#16695)

* Add importer metadata to native code

* Impl napi code in ts

* Impl napi code in ts

* Fix clippy

* Fix clippy

* remove ts util tests

* Check for installed browsers

* PR fixes

* test fix

* fix clippy

* fix tests

* Bug fix

* clippy fix

* Correct tests

* fix clippy

* fix clippy

* Correct tests

* Correct tests

* [PM-25521] Wire up loading metadata on desktop (#16813)

* Initial commit

* Fix issues regarding now unused feature flag

* Fixed ts-strict issues

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: adudek-bw <adudek@bitwarden.com>

* Remove logic to skip Brave as that now happens via the native code

* Define default capabilities which can be overwritten by specifc client/platform

* Fix DI issues

* Do not overwrite existing importers, just add new ones or update existing ones

* feat: [PM-25521] return metadata directly (not as JSON) (#16882)

* feat: return metadata directly (not as JSON)

* Fix broken builds

Move getMetaData into chromium_importer
Remove chromium_importer_metadata and any related service
Parse object from native instead of json

* Run cargo fmt

* Fix cargo dependency sort order

* Use exposed type from NAPI instead of redefining it.

* Run cargo fmt

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>

* Only enable chromium loader for installed and supported browsers

---------

Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
This commit is contained in:
adudek-bw
2025-10-17 09:46:10 -04:00
committed by GitHub
parent 9ba1de702e
commit 7015663c38
32 changed files with 641 additions and 337 deletions

View File

@@ -221,8 +221,10 @@ import {
UsernameGenerationServiceAbstraction,
} from "@bitwarden/generator-legacy";
import {
DefaultImportMetadataService,
ImportApiService,
ImportApiServiceAbstraction,
ImportMetadataServiceAbstraction,
ImportService,
ImportServiceAbstraction,
} from "@bitwarden/importer-core";
@@ -368,6 +370,7 @@ export default class MainBackground {
authService: AuthServiceAbstraction;
loginEmailService: LoginEmailServiceAbstraction;
importApiService: ImportApiServiceAbstraction;
importMetadataService: ImportMetadataServiceAbstraction;
importService: ImportServiceAbstraction;
exportApiService: VaultExportApiService;
exportService: VaultExportServiceAbstraction;
@@ -1088,6 +1091,18 @@ export default class MainBackground {
this.importApiService = new ImportApiService(this.apiService);
this.importMetadataService = new DefaultImportMetadataService(
createSystemServiceProvider(
new KeyServiceLegacyEncryptorProvider(this.encryptService, this.keyService),
this.stateProvider,
this.policyService,
buildExtensionRegistry(),
this.logService,
this.platformUtilsService,
this.configService,
),
);
this.importService = new ImportService(
this.cipherService,
this.folderService,
@@ -1099,15 +1114,6 @@ export default class MainBackground {
this.pinService,
this.accountService,
this.restrictedItemTypesService,
createSystemServiceProvider(
new KeyServiceLegacyEncryptorProvider(this.encryptService, this.keyService),
this.stateProvider,
this.policyService,
buildExtensionRegistry(),
this.logService,
this.platformUtilsService,
this.configService,
),
);
this.individualVaultExportService = new IndividualVaultExportService(

View File

@@ -4,7 +4,16 @@ import { Router } from "@angular/router";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AsyncActionsModule, ButtonModule, DialogModule } from "@bitwarden/components";
import { ImportComponent } from "@bitwarden/importer-ui";
import {
DefaultImportMetadataService,
ImportMetadataServiceAbstraction,
} from "@bitwarden/importer-core";
import {
ImportComponent,
ImporterProviders,
SYSTEM_SERVICE_PROVIDER,
} from "@bitwarden/importer-ui";
import { safeProvider } from "@bitwarden/ui-common";
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
import { PopupFooterComponent } from "../../../../platform/popup/layout/popup-footer.component";
@@ -25,6 +34,14 @@ import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page
PopupHeaderComponent,
PopOutComponent,
],
providers: [
...ImporterProviders,
safeProvider({
provide: ImportMetadataServiceAbstraction,
useClass: DefaultImportMetadataService,
deps: [SYSTEM_SERVICE_PROVIDER],
}),
],
})
export class ImportBrowserV2Component {
protected disabled = false;