From b23d650a153ad2e150350fe2c808896ae8a2e3f9 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sat, 5 Oct 2024 20:42:31 -0400 Subject: [PATCH 1/6] 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, From 2bc9ce93b8760b128cd86e4c69ce727fc1f15524 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sun, 6 Oct 2024 10:47:55 -0400 Subject: [PATCH 2/6] add missing import --- packages/frontend/src/pages/instance-info.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 6848a0715a..94c0f4c3a5 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -158,6 +158,7 @@ import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue'; import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js'; import { dateString } from '@/filters/date.js'; import MkTextarea from '@/components/MkTextarea.vue'; +import MkInfo from '@/components/MkInfo.vue'; const props = defineProps<{ host: string; From 008ac896723a3d1f8ad281c3c61ca954cfff4a92 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sun, 6 Oct 2024 10:58:06 -0400 Subject: [PATCH 3/6] fix translation string --- packages/frontend/src/pages/instance-info.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 94c0f4c3a5..1a90abba12 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts._delivery.resume }} {{ i18n.ts.blockedByBase }} {{ i18n.ts.blockThisInstance }} - {{ i18n.ts.silenedByBase }} + {{ i18n.ts.silencedByBase }} {{ i18n.ts.silenceThisInstance }} Mark as NSFW {{ i18n.ts.mediaSilenceThisInstance }} From 605c22b55e9cead59e780de58f3fb5673c961f29 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sun, 6 Oct 2024 10:58:27 -0400 Subject: [PATCH 4/6] add lockout for isMediaSilenced --- packages/frontend/src/pages/instance-info.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 1a90abba12..929c22d114 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -50,7 +50,8 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.silencedByBase }} {{ i18n.ts.silenceThisInstance }} Mark as NSFW - {{ i18n.ts.mediaSilenceThisInstance }} + {{ i18n.ts.mediaSilencedByBase }} + {{ i18n.ts.mediaSilenceThisInstance }} Refresh metadata @@ -190,6 +191,7 @@ const baseDomains = computed(() => { }); 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 isBaseMediaSilenced = computed(() => meta.value && meta.value.mediaSilencedHosts && baseDomains.value.some(d => meta.value?.mediaSilencedHosts.includes(d))); const usersPagination = { endpoint: iAmModerator ? 'admin/show-users' : 'users' as const, From eec4a5082d3adf0164c4d320ac444c35bc43e381 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sun, 6 Oct 2024 11:03:28 -0400 Subject: [PATCH 5/6] fix OpenAPI definition for admin/meta.silencedHosts --- packages/backend/src/server/api/endpoints/admin/meta.ts | 2 +- packages/frontend/src/pages/instance-info.vue | 4 ++-- packages/misskey-js/src/autogen/types.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 5a69fbf679..dbfa31024a 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -128,7 +128,7 @@ export const meta = { }, silencedHosts: { type: 'array', - optional: true, + optional: false, nullable: false, items: { type: 'string', diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 929c22d114..821cd599eb 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -190,8 +190,8 @@ const baseDomains = computed(() => { 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 isBaseMediaSilenced = computed(() => meta.value && meta.value.mediaSilencedHosts && baseDomains.value.some(d => meta.value?.mediaSilencedHosts.includes(d))); +const isBaseSilenced = computed(() => meta.value && baseDomains.value.some(d => meta.value?.silencedHosts.includes(d))); +const isBaseMediaSilenced = computed(() => meta.value && baseDomains.value.some(d => meta.value?.mediaSilencedHosts.includes(d))); const usersPagination = { endpoint: iAmModerator ? 'admin/show-users' : 'users' as const, diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 0e83bdfcca..e3bf828982 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -5199,7 +5199,7 @@ export type operations = { enableEmail: boolean; enableServiceWorker: boolean; translatorAvailable: boolean; - silencedHosts?: string[]; + silencedHosts: string[]; mediaSilencedHosts: string[]; pinnedUsers: string[]; hiddenTags: string[]; From b9e89edbc7cde6a62360fd15eaadf4f7309e2ba6 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sun, 6 Oct 2024 11:16:18 -0400 Subject: [PATCH 6/6] add missing translation --- locales/en-US.yml | 1 + locales/index.d.ts | 4 ++++ locales/ja-JP.yml | 1 + 3 files changed, 6 insertions(+) diff --git a/locales/en-US.yml b/locales/en-US.yml index 4b949b705a..7e24a62022 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -267,6 +267,7 @@ 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)." +mediaSilencedByBase: "This host's media is silenced implicitly because a base domain's media 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 c1001125a0..9a02dbc1e2 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1084,6 +1084,10 @@ export interface Locale extends ILocale { * 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; + /** + * This host's media is silenced implicitly because a base domain's media is silenced. To un-silence this host, first un-silence the base domain(s). + */ + "mediaSilencedByBase": string; /** * 配信停止 */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d6a8faf1e7..c422172eb9 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -267,6 +267,7 @@ 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)." +mediaSilencedByBase: "This host's media is silenced implicitly because a base domain's media is silenced. To un-silence this host, first un-silence the base domain(s)." suspended: "配信停止" all: "全て" subscribing: "購読中"