1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00

[PS-1134] Folder fixes, including revamped auth logic (#3118)

This commit is contained in:
Oscar Hinton
2022-07-18 14:39:12 +02:00
committed by GitHub
parent cd5aef1757
commit fbff2e5f00
11 changed files with 65 additions and 49 deletions

View File

@@ -44,7 +44,6 @@ import { ApiService } from "@bitwarden/common/services/api.service";
import { AppIdService } from "@bitwarden/common/services/appId.service";
import { AuditService } from "@bitwarden/common/services/audit.service";
import { AuthService } from "@bitwarden/common/services/auth.service";
import { BroadcasterService } from "@bitwarden/common/services/broadcaster.service";
import { CipherService } from "@bitwarden/common/services/cipher.service";
import { CollectionService } from "@bitwarden/common/services/collection.service";
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
@@ -150,7 +149,6 @@ export default class MainBackground {
vaultFilterService: VaultFilterService;
usernameGenerationService: UsernameGenerationServiceAbstraction;
encryptService: EncryptService;
broadcasterService: BroadcasterService;
folderApiService: FolderApiServiceAbstraction;
// Passed to the popup for Safari to workaround issues with theming, downloading, etc.
@@ -272,13 +270,11 @@ export default class MainBackground {
this.logService,
this.stateService
);
this.broadcasterService = new BroadcasterService();
this.folderService = new FolderService(
this.cryptoService,
this.i18nService,
this.cipherService,
this.stateService,
this.broadcasterService
this.stateService
);
this.folderApiService = new FolderApiService(this.folderService, this.apiService);
this.collectionService = new CollectionService(

View File

@@ -13,7 +13,6 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { AppIdService } from "@bitwarden/common/abstractions/appId.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { AuthService as AuthServiceAbstraction } from "@bitwarden/common/abstractions/auth.service";
import { BroadcasterService as BroadcasterServiceAbstraction } from "@bitwarden/common/abstractions/broadcaster.service";
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
@@ -114,10 +113,6 @@ function getBgService<T>(service: keyof MainBackground) {
: new BrowserMessagingService();
},
},
{
provide: BroadcasterServiceAbstraction,
useFactory: getBgService<BroadcasterServiceAbstraction>("broadcasterService"),
},
{
provide: TwoFactorService,
useFactory: getBgService<TwoFactorService>("twoFactorService"),

View File

@@ -206,8 +206,7 @@ export class Main {
this.cryptoService,
this.i18nService,
this.cipherService,
this.stateService,
this.broadcasterService
this.stateService
);
this.folderApiService = new FolderApiService(this.folderService, this.apiService);

View File

@@ -1,5 +1,3 @@
import { firstValueFrom } from "rxjs";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
@@ -360,7 +358,7 @@ export class GetCommand extends DownloadCommand {
decFolder = await folder.decrypt();
}
} else if (id.trim() !== "") {
let folders = await firstValueFrom(this.folderService.folderViews$);
let folders = await this.folderService.getAllDecryptedFromState();
folders = CliUtils.searchFolders(folders, id);
if (folders.length > 1) {
return Response.multipleResults(folders.map((f) => f.id));

View File

@@ -1,5 +1,3 @@
import { firstValueFrom } from "rxjs";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
@@ -128,7 +126,7 @@ export class ListCommand {
}
private async listFolders(options: Options) {
let folders = await firstValueFrom(this.folderService.folderViews$);
let folders = await this.folderService.getAllDecryptedFromState();
if (options.search != null && options.search.trim() !== "") {
folders = CliUtils.searchFolders(folders, options.search);