From 693e1e76b5b1cbe3ebab89c5340720e0b255c58e Mon Sep 17 00:00:00 2001 From: addison Date: Mon, 7 Feb 2022 11:40:27 -0500 Subject: [PATCH 1/4] [bug] Point autofill at the correct storage key --- src/content/autofiller.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/content/autofiller.ts b/src/content/autofiller.ts index a4a66b647a..2903e6f8cf 100644 --- a/src/content/autofiller.ts +++ b/src/content/autofiller.ts @@ -3,9 +3,18 @@ document.addEventListener("DOMContentLoaded", (event) => { let filledThisHref = false; let delayFillTimeout: number; - const enabledKey = "enableAutoFillOnPageLoad"; - chrome.storage.local.get(enabledKey, (obj: any) => { - if (obj != null && obj[enabledKey] === true) { + const activeUserIdKey = "activeUserId"; + let activeUserId: string; + + chrome.storage.local.get(activeUserIdKey, (obj: any) => { + if (obj == null || obj[activeUserIdKey] == null) { + return; + } + activeUserId = obj[activeUserIdKey]; + }); + + chrome.storage.local.get(activeUserId, (obj: any) => { + if (obj != null && obj[activeUserId].settings.enableAutoFillOnPageLoad === true) { setInterval(() => doFillIfNeeded(), 500); } }); From 6da6e469000209b9f4079e229ee85c4a82e73ce0 Mon Sep 17 00:00:00 2001 From: addison Date: Mon, 7 Feb 2022 11:41:28 -0500 Subject: [PATCH 2/4] [bug] await the vault timeout dropdown change event --- src/popup/settings/settings.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/popup/settings/settings.component.ts b/src/popup/settings/settings.component.ts index 40eff6abbd..3fd3a1a761 100644 --- a/src/popup/settings/settings.component.ts +++ b/src/popup/settings/settings.component.ts @@ -104,8 +104,8 @@ export class SettingsComponent implements OnInit { this.vaultTimeout.setValue(timeout); } this.previousVaultTimeout = this.vaultTimeout.value; - this.vaultTimeout.valueChanges.subscribe((value) => { - this.saveVaultTimeout(value); + this.vaultTimeout.valueChanges.subscribe(async (value) => { + await this.saveVaultTimeout(value); }); const action = await this.stateService.getVaultTimeoutAction(); From 9c7f399a762717368d8de011759208bcdfe39419 Mon Sep 17 00:00:00 2001 From: addison Date: Mon, 7 Feb 2022 11:41:51 -0500 Subject: [PATCH 3/4] [bug] Don't force an active user to init activity recording functions --- src/popup/app.component.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/popup/app.component.ts b/src/popup/app.component.ts index 66d152251a..38ea6d3e81 100644 --- a/src/popup/app.component.ts +++ b/src/popup/app.component.ts @@ -26,6 +26,7 @@ import { routerTransition } from "./app-routing.animations"; }) export class AppComponent implements OnInit { private lastActivity: number = null; + private activeUserId: string; constructor( private toastrService: ToastrService, @@ -46,19 +47,16 @@ export class AppComponent implements OnInit { if (BrowserApi.getBackgroundPage() == null) { return; } - let activeUserId: string = null; this.stateService.activeAccount.subscribe((userId) => { - activeUserId = userId; + this.activeUserId = userId; }); this.ngZone.runOutsideAngular(() => { - if (activeUserId != null) { - window.onmousedown = () => this.recordActivity(activeUserId); - window.ontouchstart = () => this.recordActivity(activeUserId); - window.onclick = () => this.recordActivity(activeUserId); - window.onscroll = () => this.recordActivity(activeUserId); - window.onkeypress = () => this.recordActivity(activeUserId); - } + window.onmousedown = () => this.recordActivity(); + window.ontouchstart = () => this.recordActivity(); + window.onclick = () => this.recordActivity(); + window.onscroll = () => this.recordActivity(); + window.onkeypress = () => this.recordActivity(); }); (window as any).bitwardenPopupMainMessageListener = async ( @@ -171,14 +169,18 @@ export class AppComponent implements OnInit { } } - private async recordActivity(userId: string) { + private async recordActivity() { + if (this.activeUserId == null) { + return; + } + const now = new Date().getTime(); if (this.lastActivity != null && now - this.lastActivity < 250) { return; } this.lastActivity = now; - this.stateService.setLastActive(now, { userId: userId }); + await this.stateService.setLastActive(now, { userId: this.activeUserId }); } private showToast(msg: any) { From ff62c8072e5e4cfbea656cda0a859d69986d02cd Mon Sep 17 00:00:00 2001 From: addison Date: Mon, 7 Feb 2022 11:42:02 -0500 Subject: [PATCH 4/4] [chore] Update jslib --- jslib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jslib b/jslib index 448856cc22..e0cc754d6f 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 448856cc22510086bfddc99e3f1022ee28727694 +Subproject commit e0cc754d6fe962a5e7eae6d1dead8b44606d4853