1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

update disabled domain terminology to blocked domain terminology

This commit is contained in:
Jonathan Prusik
2024-11-11 15:29:27 -05:00
parent fd9719c63b
commit 427db638b1
8 changed files with 55 additions and 54 deletions

View File

@@ -2324,8 +2324,8 @@
"message": "Domains", "message": "Domains",
"description": "A category title describing the concept of web domains" "description": "A category title describing the concept of web domains"
}, },
"disabledDomains": { "blockedDomains": {
"message": "Disabled domains" "message": "Blocked domains"
}, },
"excludedDomains": { "excludedDomains": {
"message": "Excluded domains" "message": "Excluded domains"
@@ -2336,10 +2336,10 @@
"excludedDomainsDescAlt": { "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." "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." "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." "message": "Bitwarden will be disabled for these domains on all logged in accounts. You must refresh the page for changes to take effect."
}, },
"websiteItemLabel": { "websiteItemLabel": {
@@ -2360,8 +2360,8 @@
} }
} }
}, },
"disabledDomainsSavedSuccess": { "blockedDomainsSavedSuccess": {
"message": "Excluded domain changes saved" "message": "Blocked domain changes saved"
}, },
"excludedDomainsSavedSuccess": { "excludedDomainsSavedSuccess": {
"message": "Excluded domain changes saved" "message": "Excluded domain changes saved"

View File

@@ -260,9 +260,9 @@
<button <button
type="button" type="button"
class="box-content-row box-content-row-flex text-default" class="box-content-row box-content-row-flex text-default"
routerLink="/disabled-domains" routerLink="/blocked-domains"
> >
<div class="row-main">{{ "disabledDomains" | i18n }}</div> <div class="row-main">{{ "blockedDomains" | i18n }}</div>
<i class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i> <i class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i>
</button> </button>
</div> </div>

View File

@@ -284,7 +284,7 @@
</bit-section> </bit-section>
<bit-section> <bit-section>
<bit-item> <bit-item>
<a bit-item-content routerLink="/disabled-domains">{{ "disabledDomains" | i18n }}</a> <a bit-item-content routerLink="/blocked-domains">{{ "blockedDomains" | i18n }}</a>
<i slot="end" class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i> <i slot="end" class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i>
</bit-item> </bit-item>
</bit-section> </bit-section>

View File

@@ -1,5 +1,5 @@
<popup-page> <popup-page>
<popup-header slot="header" pageTitle="{{ 'disabledDomains' | i18n }}" showBackButton> <popup-header slot="header" pageTitle="{{ 'blockedDomains' | i18n }}" showBackButton>
<ng-container slot="end"> <ng-container slot="end">
<app-pop-out></app-pop-out> <app-pop-out></app-pop-out>
</ng-container> </ng-container>
@@ -8,18 +8,18 @@
<div class="tw-bg-background-alt"> <div class="tw-bg-background-alt">
<p> <p>
{{ {{
accountSwitcherEnabled ? ("disabledDomainsDescAlt" | i18n) : ("disabledDomainsDesc" | i18n) accountSwitcherEnabled ? ("blockedDomainsDescAlt" | i18n) : ("blockedDomainsDesc" | i18n)
}} }}
</p> </p>
<bit-section *ngIf="!isLoading"> <bit-section *ngIf="!isLoading">
<bit-section-header> <bit-section-header>
<h2 bitTypography="h6">{{ "domainsTitle" | i18n }}</h2> <h2 bitTypography="h6">{{ "domainsTitle" | i18n }}</h2>
<span bitTypography="body2" slot="end">{{ disabledDomainsState?.length || 0 }}</span> <span bitTypography="body2" slot="end">{{ blockedDomainsState?.length || 0 }}</span>
</bit-section-header> </bit-section-header>
<ng-container *ngIf="disabledDomainsState"> <ng-container *ngIf="blockedDomainsState">
<bit-item <bit-item
*ngFor="let domain of disabledDomainsState; let i = index; trackBy: trackByFunction" *ngFor="let domain of blockedDomainsState; let i = index; trackBy: trackByFunction"
> >
<bit-item-content> <bit-item-content>
<bit-label *ngIf="i >= fieldsEditThreshold">{{ <bit-label *ngIf="i >= fieldsEditThreshold">{{
@@ -35,7 +35,7 @@
name="excludedDomain{{ i }}" name="excludedDomain{{ i }}"
type="text" type="text"
(change)="fieldChange()" (change)="fieldChange()"
[(ngModel)]="disabledDomainsState[i]" [(ngModel)]="blockedDomainsState[i]"
/> />
<div id="excludedDomain{{ i }}" *ngIf="i < fieldsEditThreshold">{{ domain }}</div> <div id="excludedDomain{{ i }}" *ngIf="i < fieldsEditThreshold">{{ domain }}</div>
</bit-item-content> </bit-item-content>

View File

@@ -36,8 +36,8 @@ import { PopupHeaderComponent } from "../../../platform/popup/layout/popup-heade
import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.component"; import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.component";
@Component({ @Component({
selector: "app-disabled-domains", selector: "app-blocked-domains",
templateUrl: "disabled-domains.component.html", templateUrl: "blocked-domains.component.html",
standalone: true, standalone: true,
imports: [ imports: [
ButtonModule, ButtonModule,
@@ -59,14 +59,14 @@ import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.co
TypographyModule, TypographyModule,
], ],
}) })
export class DisabledDomainsComponent implements AfterViewInit, OnDestroy { export class BlockedDomainsComponent implements AfterViewInit, OnDestroy {
@ViewChildren("uriInput") uriInputElements: QueryList<ElementRef<HTMLInputElement>>; @ViewChildren("uriInput") uriInputElements: QueryList<ElementRef<HTMLInputElement>>;
accountSwitcherEnabled = false; accountSwitcherEnabled = false;
dataIsPristine = true; dataIsPristine = true;
isLoading = false; isLoading = false;
disabledDomainsState: string[] = []; blockedDomainsState: string[] = [];
storedDisabledDomains: string[] = []; storedBlockedDomains: string[] = [];
// How many fields should be non-editable before editable fields // How many fields should be non-editable before editable fields
fieldsEditThreshold: number = 0; fieldsEditThreshold: number = 0;
@@ -81,7 +81,7 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy {
} }
async ngAfterViewInit() { async ngAfterViewInit() {
this.domainSettingsService.disabledInteractionsUris$ this.domainSettingsService.blockedInteractionsUris$
.pipe(takeUntil(this.destroy$)) .pipe(takeUntil(this.destroy$))
.subscribe((neverDomains: NeverDomains) => this.handleStateUpdate(neverDomains)); .subscribe((neverDomains: NeverDomains) => this.handleStateUpdate(neverDomains));
@@ -97,13 +97,13 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy {
handleStateUpdate(neverDomains: NeverDomains) { handleStateUpdate(neverDomains: NeverDomains) {
if (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 // 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.dataIsPristine = true;
this.isLoading = false; this.isLoading = false;
@@ -117,13 +117,13 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy {
async addNewDomain() { async addNewDomain() {
// add empty field to the Domains list interface // add empty field to the Domains list interface
this.disabledDomainsState.push(""); this.blockedDomainsState.push("");
await this.fieldChange(); await this.fieldChange();
} }
async removeDomain(i: number) { 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 a pre-existing field was dropped, lower the edit threshold
if (i < this.fieldsEditThreshold) { if (i < this.fieldsEditThreshold) {
@@ -146,10 +146,10 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy {
this.isLoading = true; this.isLoading = true;
const newDisabledDomainsSaveState: NeverDomains = {}; const newBlockedDomainsSaveState: NeverDomains = {};
const uniqueDisabledDomains = new Set(this.disabledDomainsState); const uniqueBlockedDomains = new Set(this.blockedDomainsState);
for (const uri of uniqueDisabledDomains) { for (const uri of uniqueBlockedDomains) {
if (uri && uri !== "") { if (uri && uri !== "") {
const validatedHost = Utils.getHostname(uri); const validatedHost = Utils.getHostname(uri);
@@ -165,13 +165,13 @@ export class DisabledDomainsComponent implements AfterViewInit, OnDestroy {
return; return;
} }
newDisabledDomainsSaveState[validatedHost] = null; newBlockedDomainsSaveState[validatedHost] = null;
} }
} }
try { try {
const existingState = new Set(this.storedDisabledDomains); const existingState = new Set(this.storedBlockedDomains);
const newState = new Set(Object.keys(newDisabledDomainsSaveState)); const newState = new Set(Object.keys(newBlockedDomainsSaveState));
const stateIsUnchanged = const stateIsUnchanged =
existingState.size === newState.size && existingState.size === newState.size &&
new Set([...existingState, ...newState]).size === existingState.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 // The subscriber updates don't trigger if `setNeverDomains` sets an equivalent state
if (stateIsUnchanged) { if (stateIsUnchanged) {
// Reset UI state directly // Reset UI state directly
const constructedNeverDomainsState = this.storedDisabledDomains.reduce( const constructedNeverDomainsState = this.storedBlockedDomains.reduce(
(neverDomains, uri) => ({ ...neverDomains, [uri]: null }), (neverDomains, uri) => ({ ...neverDomains, [uri]: null }),
{}, {},
); );
this.handleStateUpdate(constructedNeverDomainsState); this.handleStateUpdate(constructedNeverDomainsState);
} else { } else {
await this.domainSettingsService.setDisabledInteractionsUris(newDisabledDomainsSaveState); await this.domainSettingsService.setBlockedInteractionsUris(newBlockedDomainsSaveState);
} }
this.platformUtilsService.showToast( this.platformUtilsService.showToast(
"success", "success",
null, null,
this.i18nService.t("disabledDomainsSavedSuccess"), this.i18nService.t("blockedDomainsSavedSuccess"),
); );
} catch { } catch {
this.platformUtilsService.showToast("error", null, this.i18nService.t("unexpectedError")); this.platformUtilsService.showToast("error", null, this.i18nService.t("unexpectedError"));

View File

@@ -16,7 +16,7 @@ import {
} from "./abstractions/script-injector.service"; } from "./abstractions/script-injector.service";
export class BrowserScriptInjectorService extends ScriptInjectorService { export class BrowserScriptInjectorService extends ScriptInjectorService {
disabledDomains: Set<string> = null; blockedDomains: Set<string> = null;
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
@@ -27,10 +27,10 @@ export class BrowserScriptInjectorService extends ScriptInjectorService {
) { ) {
super(); super();
this.domainSettingsService.disabledInteractionsUris$ this.domainSettingsService.blockedInteractionsUris$
.pipe(takeUntil(this.destroy$)) .pipe(takeUntil(this.destroy$))
.subscribe( .subscribe(
(neverDomains: NeverDomains) => (this.disabledDomains = new Set(Object.keys(neverDomains))), (neverDomains: NeverDomains) => (this.blockedDomains = new Set(Object.keys(neverDomains))),
); );
} }
@@ -50,10 +50,10 @@ export class BrowserScriptInjectorService extends ScriptInjectorService {
// Check if the tab URI is on the disabled URIs list // Check if the tab URI is on the disabled URIs list
const tab = await BrowserApi.getTab(tabId); const tab = await BrowserApi.getTab(tabId);
const tabURL = tab.url ? new URL(tab.url) : null; 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) { 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); const injectionDetails = this.buildInjectionDetails(injectDetails, file);

View File

@@ -76,7 +76,7 @@ import { Fido2V1Component } from "../autofill/popup/fido2/fido2-v1.component";
import { Fido2Component } from "../autofill/popup/fido2/fido2.component"; import { Fido2Component } from "../autofill/popup/fido2/fido2.component";
import { AutofillV1Component } from "../autofill/popup/settings/autofill-v1.component"; import { AutofillV1Component } from "../autofill/popup/settings/autofill-v1.component";
import { AutofillComponent } from "../autofill/popup/settings/autofill.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 { ExcludedDomainsV1Component } from "../autofill/popup/settings/excluded-domains-v1.component";
import { ExcludedDomainsComponent } from "../autofill/popup/settings/excluded-domains.component"; import { ExcludedDomainsComponent } from "../autofill/popup/settings/excluded-domains.component";
import { NotificationsSettingsV1Component } from "../autofill/popup/settings/notifications-v1.component"; import { NotificationsSettingsV1Component } from "../autofill/popup/settings/notifications-v1.component";
@@ -391,10 +391,10 @@ const routes: Routes = [
data: { elevation: 1 } satisfies RouteDataProperties, data: { elevation: 1 } satisfies RouteDataProperties,
}, },
{ {
path: "disabled-domains", path: "blocked-domains",
component: DisabledDomainsComponent, component: BlockedDomainsComponent,
canActivate: [authGuard], canActivate: [authGuard],
data: { state: "disabled-domains" } satisfies RouteDataProperties, data: { state: "blocked-domains" } satisfies RouteDataProperties,
}, },
...extensionRefreshSwap(ExcludedDomainsV1Component, ExcludedDomainsComponent, { ...extensionRefreshSwap(ExcludedDomainsV1Component, ExcludedDomainsComponent, {
path: "excluded-domains", path: "excluded-domains",

View File

@@ -28,9 +28,10 @@ const NEVER_DOMAINS = new KeyDefinition(DOMAIN_SETTINGS_DISK, "neverDomains", {
deserializer: (value: NeverDomains) => value ?? null, 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, DOMAIN_SETTINGS_DISK,
"disabledInteractionsUris", "blockedInteractionsUris",
{ {
deserializer: (value: NeverDomains) => value ?? null, deserializer: (value: NeverDomains) => value ?? null,
}, },
@@ -55,8 +56,8 @@ export abstract class DomainSettingsService {
setShowFavicons: (newValue: boolean) => Promise<void>; setShowFavicons: (newValue: boolean) => Promise<void>;
neverDomains$: Observable<NeverDomains>; neverDomains$: Observable<NeverDomains>;
setNeverDomains: (newValue: NeverDomains) => Promise<void>; setNeverDomains: (newValue: NeverDomains) => Promise<void>;
disabledInteractionsUris$: Observable<NeverDomains>; blockedInteractionsUris$: Observable<NeverDomains>;
setDisabledInteractionsUris: (newValue: NeverDomains) => Promise<void>; setBlockedInteractionsUris: (newValue: NeverDomains) => Promise<void>;
equivalentDomains$: Observable<EquivalentDomains>; equivalentDomains$: Observable<EquivalentDomains>;
setEquivalentDomains: (newValue: EquivalentDomains, userId: UserId) => Promise<void>; setEquivalentDomains: (newValue: EquivalentDomains, userId: UserId) => Promise<void>;
defaultUriMatchStrategy$: Observable<UriMatchStrategySetting>; defaultUriMatchStrategy$: Observable<UriMatchStrategySetting>;
@@ -71,8 +72,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
private neverDomainsState: GlobalState<NeverDomains>; private neverDomainsState: GlobalState<NeverDomains>;
readonly neverDomains$: Observable<NeverDomains>; readonly neverDomains$: Observable<NeverDomains>;
private disabledInteractionsUrisState: GlobalState<NeverDomains>; private blockedInteractionsUrisState: GlobalState<NeverDomains>;
readonly disabledInteractionsUris$: Observable<NeverDomains>; readonly blockedInteractionsUris$: Observable<NeverDomains>;
private equivalentDomainsState: ActiveUserState<EquivalentDomains>; private equivalentDomainsState: ActiveUserState<EquivalentDomains>;
readonly equivalentDomains$: Observable<EquivalentDomains>; readonly equivalentDomains$: Observable<EquivalentDomains>;
@@ -87,8 +88,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
this.neverDomainsState = this.stateProvider.getGlobal(NEVER_DOMAINS); this.neverDomainsState = this.stateProvider.getGlobal(NEVER_DOMAINS);
this.neverDomains$ = this.neverDomainsState.state$.pipe(map((x) => x ?? null)); this.neverDomains$ = this.neverDomainsState.state$.pipe(map((x) => x ?? null));
this.disabledInteractionsUrisState = this.stateProvider.getGlobal(DISABLED_INTERACTIONS_URIS); this.blockedInteractionsUrisState = this.stateProvider.getGlobal(BLOCKED_INTERACTIONS_URIS);
this.disabledInteractionsUris$ = this.disabledInteractionsUrisState.state$.pipe( this.blockedInteractionsUris$ = this.blockedInteractionsUrisState.state$.pipe(
map((x) => x ?? null), map((x) => x ?? null),
); );
@@ -109,8 +110,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
await this.neverDomainsState.update(() => newValue); await this.neverDomainsState.update(() => newValue);
} }
async setDisabledInteractionsUris(newValue: NeverDomains): Promise<void> { async setBlockedInteractionsUris(newValue: NeverDomains): Promise<void> {
await this.disabledInteractionsUrisState.update(() => newValue); await this.blockedInteractionsUrisState.update(() => newValue);
} }
async setEquivalentDomains(newValue: EquivalentDomains, userId: UserId): Promise<void> { async setEquivalentDomains(newValue: EquivalentDomains, userId: UserId): Promise<void> {