default match detection setting

This commit is contained in:
Kyle Spearrin 2019-01-09 11:59:11 -05:00
parent 65bd33d860
commit 2e9ce15715
2 changed files with 11 additions and 3 deletions

View File

@ -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<UriMatchType>(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)) {

View File

@ -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;
}