diff --git a/jslib b/jslib index e3b3e444db..ad4c81ed84 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit e3b3e444dbff7e4541fa5367ee26bc7ed4d73b26 +Subproject commit ad4c81ed844f42e45467cd4467d993d30b1f8ce0 diff --git a/src/background/main.background.ts b/src/background/main.background.ts index bf83d9c75c..db261f4897 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -129,7 +129,7 @@ export default class MainBackground { this.userService = new UserService(this.tokenService, this.storageService); this.settingsService = new SettingsService(this.userService, this.storageService); this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService, - this.apiService, this.storageService, this.i18n2Service); + this.apiService, this.storageService, this.i18n2Service, this.platformUtilsService, this.utilsService); this.folderService = new FolderService(this.cryptoService, this.userService, () => this.i18nService.noneFolder, this.apiService, this.storageService, this.i18n2Service); this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService, @@ -378,17 +378,12 @@ export default class MainBackground { return; } - const tabDomain = this.platformUtilsService.getDomain(url); - if (tabDomain == null) { - return; - } - this.actionSetBadgeBackgroundColor(chrome.browserAction); this.actionSetBadgeBackgroundColor(this.sidebarAction); this.menuOptionsLoaded = []; try { - const ciphers = await this.cipherService.getAllDecryptedForDomain(tabDomain); + const ciphers = await this.cipherService.getAllDecryptedForUrl(url); ciphers.sort(this.cipherService.sortCiphersByLastUsedThenName); if (contextMenuEnabled) { diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 7c334c1437..e441ed9fc8 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -1,6 +1,7 @@ import { CipherType } from 'jslib/enums'; import { CipherView } from 'jslib/models/view/cipherView'; +import { LoginUriView } from 'jslib/models/view/loginUriView'; import { LoginView } from 'jslib/models/view/loginView'; import { ConstantsService } from 'jslib/services/constants.service'; @@ -181,7 +182,9 @@ export default class RuntimeBackground { this.main.loginsToAdd.splice(i, 1); const loginModel = new LoginView(); - loginModel.uri = loginInfo.uri; + const loginUri = new LoginUriView(); + loginUri.uri = loginInfo.uri; + loginModel.uris = [loginUri]; loginModel.username = loginInfo.username; loginModel.password = loginInfo.password; const model = new CipherView(); @@ -225,8 +228,7 @@ export default class RuntimeBackground { return; } - const ciphers = await this.cipherService.getAllDecryptedForDomain(loginDomain); - + const ciphers = await this.cipherService.getAllDecryptedForUrl(loginInfo.url); let match = false; for (let i = 0; i < ciphers.length; i++) { if (ciphers[i].login.username === loginInfo.username) { diff --git a/src/background/webRequest.background.ts b/src/background/webRequest.background.ts index 326c964d4f..891b152017 100644 --- a/src/background/webRequest.background.ts +++ b/src/background/webRequest.background.ts @@ -27,22 +27,14 @@ export default class WebRequestBackground { return; } - const domain = this.platformUtilsService.getDomain(details.url); - if (domain == null) { - if (callback) { - callback(); - } - return; - } - this.pendingAuthRequests.push(details.requestId); if (this.isFirefox) { return new Promise(async (resolve, reject) => { - await this.resolveAuthCredentials(domain, resolve, reject); + await this.resolveAuthCredentials(details.url, resolve, reject); }); } else { - await this.resolveAuthCredentials(domain, callback, callback); + await this.resolveAuthCredentials(details.url, callback, callback); } }, { urls: ['http://*/*', 'https://*/*'] }, [this.isFirefox ? 'blocking' : 'asyncBlocking']); @@ -54,7 +46,7 @@ export default class WebRequestBackground { private async resolveAuthCredentials(domain: string, success: Function, error: Function) { try { - const ciphers = await this.cipherService.getAllDecryptedForDomain(domain); + const ciphers = await this.cipherService.getAllDecryptedForUrl(domain); if (ciphers == null || ciphers.length !== 1) { error(); return; diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index ac7371cac8..36f552d6fb 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -133,7 +133,7 @@ export class CurrentController { CipherType.Identity, ]; - const ciphers = await this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes); + const ciphers = await this.cipherService.getAllDecryptedForUrl(this.url, otherTypes); const loginCiphers: any = []; const cardCiphers: any = []; const identityCiphers: any = []; diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 2a34f98b49..873b108cf7 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -216,12 +216,7 @@ export default class AutofillService implements AutofillServiceInterface { return; } - const tabDomain = this.platformUtilsService.getDomain(tab.url); - if (tabDomain == null) { - return; - } - - const lastUsedCipher = await this.cipherService.getLastUsedForDomain(tabDomain); + const lastUsedCipher = await this.cipherService.getLastUsedForUrl(tab.url); if (!lastUsedCipher) { return; }