From 9d01a4d382a0815d32e8a216c98bf721f5119c5b Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Mon, 11 Nov 2024 15:29:27 -0500 Subject: [PATCH] update disabled domain terminology to blocked domain terminology --- apps/browser/src/_locales/en/messages.json | 12 +++--- .../popup/settings/autofill-v1.component.html | 4 +- .../popup/settings/autofill.component.html | 2 +- ...nt.html => blocked-domains.component.html} | 12 +++--- ...ponent.ts => blocked-domains.component.ts} | 40 +++++++++---------- .../browser-script-injector.service.ts | 10 ++--- apps/browser/src/popup/app-routing.module.ts | 8 ++-- .../services/domain-settings.service.ts | 21 +++++----- 8 files changed, 55 insertions(+), 54 deletions(-) rename apps/browser/src/autofill/popup/settings/{disabled-domains.component.html => blocked-domains.component.html} (79%) rename apps/browser/src/autofill/popup/settings/{disabled-domains.component.ts => blocked-domains.component.ts} (80%) diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index edf9ee7b65c..60c4bee951a 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -2330,8 +2330,8 @@ "message": "Domains", "description": "A category title describing the concept of web domains" }, - "disabledDomains": { - "message": "Disabled domains" + "blockedDomains": { + "message": "Blocked domains" }, "excludedDomains": { "message": "Excluded domains" @@ -2342,10 +2342,10 @@ "excludedDomainsDescAlt": { "message": "Bitwarden will not ask to save login details for these domains for all logged in accounts. You must refresh the page for changes to take effect." }, - "disabledDomainsDesc": { + "blockedDomainsDesc": { "message": "Bitwarden will be disabled for these domains. You must refresh the page for changes to take effect." }, - "disabledDomainsDescAlt": { + "blockedDomainsDescAlt": { "message": "Bitwarden will be disabled for these domains on all logged in accounts. You must refresh the page for changes to take effect." }, "websiteItemLabel": { @@ -2366,8 +2366,8 @@ } } }, - "disabledDomainsSavedSuccess": { - "message": "Excluded domain changes saved" + "blockedDomainsSavedSuccess": { + "message": "Blocked domain changes saved" }, "excludedDomainsSavedSuccess": { "message": "Excluded domain changes saved" diff --git a/apps/browser/src/autofill/popup/settings/autofill-v1.component.html b/apps/browser/src/autofill/popup/settings/autofill-v1.component.html index 439ec38d922..3352563f55f 100644 --- a/apps/browser/src/autofill/popup/settings/autofill-v1.component.html +++ b/apps/browser/src/autofill/popup/settings/autofill-v1.component.html @@ -260,9 +260,9 @@

{{ "additionalOptions" | i18n }}

diff --git a/apps/browser/src/autofill/popup/settings/autofill.component.html b/apps/browser/src/autofill/popup/settings/autofill.component.html index e31ecc745cc..42326e1b316 100644 --- a/apps/browser/src/autofill/popup/settings/autofill.component.html +++ b/apps/browser/src/autofill/popup/settings/autofill.component.html @@ -269,7 +269,7 @@

{{ "additionalOptions" | i18n }}

- {{ "disabledDomains" | i18n }} + {{ "blockedDomains" | i18n }} diff --git a/apps/browser/src/autofill/popup/settings/disabled-domains.component.html b/apps/browser/src/autofill/popup/settings/blocked-domains.component.html similarity index 79% rename from apps/browser/src/autofill/popup/settings/disabled-domains.component.html rename to apps/browser/src/autofill/popup/settings/blocked-domains.component.html index b72bb14e6b4..f8c72b76a57 100644 --- a/apps/browser/src/autofill/popup/settings/disabled-domains.component.html +++ b/apps/browser/src/autofill/popup/settings/blocked-domains.component.html @@ -1,5 +1,5 @@ - + @@ -8,18 +8,18 @@

{{ - accountSwitcherEnabled ? ("disabledDomainsDescAlt" | i18n) : ("disabledDomainsDesc" | i18n) + accountSwitcherEnabled ? ("blockedDomainsDescAlt" | i18n) : ("blockedDomainsDesc" | i18n) }}

{{ "domainsTitle" | i18n }}

- {{ disabledDomainsState?.length || 0 }} + {{ blockedDomainsState?.length || 0 }}
- + {{ @@ -35,7 +35,7 @@

{{ "domainsTitle" | i18n }}

name="excludedDomain{{ i }}" type="text" (change)="fieldChange()" - [(ngModel)]="disabledDomainsState[i]" + [(ngModel)]="blockedDomainsState[i]" />
{{ domain }}
diff --git a/apps/browser/src/autofill/popup/settings/disabled-domains.component.ts b/apps/browser/src/autofill/popup/settings/blocked-domains.component.ts similarity index 80% rename from apps/browser/src/autofill/popup/settings/disabled-domains.component.ts rename to apps/browser/src/autofill/popup/settings/blocked-domains.component.ts index d32ce2c444f..4861dc8387f 100644 --- a/apps/browser/src/autofill/popup/settings/disabled-domains.component.ts +++ b/apps/browser/src/autofill/popup/settings/blocked-domains.component.ts @@ -36,8 +36,8 @@ import { PopupHeaderComponent } from "../../../platform/popup/layout/popup-heade import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.component"; @Component({ - selector: "app-disabled-domains", - templateUrl: "disabled-domains.component.html", + selector: "app-blocked-domains", + templateUrl: "blocked-domains.component.html", standalone: true, imports: [ ButtonModule, @@ -59,14 +59,14 @@ import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.co TypographyModule, ], }) -export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { +export class BlockedDomainsComponent implements AfterViewInit, OnDestroy { @ViewChildren("uriInput") uriInputElements: QueryList>; accountSwitcherEnabled = false; dataIsPristine = true; isLoading = false; - disabledDomainsState: string[] = []; - storedDisabledDomains: string[] = []; + blockedDomainsState: string[] = []; + storedBlockedDomains: string[] = []; // How many fields should be non-editable before editable fields fieldsEditThreshold: number = 0; @@ -81,7 +81,7 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { } async ngAfterViewInit() { - this.domainSettingsService.disabledInteractionsUris$ + this.domainSettingsService.blockedInteractionsUris$ .pipe(takeUntil(this.destroy$)) .subscribe((neverDomains: NeverDomains) => this.handleStateUpdate(neverDomains)); @@ -97,13 +97,13 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { handleStateUpdate(neverDomains: NeverDomains) { if (neverDomains) { - this.storedDisabledDomains = Object.keys(neverDomains); + this.storedBlockedDomains = Object.keys(neverDomains); } - this.disabledDomainsState = [...this.storedDisabledDomains]; + this.blockedDomainsState = [...this.storedBlockedDomains]; // Do not allow the first x (pre-existing) fields to be edited - this.fieldsEditThreshold = this.storedDisabledDomains.length; + this.fieldsEditThreshold = this.storedBlockedDomains.length; this.dataIsPristine = true; this.isLoading = false; @@ -117,13 +117,13 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { async addNewDomain() { // add empty field to the Domains list interface - this.disabledDomainsState.push(""); + this.blockedDomainsState.push(""); await this.fieldChange(); } async removeDomain(i: number) { - this.disabledDomainsState.splice(i, 1); + this.blockedDomainsState.splice(i, 1); // If a pre-existing field was dropped, lower the edit threshold if (i < this.fieldsEditThreshold) { @@ -146,10 +146,10 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { this.isLoading = true; - const newDisabledDomainsSaveState: NeverDomains = {}; - const uniqueDisabledDomains = new Set(this.disabledDomainsState); + const newBlockedDomainsSaveState: NeverDomains = {}; + const uniqueBlockedDomains = new Set(this.blockedDomainsState); - for (const uri of uniqueDisabledDomains) { + for (const uri of uniqueBlockedDomains) { if (uri && uri !== "") { const validatedHost = Utils.getHostname(uri); @@ -165,13 +165,13 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { return; } - newDisabledDomainsSaveState[validatedHost] = null; + newBlockedDomainsSaveState[validatedHost] = null; } } try { - const existingState = new Set(this.storedDisabledDomains); - const newState = new Set(Object.keys(newDisabledDomainsSaveState)); + const existingState = new Set(this.storedBlockedDomains); + const newState = new Set(Object.keys(newBlockedDomainsSaveState)); const stateIsUnchanged = existingState.size === newState.size && new Set([...existingState, ...newState]).size === existingState.size; @@ -179,19 +179,19 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { // The subscriber updates don't trigger if `setNeverDomains` sets an equivalent state if (stateIsUnchanged) { // Reset UI state directly - const constructedNeverDomainsState = this.storedDisabledDomains.reduce( + const constructedNeverDomainsState = this.storedBlockedDomains.reduce( (neverDomains, uri) => ({ ...neverDomains, [uri]: null }), {}, ); this.handleStateUpdate(constructedNeverDomainsState); } else { - await this.domainSettingsService.setDisabledInteractionsUris(newDisabledDomainsSaveState); + await this.domainSettingsService.setBlockedInteractionsUris(newBlockedDomainsSaveState); } this.platformUtilsService.showToast( "success", null, - this.i18nService.t("disabledDomainsSavedSuccess"), + this.i18nService.t("blockedDomainsSavedSuccess"), ); } catch { this.platformUtilsService.showToast("error", null, this.i18nService.t("unexpectedError")); diff --git a/apps/browser/src/platform/services/browser-script-injector.service.ts b/apps/browser/src/platform/services/browser-script-injector.service.ts index 77c1723af25..e06c924987c 100644 --- a/apps/browser/src/platform/services/browser-script-injector.service.ts +++ b/apps/browser/src/platform/services/browser-script-injector.service.ts @@ -14,7 +14,7 @@ import { } from "./abstractions/script-injector.service"; export class BrowserScriptInjectorService extends ScriptInjectorService { - disabledDomains: Set = null; + blockedDomains: Set = null; private destroy$ = new Subject(); @@ -25,10 +25,10 @@ export class BrowserScriptInjectorService extends ScriptInjectorService { ) { super(); - this.domainSettingsService.disabledInteractionsUris$ + this.domainSettingsService.blockedInteractionsUris$ .pipe(takeUntil(this.destroy$)) .subscribe( - (neverDomains: NeverDomains) => (this.disabledDomains = new Set(Object.keys(neverDomains))), + (neverDomains: NeverDomains) => (this.blockedDomains = new Set(Object.keys(neverDomains))), ); } @@ -48,10 +48,10 @@ export class BrowserScriptInjectorService extends ScriptInjectorService { // Check if the tab URI is on the disabled URIs list const tab = await BrowserApi.getTab(tabId); const tabURL = tab.url ? new URL(tab.url) : null; - const injectionAllowedInTab = !(tabURL && this.disabledDomains?.has(tabURL.hostname)); + const injectionAllowedInTab = !(tabURL && this.blockedDomains?.has(tabURL.hostname)); if (!injectionAllowedInTab) { - throw new Error("This URI of this tab is on the disabled domains list."); + throw new Error("This URI of this tab is on the blocked domains list."); } const injectionDetails = this.buildInjectionDetails(injectDetails, file); diff --git a/apps/browser/src/popup/app-routing.module.ts b/apps/browser/src/popup/app-routing.module.ts index f8337f974b1..32dccc4d608 100644 --- a/apps/browser/src/popup/app-routing.module.ts +++ b/apps/browser/src/popup/app-routing.module.ts @@ -66,7 +66,7 @@ import { Fido2V1Component } from "../autofill/popup/fido2/fido2-v1.component"; import { Fido2Component } from "../autofill/popup/fido2/fido2.component"; import { AutofillV1Component } from "../autofill/popup/settings/autofill-v1.component"; import { AutofillComponent } from "../autofill/popup/settings/autofill.component"; -import { DisabledDomainsComponent } from "../autofill/popup/settings/disabled-domains.component"; +import { BlockedDomainsComponent } from "../autofill/popup/settings/blocked-domains.component"; import { ExcludedDomainsV1Component } from "../autofill/popup/settings/excluded-domains-v1.component"; import { ExcludedDomainsComponent } from "../autofill/popup/settings/excluded-domains.component"; import { NotificationsSettingsV1Component } from "../autofill/popup/settings/notifications-v1.component"; @@ -362,10 +362,10 @@ const routes: Routes = [ data: { state: "sync" } satisfies RouteDataProperties, }, { - path: "disabled-domains", - component: DisabledDomainsComponent, + path: "blocked-domains", + component: BlockedDomainsComponent, canActivate: [authGuard], - data: { state: "disabled-domains" } satisfies RouteDataProperties, + data: { state: "blocked-domains" } satisfies RouteDataProperties, }, ...extensionRefreshSwap(ExcludedDomainsV1Component, ExcludedDomainsComponent, { path: "excluded-domains", diff --git a/libs/common/src/autofill/services/domain-settings.service.ts b/libs/common/src/autofill/services/domain-settings.service.ts index 306451c37b8..416c4a79b4a 100644 --- a/libs/common/src/autofill/services/domain-settings.service.ts +++ b/libs/common/src/autofill/services/domain-settings.service.ts @@ -26,9 +26,10 @@ const NEVER_DOMAINS = new KeyDefinition(DOMAIN_SETTINGS_DISK, "neverDomains", { deserializer: (value: NeverDomains) => value ?? null, }); -const DISABLED_INTERACTIONS_URIS = new KeyDefinition( +// Domain exclusion list for content script injections +const BLOCKED_INTERACTIONS_URIS = new KeyDefinition( DOMAIN_SETTINGS_DISK, - "disabledInteractionsUris", + "blockedInteractionsUris", { deserializer: (value: NeverDomains) => value ?? null, }, @@ -53,8 +54,8 @@ export abstract class DomainSettingsService { setShowFavicons: (newValue: boolean) => Promise; neverDomains$: Observable; setNeverDomains: (newValue: NeverDomains) => Promise; - disabledInteractionsUris$: Observable; - setDisabledInteractionsUris: (newValue: NeverDomains) => Promise; + blockedInteractionsUris$: Observable; + setBlockedInteractionsUris: (newValue: NeverDomains) => Promise; equivalentDomains$: Observable; setEquivalentDomains: (newValue: EquivalentDomains, userId: UserId) => Promise; defaultUriMatchStrategy$: Observable; @@ -69,8 +70,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService { private neverDomainsState: GlobalState; readonly neverDomains$: Observable; - private disabledInteractionsUrisState: GlobalState; - readonly disabledInteractionsUris$: Observable; + private blockedInteractionsUrisState: GlobalState; + readonly blockedInteractionsUris$: Observable; private equivalentDomainsState: ActiveUserState; readonly equivalentDomains$: Observable; @@ -85,8 +86,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService { this.neverDomainsState = this.stateProvider.getGlobal(NEVER_DOMAINS); this.neverDomains$ = this.neverDomainsState.state$.pipe(map((x) => x ?? null)); - this.disabledInteractionsUrisState = this.stateProvider.getGlobal(DISABLED_INTERACTIONS_URIS); - this.disabledInteractionsUris$ = this.disabledInteractionsUrisState.state$.pipe( + this.blockedInteractionsUrisState = this.stateProvider.getGlobal(BLOCKED_INTERACTIONS_URIS); + this.blockedInteractionsUris$ = this.blockedInteractionsUrisState.state$.pipe( map((x) => x ?? null), ); @@ -107,8 +108,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService { await this.neverDomainsState.update(() => newValue); } - async setDisabledInteractionsUris(newValue: NeverDomains): Promise { - await this.disabledInteractionsUrisState.update(() => newValue); + async setBlockedInteractionsUris(newValue: NeverDomains): Promise { + await this.blockedInteractionsUrisState.update(() => newValue); } async setEquivalentDomains(newValue: EquivalentDomains, userId: UserId): Promise {