mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
support defaultMatch for getAllDecryptedForUrl
This commit is contained in:
parent
0a20face13
commit
3bf322a904
@ -1,4 +1,5 @@
|
||||
import { CipherType } from '../enums/cipherType';
|
||||
import { UriMatchType } from '../enums/uriMatchType';
|
||||
|
||||
import { CipherData } from '../models/data/cipherData';
|
||||
|
||||
@ -21,7 +22,8 @@ export abstract class CipherService {
|
||||
getAll: () => Promise<Cipher[]>;
|
||||
getAllDecrypted: () => Promise<CipherView[]>;
|
||||
getAllDecryptedForGrouping: (groupingId: string, folder?: boolean) => Promise<CipherView[]>;
|
||||
getAllDecryptedForUrl: (url: string, includeOtherTypes?: CipherType[]) => Promise<CipherView[]>;
|
||||
getAllDecryptedForUrl: (url: string, includeOtherTypes?: CipherType[],
|
||||
defaultMatch?: UriMatchType) => Promise<CipherView[]>;
|
||||
getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>;
|
||||
getLastUsedForUrl: (url: string) => Promise<CipherView>;
|
||||
getNextCipherForUrl: (url: string) => Promise<CipherView>;
|
||||
|
@ -328,7 +328,8 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
});
|
||||
}
|
||||
|
||||
async getAllDecryptedForUrl(url: string, includeOtherTypes?: CipherType[]): Promise<CipherView[]> {
|
||||
async getAllDecryptedForUrl(url: string, includeOtherTypes?: CipherType[],
|
||||
defaultMatch: UriMatchType = null): Promise<CipherView[]> {
|
||||
if (url == null && includeOtherTypes == null) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
@ -354,9 +355,11 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
const matchingDomains = result[0];
|
||||
const ciphers = result[1];
|
||||
|
||||
let defaultMatch = await this.storageService.get<UriMatchType>(ConstantsService.defaultUriMatch);
|
||||
if (defaultMatch == null) {
|
||||
defaultMatch = UriMatchType.Domain;
|
||||
defaultMatch = await this.storageService.get<UriMatchType>(ConstantsService.defaultUriMatch);
|
||||
if (defaultMatch == null) {
|
||||
defaultMatch = UriMatchType.Domain;
|
||||
}
|
||||
}
|
||||
|
||||
return ciphers.filter((cipher) => {
|
||||
|
Loading…
Reference in New Issue
Block a user