1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23: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",
"description": "A category title describing the concept of web domains"
},
"disabledDomains": {
"message": "Disabled domains"
"blockedDomains": {
"message": "Blocked domains"
},
"excludedDomains": {
"message": "Excluded domains"
@@ -2336,10 +2336,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": {
@@ -2360,8 +2360,8 @@
}
}
},
"disabledDomainsSavedSuccess": {
"message": "Excluded domain changes saved"
"blockedDomainsSavedSuccess": {
"message": "Blocked domain changes saved"
},
"excludedDomainsSavedSuccess": {
"message": "Excluded domain changes saved"

View File

@@ -260,9 +260,9 @@
<button
type="button"
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>
</button>
</div>

View File

@@ -284,7 +284,7 @@
</bit-section>
<bit-section>
<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>
</bit-item>
</bit-section>

View File

@@ -1,5 +1,5 @@
<popup-page>
<popup-header slot="header" pageTitle="{{ 'disabledDomains' | i18n }}" showBackButton>
<popup-header slot="header" pageTitle="{{ 'blockedDomains' | i18n }}" showBackButton>
<ng-container slot="end">
<app-pop-out></app-pop-out>
</ng-container>
@@ -8,18 +8,18 @@
<div class="tw-bg-background-alt">
<p>
{{
accountSwitcherEnabled ? ("disabledDomainsDescAlt" | i18n) : ("disabledDomainsDesc" | i18n)
accountSwitcherEnabled ? ("blockedDomainsDescAlt" | i18n) : ("blockedDomainsDesc" | i18n)
}}
</p>
<bit-section *ngIf="!isLoading">
<bit-section-header>
<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>
<ng-container *ngIf="disabledDomainsState">
<ng-container *ngIf="blockedDomainsState">
<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-label *ngIf="i >= fieldsEditThreshold">{{
@@ -35,7 +35,7 @@
name="excludedDomain{{ i }}"
type="text"
(change)="fieldChange()"
[(ngModel)]="disabledDomainsState[i]"
[(ngModel)]="blockedDomainsState[i]"
/>
<div id="excludedDomain{{ i }}" *ngIf="i < fieldsEditThreshold">{{ domain }}</div>
</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";
@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<ElementRef<HTMLInputElement>>;
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"));

View File

@@ -16,7 +16,7 @@ import {
} from "./abstractions/script-injector.service";
export class BrowserScriptInjectorService extends ScriptInjectorService {
disabledDomains: Set<string> = null;
blockedDomains: Set<string> = null;
private destroy$ = new Subject<void>();
@@ -27,10 +27,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))),
);
}
@@ -50,10 +50,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);

View File

@@ -76,7 +76,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";
@@ -391,10 +391,10 @@ const routes: Routes = [
data: { elevation: 1 } 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",

View File

@@ -28,9 +28,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,
},
@@ -55,8 +56,8 @@ export abstract class DomainSettingsService {
setShowFavicons: (newValue: boolean) => Promise<void>;
neverDomains$: Observable<NeverDomains>;
setNeverDomains: (newValue: NeverDomains) => Promise<void>;
disabledInteractionsUris$: Observable<NeverDomains>;
setDisabledInteractionsUris: (newValue: NeverDomains) => Promise<void>;
blockedInteractionsUris$: Observable<NeverDomains>;
setBlockedInteractionsUris: (newValue: NeverDomains) => Promise<void>;
equivalentDomains$: Observable<EquivalentDomains>;
setEquivalentDomains: (newValue: EquivalentDomains, userId: UserId) => Promise<void>;
defaultUriMatchStrategy$: Observable<UriMatchStrategySetting>;
@@ -71,8 +72,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
private neverDomainsState: GlobalState<NeverDomains>;
readonly neverDomains$: Observable<NeverDomains>;
private disabledInteractionsUrisState: GlobalState<NeverDomains>;
readonly disabledInteractionsUris$: Observable<NeverDomains>;
private blockedInteractionsUrisState: GlobalState<NeverDomains>;
readonly blockedInteractionsUris$: Observable<NeverDomains>;
private equivalentDomainsState: ActiveUserState<EquivalentDomains>;
readonly equivalentDomains$: Observable<EquivalentDomains>;
@@ -87,8 +88,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),
);
@@ -109,8 +110,8 @@ export class DefaultDomainSettingsService implements DomainSettingsService {
await this.neverDomainsState.update(() => newValue);
}
async setDisabledInteractionsUris(newValue: NeverDomains): Promise<void> {
await this.disabledInteractionsUrisState.update(() => newValue);
async setBlockedInteractionsUris(newValue: NeverDomains): Promise<void> {
await this.blockedInteractionsUrisState.update(() => newValue);
}
async setEquivalentDomains(newValue: EquivalentDomains, userId: UserId): Promise<void> {