diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index 9b90cf50d2..957feedc46 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -43,6 +43,8 @@ import { SettingsService } from '../abstractions/settings.service'; import { StorageService } from '../abstractions/storage.service'; import { UserService } from '../abstractions/user.service'; +import { ConstantsService } from './constants.service'; + import { sequentialize } from '../misc/sequentialize'; import { Utils } from '../misc/utils'; @@ -343,6 +345,11 @@ export class CipherService implements CipherServiceAbstraction { const matchingDomains = result[0]; const ciphers = result[1]; + let defaultMatch = await this.storageService.get(ConstantsService.defaultUriMatch); + if (defaultMatch == null) { + defaultMatch = UriMatchType.Domain; + } + return ciphers.filter((cipher) => { if (includeOtherTypes && includeOtherTypes.indexOf(cipher.type) > -1) { return true; @@ -355,9 +362,8 @@ export class CipherService implements CipherServiceAbstraction { continue; } - switch (u.match) { - case null: - case undefined: + const match = u.match == null ? defaultMatch : u.match; + switch (match) { case UriMatchType.Domain: if (domain != null && u.domain != null && matchingDomains.indexOf(u.domain) > -1) { if (DomainMatchBlacklist.has(u.domain)) { diff --git a/src/services/constants.service.ts b/src/services/constants.service.ts index 246f04c1dd..dc6d0cf89d 100644 --- a/src/services/constants.service.ts +++ b/src/services/constants.service.ts @@ -17,6 +17,7 @@ export class ConstantsService { static readonly autoConfirmFingerprints: string = 'autoConfirmFingerprints'; static readonly dontShowCardsCurrentTab: string = 'dontShowCardsCurrentTab'; static readonly dontShowIdentitiesCurrentTab: string = 'dontShowIdentitiesCurrentTab'; + static readonly defaultUriMatch: string = 'defaultUriMatch'; readonly environmentUrlsKey: string = ConstantsService.environmentUrlsKey; readonly disableGaKey: string = ConstantsService.disableGaKey; @@ -35,4 +36,5 @@ export class ConstantsService { readonly autoConfirmFingerprints: string = ConstantsService.autoConfirmFingerprints; readonly dontShowCardsCurrentTab: string = ConstantsService.dontShowCardsCurrentTab; readonly dontShowIdentitiesCurrentTab: string = ConstantsService.dontShowIdentitiesCurrentTab; + readonly defaultUriMatch: string = ConstantsService.defaultUriMatch; }