1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +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

@@ -72,7 +72,11 @@ import {
import { ImporterMetadata, DataLoader, Loader, Instructions } from "../metadata";
import { ImportOption, ImportResult, ImportType } from "../models";
import { ImportCollectionServiceAbstraction, ImportServiceAbstraction } from "../services";
import {
ImportCollectionServiceAbstraction,
ImportMetadataServiceAbstraction,
ImportServiceAbstraction,
} from "../services";
import { ImportChromeComponent } from "./chrome";
import {
@@ -236,6 +240,7 @@ export class ImportComponent implements OnInit, OnDestroy, AfterViewInit {
protected accountService: AccountService,
private restrictedItemTypesService: RestrictedItemTypesService,
private destroyRef: DestroyRef,
protected importMetadataService: ImportMetadataServiceAbstraction,
) {}
protected get importBlockedByPolicy(): boolean {
@@ -254,9 +259,11 @@ export class ImportComponent implements OnInit, OnDestroy, AfterViewInit {
}
async ngOnInit() {
await this.importMetadataService.init();
this.setImportOptions();
this.importService
this.importMetadataService
.metadata$(this.formGroup.controls.format.valueChanges)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe({

View File

@@ -37,7 +37,9 @@ import {
// FIXME: unify with `SYSTEM_SERVICE_PROVIDER` when migrating it from the generator component module
// to a general module.
const SYSTEM_SERVICE_PROVIDER = new SafeInjectionToken<SystemServiceProvider>("SystemServices");
export const SYSTEM_SERVICE_PROVIDER = new SafeInjectionToken<SystemServiceProvider>(
"SystemServices",
);
/** Import service factories */
export const ImporterProviders: SafeProvider[] = [
@@ -85,7 +87,6 @@ export const ImporterProviders: SafeProvider[] = [
PinServiceAbstraction,
AccountService,
RestrictedItemTypesService,
SYSTEM_SERVICE_PROVIDER,
],
}),
];

View File

@@ -1,3 +1,4 @@
export * from "./dialog";
export * from "./importer-providers";
export { ImportComponent } from "./import.component";