From b23d650a153ad2e150350fe2c808896ae8a2e3f9 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sat, 5 Oct 2024 20:42:31 -0400 Subject: [PATCH] warn when a domain is hard-blocked by a base domain --- locales/en-US.yml | 2 ++ locales/index.d.ts | 20 +++++++++++++------ locales/ja-JP.yml | 2 ++ packages/frontend/src/pages/instance-info.vue | 20 +++++++++++++++++-- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 221ade4028..4321c9b5fe 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -263,6 +263,8 @@ noCustomEmojis: "There are no emoji" noJobs: "There are no jobs" federating: "Federating" blocked: "Blocked" +blockedByBase: "This host is blocked implicitly because a base domain is blocked. To unblock this host, first unblock the base domain(s)." +silencedByBase: "This host is silenced implicitly because a base domain is silenced. To un-silence this host, first un-silence the base domain(s)." suspended: "Suspended" all: "All" subscribing: "Subscribing" diff --git a/locales/index.d.ts b/locales/index.d.ts index f93ef14325..530c5008e3 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1068,6 +1068,14 @@ export interface Locale extends ILocale { * ブロック中 */ "blocked": string; + /** + * This host is blocked implicitly because a base domain is blocked. To unblock this host, first unblock the base domain(s). + */ + "blockedByBase": string; + /** + * This host is silenced implicitly because a base domain is silenced. To un-silence this host, first un-silence the base domain(s). + */ + "silencedByBase": string; /** * 配信停止 */ @@ -3128,6 +3136,10 @@ export interface Locale extends ILocale { * 返信にサーバー情報を表示する */ "showTickerOnReplies": string; + /** + * 猫の話し方を無効にする + */ + "disableCatSpeak": string; /** * 検索MFMの検索エンジン */ @@ -4429,10 +4441,6 @@ export interface Locale extends ILocale { * 連合なしにする */ "disableFederationOk": string; - /** - * 猫の話し方を無効にする - */ - "disableCatSpeak": string; /** * 現在このサーバーは招待制です。招待コードをお持ちの方のみ登録できます。 */ @@ -5777,7 +5785,7 @@ export interface Locale extends ILocale { */ "social": string; /** - * バッッブルタイムラインでは、管理者が選択した接続サーバーからのメモを表示できます。 + * バブルタイムラインでは、管理者が選択した接続サーバーからの投稿を表示できます。 */ "bubble": string; /** @@ -9139,7 +9147,7 @@ export interface Locale extends ILocale { */ "global": string; /** - * バッッブル + * バブル */ "bubble": string; }; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 70acc3adf4..ab70767925 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -263,6 +263,8 @@ noCustomEmojis: "絵文字はありません" noJobs: "ジョブはありません" federating: "連合中" blocked: "ブロック中" +blockedByBase: "This host is blocked implicitly because a base domain is blocked. To unblock this host, first unblock the base domain(s)." +silencedByBase: "This host is silenced implicitly because a base domain is silenced. To un-silence this host, first un-silence the base domain(s)." suspended: "配信停止" all: "全て" subscribing: "購読中" diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 4ff26197d8..6848a0715a 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -45,8 +45,10 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts._delivery.stop }} {{ i18n.ts._delivery.resume }} - {{ i18n.ts.blockThisInstance }} - {{ i18n.ts.silenceThisInstance }} + {{ i18n.ts.blockedByBase }} + {{ i18n.ts.blockThisInstance }} + {{ i18n.ts.silenedByBase }} + {{ i18n.ts.silenceThisInstance }} Mark as NSFW {{ i18n.ts.mediaSilenceThisInstance }} Refresh metadata @@ -174,6 +176,20 @@ const isMediaSilenced = ref(false); const faviconUrl = ref(null); const moderationNote = ref(''); +const baseDomains = computed(() => { + const domains: string[] = []; + + const parts = props.host.toLowerCase().split('.'); + for (let s = 1; s < parts.length; s++) { + const domain = parts.slice(s).join('.'); + domains.push(domain); + } + + return domains; +}); +const isBaseBlocked = computed(() => meta.value && baseDomains.value.some(d => meta.value?.blockedHosts.includes(d))); +const isBaseSilenced = computed(() => meta.value && meta.value.silencedHosts && baseDomains.value.some(d => meta.value?.silencedHosts?.includes(d))); + const usersPagination = { endpoint: iAmModerator ? 'admin/show-users' : 'users' as const, limit: 10,