warn when a domain is hard-blocked by a base domain

This commit is contained in:
Hazel K 2024-10-05 20:42:31 -04:00
parent ac1e5a0fb5
commit b23d650a15
4 changed files with 36 additions and 8 deletions

View file

@ -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"

20
locales/index.d.ts vendored
View file

@ -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;
};

View file

@ -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: "購読中"

View file

@ -45,8 +45,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkKeyValue>
<MkButton v-if="suspensionState === 'none'" :disabled="!instance" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton>
<MkButton v-if="suspensionState !== 'none'" :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</MkButton>
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
<MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch>
<MkInfo v-if="isBaseBlocked" warn>{{ i18n.ts.blockedByBase }}</MkInfo>
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance || isBaseBlocked" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
<MkInfo v-if="isBaseSilenced" warn>{{ i18n.ts.silenedByBase }}</MkInfo>
<MkSwitch v-model="isSilenced" :disabled="!meta || !instance || isBaseSilenced" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch>
<MkSwitch v-model="isNSFW" :disabled="!instance" @update:modelValue="toggleNSFW">Mark as NSFW</MkSwitch>
<MkSwitch v-model="isMediaSilenced" :disabled="!meta || !instance" @update:modelValue="toggleMediaSilenced">{{ i18n.ts.mediaSilenceThisInstance }}</MkSwitch>
<MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton>
@ -174,6 +176,20 @@ const isMediaSilenced = ref(false);
const faviconUrl = ref<string | null>(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,