From 56373d0ab428ea6bdfe9c13549f480747b0a157d Mon Sep 17 00:00:00 2001 From: Rikudou_Sage Date: Mon, 16 Oct 2023 19:22:18 +0200 Subject: [PATCH] Chore: Change blacklist to blocklist (#153) --- .../action-log/action-log.component.html | 4 +- .../pages/action-log/action-log.component.ts | 4 +- ...onse.ts => mastodon-blocklist.response.ts} | 8 ++-- src/app/services/database.service.ts | 6 +-- src/app/services/lemmy-api.service.ts | 2 +- src/app/services/mastodon-api.service.ts | 24 +++++----- .../blocklist-diff.component.html} | 2 +- .../blocklist-diff.component.scss} | 0 .../blocklist-diff.component.ts} | 8 ++-- .../filter-form/filter-form.component.html | 20 ++++---- .../filter-form/filter-form.component.ts | 22 ++++----- .../synchronize-lemmy.component.html | 8 ++-- .../synchronize-lemmy.component.ts | 6 +-- .../synchronize-mastodon.component.html | 24 +++++----- .../synchronize-mastodon.component.ts | 48 +++++++++---------- .../synchronization/synchronization.module.ts | 14 +++--- .../mastodon-domain-blacklist-request.ts | 10 ---- .../mastodon-domain-blocklist-request.ts | 10 ++++ .../mastodon-synchronization-settings.ts | 6 +-- 19 files changed, 113 insertions(+), 113 deletions(-) rename src/app/response/{mastodon-blacklist.response.ts => mastodon-blocklist.response.ts} (61%) rename src/app/synchronization/components/{blacklist-diff/blacklist-diff.component.html => blocklist-diff/blocklist-diff.component.html} (95%) rename src/app/synchronization/components/{blacklist-diff/blacklist-diff.component.scss => blocklist-diff/blocklist-diff.component.scss} (100%) rename src/app/synchronization/components/{blacklist-diff/blacklist-diff.component.ts => blocklist-diff/blocklist-diff.component.ts} (88%) delete mode 100644 src/app/types/mastodon-domain-blacklist-request.ts create mode 100644 src/app/types/mastodon-domain-blocklist-request.ts diff --git a/src/app/action-log/pages/action-log/action-log.component.html b/src/app/action-log/pages/action-log/action-log.component.html index ce59c04..2c0d997 100644 --- a/src/app/action-log/pages/action-log/action-log.component.html +++ b/src/app/action-log/pages/action-log/action-log.component.html @@ -39,10 +39,10 @@

{{"app.filter.title" | transloco}}

-
+
diff --git a/src/app/action-log/pages/action-log/action-log.component.ts b/src/app/action-log/pages/action-log/action-log.component.ts index 8c75470..fd9cb66 100644 --- a/src/app/action-log/pages/action-log/action-log.component.ts +++ b/src/app/action-log/pages/action-log/action-log.component.ts @@ -33,7 +33,7 @@ export class ActionLogComponent implements OnInit { public lastPageReached: boolean = false; public safelistedDomains: string[] | null = null; - public blacklistedDomains: string[] | null = null; + public blocklistedDomains: string[] | null = null; public form = new FormGroup({ type: new FormControl(null), @@ -78,7 +78,7 @@ export class ActionLogComponent implements OnInit { )), ]).then(responses => { this.safelistedDomains = responses[0]; - this.blacklistedDomains = responses[1]; + this.blocklistedDomains = responses[1]; this.filtersLoading = false; }); diff --git a/src/app/response/mastodon-blacklist.response.ts b/src/app/response/mastodon-blocklist.response.ts similarity index 61% rename from src/app/response/mastodon-blacklist.response.ts rename to src/app/response/mastodon-blocklist.response.ts index 6e7b826..95a721c 100644 --- a/src/app/response/mastodon-blacklist.response.ts +++ b/src/app/response/mastodon-blocklist.response.ts @@ -1,15 +1,15 @@ -export enum MastodonBlacklistSeverity { +export enum MastodonBlocklistSeverity { Silence = "silence", Suspend = "suspend", RejectMedia = "noop", Nothing = '', } -export interface MastodonBlacklistItem { +export interface MastodonBlocklistItem { id: string; domain: string; created_at: string; - severity: MastodonBlacklistSeverity; + severity: MastodonBlocklistSeverity; reject_media: boolean; reject_reports: boolean; private_comment: string | null; @@ -17,4 +17,4 @@ export interface MastodonBlacklistItem { obfuscate: boolean; } -export type MastodonBlacklistResponse = MastodonBlacklistItem[]; +export type MastodonBlocklistResponse = MastodonBlocklistItem[]; diff --git a/src/app/services/database.service.ts b/src/app/services/database.service.ts index 267c2e6..f26a9dd 100644 --- a/src/app/services/database.service.ts +++ b/src/app/services/database.service.ts @@ -4,7 +4,7 @@ import {LemmySynchronizationSettings} from "../types/lemmy-synchronization-setti import {CensureListFilters} from "../types/censure-list-filters"; import {SynchronizationMode} from "../types/synchronization-mode"; import {MastodonSynchronizationSettings} from "../types/mastodon-synchronization-settings"; -import {MastodonBlacklistSeverity} from "../response/mastodon-blacklist.response"; +import {MastodonBlocklistSeverity} from "../response/mastodon-blocklist.response"; import {BehaviorSubject, Observable} from "rxjs"; @Injectable({ @@ -123,8 +123,8 @@ export class DatabaseService { ignoreInstanceList: [], ignoreInstances: false, reasonsPublic: false, - censuresMode: MastodonBlacklistSeverity.Suspend, - hesitationsMode: MastodonBlacklistSeverity.Silence, + censuresMode: MastodonBlocklistSeverity.Suspend, + hesitationsMode: MastodonBlocklistSeverity.Silence, }; } diff --git a/src/app/services/lemmy-api.service.ts b/src/app/services/lemmy-api.service.ts index 7cc8c9e..562d80a 100644 --- a/src/app/services/lemmy-api.service.ts +++ b/src/app/services/lemmy-api.service.ts @@ -59,7 +59,7 @@ export class LemmyApiService { ); } - public updateBlacklist(instance: string, jwt: string, newInstancesToBlock: string[]): Observable { + public updateBlocklist(instance: string, jwt: string, newInstancesToBlock: string[]): Observable { const url = `https://${instance}/api/v3/site`; return this.httpClient.put(url, { diff --git a/src/app/services/mastodon-api.service.ts b/src/app/services/mastodon-api.service.ts index 5808b68..b0d6675 100644 --- a/src/app/services/mastodon-api.service.ts +++ b/src/app/services/mastodon-api.service.ts @@ -2,8 +2,8 @@ import {Injectable} from '@angular/core'; import {EMPTY, expand, Observable, reduce} from "rxjs"; import {HttpClient} from "@angular/common/http"; import {AccessTokenResponse} from "../response/access-token.response"; -import {MastodonBlacklistItem, MastodonBlacklistResponse} from "../response/mastodon-blacklist.response"; -import {MastodonDomainBlacklistRequest} from "../types/mastodon-domain-blacklist-request"; +import {MastodonBlocklistItem, MastodonBlocklistResponse} from "../response/mastodon-blocklist.response"; +import {MastodonDomainBlocklistRequest} from "../types/mastodon-domain-blocklist-request"; import {MastodonLinkParserService} from "./mastodon-link-parser.service"; export interface GetTokenOptions { @@ -37,10 +37,10 @@ export class MastodonApiService { return this.httpClient.post(url, formData); } - public getBlacklist(instance: string, token: string): Observable { + public getBlocklist(instance: string, token: string): Observable { const url = `https://${instance}/api/v1/admin/domain_blocks`; - return this.httpClient.get(url, { + return this.httpClient.get(url, { headers: { Authorization: `Bearer ${token}`, }, @@ -53,7 +53,7 @@ export class MastodonApiService { return EMPTY; } - return this.httpClient.get(links.next, { + return this.httpClient.get(links.next, { headers: { Authorization: `Bearer ${token}`, }, @@ -63,19 +63,19 @@ export class MastodonApiService { return EMPTY; }), - reduce((acc, value) => acc.concat(value.body!), []), + reduce((acc, value) => acc.concat(value.body!), []), ) } - public blacklistInstance( + public addInstanceToBlocklist( instance: string, token: string, - instanceToBlacklist: string, - options: MastodonDomainBlacklistRequest = {} - ): Observable { + instanceToBlocklist: string, + options: MastodonDomainBlocklistRequest = {} + ): Observable { const url = `https://${instance}/api/v1/admin/domain_blocks`; - return this.httpClient.post(url, {...options, domain: instanceToBlacklist}, { + return this.httpClient.post(url, {...options, domain: instanceToBlocklist}, { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json', @@ -83,7 +83,7 @@ export class MastodonApiService { }); } - public deleteBlacklist(instance: string, token: string, instanceId: string) { + public deleteFromBlocklist(instance: string, token: string, instanceId: string) { const url = `https://${instance}/api/v1/admin/domain_blocks/${instanceId}`; return this.httpClient.delete<{}>(url, { headers: { diff --git a/src/app/synchronization/components/blacklist-diff/blacklist-diff.component.html b/src/app/synchronization/components/blocklist-diff/blocklist-diff.component.html similarity index 95% rename from src/app/synchronization/components/blacklist-diff/blacklist-diff.component.html rename to src/app/synchronization/components/blocklist-diff/blocklist-diff.component.html index f7cb4bb..2a9224c 100644 --- a/src/app/synchronization/components/blacklist-diff/blacklist-diff.component.html +++ b/src/app/synchronization/components/blocklist-diff/blocklist-diff.component.html @@ -14,7 +14,7 @@ {{instance}} - + diff --git a/src/app/synchronization/components/blacklist-diff/blacklist-diff.component.scss b/src/app/synchronization/components/blocklist-diff/blocklist-diff.component.scss similarity index 100% rename from src/app/synchronization/components/blacklist-diff/blacklist-diff.component.scss rename to src/app/synchronization/components/blocklist-diff/blocklist-diff.component.scss diff --git a/src/app/synchronization/components/blacklist-diff/blacklist-diff.component.ts b/src/app/synchronization/components/blocklist-diff/blocklist-diff.component.ts similarity index 88% rename from src/app/synchronization/components/blacklist-diff/blacklist-diff.component.ts rename to src/app/synchronization/components/blocklist-diff/blocklist-diff.component.ts index 39aa1a4..765c41b 100644 --- a/src/app/synchronization/components/blacklist-diff/blacklist-diff.component.ts +++ b/src/app/synchronization/components/blocklist-diff/blocklist-diff.component.ts @@ -6,11 +6,11 @@ export type OriginalToStringCallback = ((instance: T) => string); export type NewToStringCallback = ((instance: T) => string); @Component({ - selector: 'app-blacklist-diff', - templateUrl: './blacklist-diff.component.html', - styleUrls: ['./blacklist-diff.component.scss'] + selector: 'app-blocklist-diff', + templateUrl: './blocklist-diff.component.html', + styleUrls: ['./blocklist-diff.component.scss'] }) -export class BlacklistDiffComponent implements OnInit, OnChanges { +export class BlocklistDiffComponent implements OnInit, OnChanges { @Input() originalList: TOriginalInstance[] = []; @Input() newList: TNewInstance[] = []; diff --git a/src/app/synchronization/components/filter-form/filter-form.component.html b/src/app/synchronization/components/filter-form/filter-form.component.html index 2aa713c..dcd4c23 100644 --- a/src/app/synchronization/components/filter-form/filter-form.component.html +++ b/src/app/synchronization/components/filter-form/filter-form.component.html @@ -11,7 +11,7 @@ In addition to instances you have censured, all instances censured by instances you have endorsed will be blocked as well. - Only blacklist by your instance and the instances you specify manually will be blocked. + Only blocklist by your instance and the instances you specify manually will be blocked.
@@ -25,10 +25,10 @@
- - + +
- If enabled, your blacklist will be purged before synchronizing the new one. Make sure you've backed up the original one. + If enabled, your blocklist will be purged before synchronizing the new one. Make sure you've backed up the original one.
@@ -36,9 +36,9 @@
- If enabled, only instances with censure reasons you specify will get blacklisted. + If enabled, only instances with censure reasons you specify will get blocklisted.
- Note that your own blacklist is always synchronized in full and this setting is ignored for instances that {{myInstance}} itself censured. + Note that your own blocklist is always synchronized in full and this setting is ignored for instances that {{myInstance}} itself censured.
@@ -52,14 +52,14 @@
- +
- If enabled, you can specify a list of instances that will be excluded from blacklisting even if they match the other rules. + If enabled, you can specify a list of instances that will be excluded from blocking even if they match the other rules.
- Note that instances you endorse are always excluded from blacklisting. + Note that instances you endorse are always excluded from blocking.
- Note that your own blacklist is always synchronized in full and this setting is ignored for instances that {{myInstance}} itself censured. + Note that your own blocklist is always synchronized in full and this setting is ignored for instances that {{myInstance}} itself censured.
diff --git a/src/app/synchronization/components/filter-form/filter-form.component.ts b/src/app/synchronization/components/filter-form/filter-form.component.ts index ccd296d..e958580 100644 --- a/src/app/synchronization/components/filter-form/filter-form.component.ts +++ b/src/app/synchronization/components/filter-form/filter-form.component.ts @@ -54,7 +54,7 @@ export class FilterFormComponent impl public myInstance: string = this.authManager.currentInstanceSnapshot.name; public form = new FormGroup({ - purgeBlacklist: new FormControl(false, [Validators.required]), + purgeBlocklist: new FormControl(false, [Validators.required]), mode: new FormControl(SynchronizationMode.Own, [Validators.required]), customInstances: new FormControl([]), filterByReasons: new FormControl(false), @@ -123,7 +123,7 @@ export class FilterFormComponent impl const settings = this.getSettingsCallback(this.database); this.form.patchValue({ mode: settings.mode, - purgeBlacklist: settings.purge, + purgeBlocklist: settings.purge, filterByReasons: settings.filterByReasons, includeHesitations: settings.includeHesitations, ignoreInstanceList: settings.ignoreInstanceList, @@ -140,7 +140,7 @@ export class FilterFormComponent impl settings.reasonsFilter = changes.reasonsFilter ?? []; settings.mode = changes.mode ?? SynchronizationMode.Own; settings.filterByReasons = changes.filterByReasons ?? false; - settings.purge = changes.purgeBlacklist ?? false; + settings.purge = changes.purgeBlocklist ?? false; settings.customInstances = changes.customInstances ?? []; settings.ignoreInstances = changes.ignoreInstances ?? false; settings.ignoreInstanceList = changes.ignoreInstanceList ?? []; @@ -168,7 +168,7 @@ export class FilterFormComponent impl this.loadCustomInstancesSelect(mode); this._modeChanged.next(mode); }); - this.form.controls.purgeBlacklist.valueChanges.subscribe(purge => { + this.form.controls.purgeBlocklist.valueChanges.subscribe(purge => { if (purge === null) { return; } @@ -187,8 +187,8 @@ export class FilterFormComponent impl this.loadCustomInstancesSelect(this.form.controls.mode.value); this._modeChanged.next(this.form.controls.mode.value); } - if (this.form.controls.purgeBlacklist.value !== null) { - this._purgeChanged.next(this.form.controls.purgeBlacklist.value); + if (this.form.controls.purgeBlocklist.value !== null) { + this._purgeChanged.next(this.form.controls.purgeBlocklist.value); } if (this.form.controls.filterByReasons.value) { this.loadReasons(); @@ -289,9 +289,9 @@ export class FilterFormComponent impl throw new Error(`Unsupported mode: ${mode}`); } - let foreignInstanceBlacklist: InstanceDetailResponse[] = []; + let foreignInstanceBlocklist: InstanceDetailResponse[] = []; if (sourceFrom.length) { - foreignInstanceBlacklist = await (async () => { + foreignInstanceBlocklist = await (async () => { const censures = hesitationsMode === true ? [] : await this.getCensuresByInstances(sourceFrom); const hesitations = hesitationsMode === false || (hesitationsMode === null && !this.form.controls.includeHesitations.value) ? [] @@ -305,21 +305,21 @@ export class FilterFormComponent impl })(); if (this.form.controls.filterByReasons.value && this.form.controls.reasonsFilter.value) { const reasons = this.form.controls.reasonsFilter.value!; - foreignInstanceBlacklist = foreignInstanceBlacklist.filter( + foreignInstanceBlocklist = foreignInstanceBlocklist.filter( instance => NormalizedInstanceDetailResponse.fromInstanceDetail(instance).unmergedCensureReasons.filter( reason => reasons.includes(reason), ).length, ); } if (this.form.controls.ignoreInstances.valid && this.form.controls.ignoreInstanceList.value) { - foreignInstanceBlacklist = foreignInstanceBlacklist.filter( + foreignInstanceBlocklist = foreignInstanceBlocklist.filter( instance => !this.form.controls.ignoreInstanceList.value!.includes(instance.domain), ); } } const myEndorsed = this.cache[`endorsed:${myInstance}`]!.map(instance => instance.domain); - const result = [...this.cache[myInstanceCacheKey]!, ...foreignInstanceBlacklist]; + const result = [...this.cache[myInstanceCacheKey]!, ...foreignInstanceBlocklist]; const handled: string[] = []; return result.filter(instance => { diff --git a/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.html b/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.html index 2a7c7da..d748e57 100644 --- a/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.html +++ b/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.html @@ -60,7 +60,7 @@

Preview

- Preview
- Preview
-

Original blacklist

+

Original blocklist

Please back up this list before attempting any synchronization. - If you move away from this page after a failed operation, there's no way to retrieve the original blacklist. + If you move away from this page after a failed operation, there's no way to retrieve the original blocklist.

diff --git a/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.ts b/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.ts index 2dfbe92..72b5c34 100644 --- a/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.ts +++ b/src/app/synchronization/pages/synchronize-lemmy/synchronize-lemmy.component.ts @@ -18,7 +18,7 @@ import { SaveSettingsCallback } from "../../components/filter-form/filter-form.component"; import {LemmySynchronizationSettings} from "../../../types/lemmy-synchronization-settings"; -import {NewToStringCallback} from "../../components/blacklist-diff/blacklist-diff.component"; +import {NewToStringCallback} from "../../components/blocklist-diff/blocklist-diff.component"; import {SuccessResponse} from "../../../response/success.response"; import {CachedFediseerApiService} from "../../../services/cached-fediseer-api.service"; @@ -68,7 +68,7 @@ export class SynchronizeLemmyComponent implements OnInit { } public async ngOnInit(): Promise { - this.titleService.title = 'Blacklist synchronization - Lemmy'; + this.titleService.title = 'Blocklist synchronization - Lemmy'; const settings = this.database.lemmySynchronizationSettings; this.form.patchValue({ @@ -201,7 +201,7 @@ export class SynchronizeLemmyComponent implements OnInit { ; try { - await toPromise(this.lemmyApi.updateBlacklist(myInstance, jwt, newInstances)); + await toPromise(this.lemmyApi.updateBlocklist(myInstance, jwt, newInstances)); } catch (e) { const error = (e).error.error; this.messageService.createError(`There was an error: ${error}`); diff --git a/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.html b/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.html index 669504c..a7690b4 100644 --- a/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.html +++ b/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.html @@ -70,21 +70,21 @@

Synchronization from Fediseer to Mastodon

- + Silence will make posts from accounts at this instance invisible to anyone who isn't following them. - + Suspend will remove all content, media, and profile data for this instance's accounts from your server. - + Reject media will reject all media files. - + No action will do nothing. @@ -110,7 +110,7 @@

Preview

- Preview - Preview
-

Original blacklist

+

Original blocklist

Please back up this list before attempting any synchronization. - If you move away from this page after a failed operation, there's no way to retrieve the original blacklist. + If you move away from this page after a failed operation, there's no way to retrieve the original blocklist.

diff --git a/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.ts b/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.ts index 3cb5c53..26cf3c7 100644 --- a/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.ts +++ b/src/app/synchronization/pages/synchronize-mastodon/synchronize-mastodon.component.ts @@ -7,7 +7,7 @@ import {AuthenticationManagerService} from "../../../services/authentication-man import {getMastodonRedirectUri, mastodonScopes} from "../mastodon-oauth-callback/mastodon-oauth-callback.component"; import {MastodonApiService} from "../../../services/mastodon-api.service"; import {toPromise} from "../../../types/resolvable"; -import {MastodonBlacklistItem, MastodonBlacklistSeverity} from "../../../response/mastodon-blacklist.response"; +import {MastodonBlocklistItem, MastodonBlocklistSeverity} from "../../../response/mastodon-blocklist.response"; import {MessageService} from "../../../services/message.service"; import { FilterFormResult, @@ -16,7 +16,7 @@ import { } from "../../components/filter-form/filter-form.component"; import {InstanceDetailResponse} from "../../../response/instance-detail.response"; import {SynchronizationMode} from "../../../types/synchronization-mode"; -import {NewToStringCallback, OriginalToStringCallback} from "../../components/blacklist-diff/blacklist-diff.component"; +import {NewToStringCallback, OriginalToStringCallback} from "../../components/blocklist-diff/blocklist-diff.component"; import {NormalizedInstanceDetailResponse} from "../../../response/normalized-instance-detail.response"; import {CachedFediseerApiService} from "../../../services/cached-fediseer-api.service"; import {ApiResponseHelperService} from "../../../services/api-response-helper.service"; @@ -29,9 +29,9 @@ import {SuccessResponse} from "../../../response/success.response"; styleUrls: ['./synchronize-mastodon.component.scss'] }) export class SynchronizeMastodonComponent implements OnInit { - protected readonly MastodonBlacklistSeverity = MastodonBlacklistSeverity; + protected readonly MastodonBlocklistSeverity = MastodonBlocklistSeverity; protected readonly currentInstance = this.authManager.currentInstanceSnapshot.name; - protected readonly mastodonToFediseerSyncNewListCallback: NewToStringCallback = instance => instance.domain; + protected readonly mastodonToFediseerSyncNewListCallback: NewToStringCallback = instance => instance.domain; private syncSettings: MastodonSynchronizationSettings = this.database.mastodonSynchronizationSettings; @@ -42,12 +42,12 @@ export class SynchronizeMastodonComponent implements OnInit { public form = new FormGroup({ reasonsPublic: new FormControl(false), - censuresMode: new FormControl(MastodonBlacklistSeverity.Suspend), - hesitationsMode: new FormControl(MastodonBlacklistSeverity.Silence), + censuresMode: new FormControl(MastodonBlocklistSeverity.Suspend), + hesitationsMode: new FormControl(MastodonBlocklistSeverity.Silence), }); - public originallyBlockedInstances: MastodonBlacklistItem[] = []; - public sourceBlockedInstances: MastodonBlacklistItem[] = []; + public originallyBlockedInstances: MastodonBlocklistItem[] = []; + public sourceBlockedInstances: MastodonBlocklistItem[] = []; public loading: boolean = true; public oauthSetupFinished: boolean = true; @@ -64,7 +64,7 @@ export class SynchronizeMastodonComponent implements OnInit { public getSettingsCallback: GetSettingsCallback = database => { return database.mastodonSynchronizationSettings; } - public instanceToStringCallback: OriginalToStringCallback = instance => instance.domain; + public instanceToStringCallback: OriginalToStringCallback = instance => instance.domain; public loadingPreviewMastodonToFediseer: boolean = true; constructor( @@ -80,7 +80,7 @@ export class SynchronizeMastodonComponent implements OnInit { } public async ngOnInit(): Promise { - this.titleService.title = 'Blacklist synchronization - Mastodon'; + this.titleService.title = 'Blocklist synchronization - Mastodon'; if (!this.syncSettings.oauthToken && (!this.syncSettings.oauthClientId || !this.syncSettings.oauthClientSecret)) { this.oauthForm.patchValue({ @@ -120,8 +120,8 @@ export class SynchronizeMastodonComponent implements OnInit { oauthToken: this.syncSettings.oauthToken, // custom fields reasonsPublic: this.form.controls.reasonsPublic.value ?? false, - censuresMode: this.form.controls.censuresMode.value ?? MastodonBlacklistSeverity.Suspend, - hesitationsMode: this.form.controls.hesitationsMode.value ?? MastodonBlacklistSeverity.Silence, + censuresMode: this.form.controls.censuresMode.value ?? MastodonBlocklistSeverity.Suspend, + hesitationsMode: this.form.controls.hesitationsMode.value ?? MastodonBlocklistSeverity.Silence, } }); @@ -172,9 +172,9 @@ export class SynchronizeMastodonComponent implements OnInit { return getMastodonRedirectUri(); } - private async getBlockedInstancesFromSource(instance: string): Promise { + private async getBlockedInstancesFromSource(instance: string): Promise { try { - return await toPromise(this.mastodonApi.getBlacklist(instance, this.syncSettings.oauthToken!)); + return await toPromise(this.mastodonApi.getBlocklist(instance, this.syncSettings.oauthToken!)); } catch (e) { return null; } @@ -200,7 +200,7 @@ export class SynchronizeMastodonComponent implements OnInit { let censuredInstances: NormalizedInstanceDetailResponse[] = []; let hesitatedInstances: NormalizedInstanceDetailResponse[] = []; - let instancesToRemove: MastodonBlacklistItem[] = []; + let instancesToRemove: MastodonBlocklistItem[] = []; if (filterFormResult.includeHesitationsAsCensures) { censuredInstances = filterFormResult.all @@ -226,33 +226,33 @@ export class SynchronizeMastodonComponent implements OnInit { const responses: Promise[] = []; for (const item of instancesToRemove) { - responses.push(toPromise(this.mastodonApi.deleteBlacklist(myInstance, token, item.id))); + responses.push(toPromise(this.mastodonApi.deleteFromBlocklist(myInstance, token, item.id))); } for (const item of censuredInstances) { - const severity = this.form.controls.censuresMode.value ?? MastodonBlacklistSeverity.Suspend; - if (severity === MastodonBlacklistSeverity.Nothing) { + const severity = this.form.controls.censuresMode.value ?? MastodonBlocklistSeverity.Suspend; + if (severity === MastodonBlocklistSeverity.Nothing) { break; } const reasons = [ ...item.censureReasons, ...item.hesitationReasons, ].join(', '); - responses.push(toPromise(this.mastodonApi.blacklistInstance(myInstance, token, item.domain, { + responses.push(toPromise(this.mastodonApi.addInstanceToBlocklist(myInstance, token, item.domain, { severity: severity, private_comment: reasons, public_comment: this.form.controls.reasonsPublic.value ? reasons : undefined, }))); } for (const item of hesitatedInstances) { - const severity = this.form.controls.hesitationsMode.value ?? MastodonBlacklistSeverity.Silence; - if (severity === MastodonBlacklistSeverity.Nothing) { + const severity = this.form.controls.hesitationsMode.value ?? MastodonBlocklistSeverity.Silence; + if (severity === MastodonBlocklistSeverity.Nothing) { break; } const reasons = [ ...item.censureReasons, ...item.hesitationReasons, ].join(', '); - responses.push(toPromise(this.mastodonApi.blacklistInstance(myInstance, token, item.domain, { + responses.push(toPromise(this.mastodonApi.addInstanceToBlocklist(myInstance, token, item.domain, { severity: severity, private_comment: reasons, public_comment: this.form.controls.reasonsPublic.value ? reasons : undefined, @@ -261,9 +261,9 @@ export class SynchronizeMastodonComponent implements OnInit { try { await Promise.all(responses); - this.messageService.createSuccess('The blacklist was successfully updated.'); + this.messageService.createSuccess('The blocklist was successfully updated.'); } catch (e) { - this.messageService.createError('Failed to update the blacklist.') + this.messageService.createError('Failed to update the blocklist.') } const newBlockedInstances = await this.getBlockedInstancesFromSource(this.authManager.currentInstanceSnapshot.name); diff --git a/src/app/synchronization/synchronization.module.ts b/src/app/synchronization/synchronization.module.ts index 4e40d10..48bdcf4 100644 --- a/src/app/synchronization/synchronization.module.ts +++ b/src/app/synchronization/synchronization.module.ts @@ -1,14 +1,14 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; import {SynchronizeLemmyComponent} from "./pages/synchronize-lemmy/synchronize-lemmy.component"; import {RouterModule, Routes} from "@angular/router"; import {Guards} from "../guards/guards"; import {ReactiveFormsModule} from "@angular/forms"; import {SharedModule} from "../shared/shared.module"; -import { SynchronizeMastodonComponent } from './pages/synchronize-mastodon/synchronize-mastodon.component'; -import { MastodonOauthCallbackComponent } from './pages/mastodon-oauth-callback/mastodon-oauth-callback.component'; -import { BlacklistDiffComponent } from './components/blacklist-diff/blacklist-diff.component'; -import { FilterFormComponent } from './components/filter-form/filter-form.component'; +import {SynchronizeMastodonComponent} from './pages/synchronize-mastodon/synchronize-mastodon.component'; +import {MastodonOauthCallbackComponent} from './pages/mastodon-oauth-callback/mastodon-oauth-callback.component'; +import {BlocklistDiffComponent} from './components/blocklist-diff/blocklist-diff.component'; +import {FilterFormComponent} from './components/filter-form/filter-form.component'; const routes: Routes = [ { @@ -33,7 +33,7 @@ const routes: Routes = [ SynchronizeLemmyComponent, SynchronizeMastodonComponent, MastodonOauthCallbackComponent, - BlacklistDiffComponent, + BlocklistDiffComponent, FilterFormComponent, ], imports: [ diff --git a/src/app/types/mastodon-domain-blacklist-request.ts b/src/app/types/mastodon-domain-blacklist-request.ts deleted file mode 100644 index 69b70e8..0000000 --- a/src/app/types/mastodon-domain-blacklist-request.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {MastodonBlacklistSeverity} from "../response/mastodon-blacklist.response"; - -export interface MastodonDomainBlacklistRequest { - severity?: MastodonBlacklistSeverity; - reject_media?: boolean; - reject_reports?: boolean; - private_comment?: string; - public_comment?: string; - obfuscate?: boolean; -} diff --git a/src/app/types/mastodon-domain-blocklist-request.ts b/src/app/types/mastodon-domain-blocklist-request.ts new file mode 100644 index 0000000..71c57cb --- /dev/null +++ b/src/app/types/mastodon-domain-blocklist-request.ts @@ -0,0 +1,10 @@ +import {MastodonBlocklistSeverity} from "../response/mastodon-blocklist.response"; + +export interface MastodonDomainBlocklistRequest { + severity?: MastodonBlocklistSeverity; + reject_media?: boolean; + reject_reports?: boolean; + private_comment?: string; + public_comment?: string; + obfuscate?: boolean; +} diff --git a/src/app/types/mastodon-synchronization-settings.ts b/src/app/types/mastodon-synchronization-settings.ts index b1de238..5fea256 100644 --- a/src/app/types/mastodon-synchronization-settings.ts +++ b/src/app/types/mastodon-synchronization-settings.ts @@ -1,11 +1,11 @@ import {SynchronizationSettings} from "./synchronization-settings"; -import {MastodonBlacklistSeverity} from "../response/mastodon-blacklist.response"; +import {MastodonBlocklistSeverity} from "../response/mastodon-blocklist.response"; export interface MastodonSynchronizationSettings extends SynchronizationSettings { oauthClientId?: string; oauthClientSecret?: string; oauthToken?: string; reasonsPublic: boolean; - censuresMode: MastodonBlacklistSeverity; - hesitationsMode: MastodonBlacklistSeverity; + censuresMode: MastodonBlocklistSeverity; + hesitationsMode: MastodonBlocklistSeverity; }