2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-04-22 22:29:33 +09:00
|
|
|
<template>
|
2022-06-20 17:38:49 +09:00
|
|
|
<MkStickyContainer>
|
2023-10-16 20:11:27 +09:00
|
|
|
<template #header><XHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 20:52:15 +09:00
|
|
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
2022-06-20 17:38:49 +09:00
|
|
|
<FormSuspense :p="init">
|
2023-10-16 20:11:27 +09:00
|
|
|
<MkTextarea v-if="tab === 'block'" v-model="blockedHosts">
|
2022-06-20 17:38:49 +09:00
|
|
|
<span>{{ i18n.ts.blockedInstances }}</span>
|
|
|
|
<template #caption>{{ i18n.ts.blockedInstancesDescription }}</template>
|
2023-01-07 15:09:46 +09:00
|
|
|
</MkTextarea>
|
2023-10-16 20:11:27 +09:00
|
|
|
<MkTextarea v-else-if="tab === 'silence'" v-model="silencedHosts" class="_formBlock">
|
|
|
|
<span>{{ i18n.ts.silencedInstances }}</span>
|
|
|
|
<template #caption>{{ i18n.ts.silencedInstancesDescription }}</template>
|
|
|
|
</MkTextarea>
|
2023-01-06 09:41:14 +09:00
|
|
|
<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
2022-06-20 17:38:49 +09:00
|
|
|
</FormSuspense>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-22 22:29:33 +09:00
|
|
|
</template>
|
|
|
|
|
2022-05-18 01:31:59 +09:00
|
|
|
<script lang="ts" setup>
|
2022-06-20 17:38:49 +09:00
|
|
|
import XHeader from './_header_.vue';
|
2023-01-06 09:41:14 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-07 15:09:46 +09:00
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
2022-01-04 18:47:54 +09:00
|
|
|
import FormSuspense from '@/components/form/suspense.vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { fetchInstance } from '@/instance.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2021-04-22 22:29:33 +09:00
|
|
|
|
2022-05-18 01:31:59 +09:00
|
|
|
let blockedHosts: string = $ref('');
|
2023-10-16 20:11:27 +09:00
|
|
|
let silencedHosts: string = $ref('');
|
|
|
|
let tab = $ref('block');
|
2021-04-22 22:29:33 +09:00
|
|
|
|
2022-05-18 01:31:59 +09:00
|
|
|
async function init() {
|
|
|
|
const meta = await os.api('admin/meta');
|
|
|
|
blockedHosts = meta.blockedHosts.join('\n');
|
2023-10-16 20:11:27 +09:00
|
|
|
silencedHosts = meta.silencedHosts.join('\n');
|
2022-05-18 01:31:59 +09:00
|
|
|
}
|
2021-04-22 22:29:33 +09:00
|
|
|
|
2022-05-18 01:31:59 +09:00
|
|
|
function save() {
|
|
|
|
os.apiWithDialog('admin/update-meta', {
|
|
|
|
blockedHosts: blockedHosts.split('\n') || [],
|
2023-10-16 20:11:27 +09:00
|
|
|
silencedHosts: silencedHosts.split('\n') || [],
|
|
|
|
|
2022-05-18 01:31:59 +09:00
|
|
|
}).then(() => {
|
|
|
|
fetchInstance();
|
|
|
|
});
|
|
|
|
}
|
2021-04-22 22:29:33 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
2023-10-16 20:11:27 +09:00
|
|
|
const headerTabs = $computed(() => [{
|
|
|
|
key: 'block',
|
|
|
|
title: i18n.ts.block,
|
|
|
|
icon: 'ti ti-ban',
|
|
|
|
}, {
|
|
|
|
key: 'silence',
|
|
|
|
title: i18n.ts.silence,
|
|
|
|
icon: 'ti ti-eye-off',
|
|
|
|
}]);
|
2022-06-20 17:38:49 +09:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.instanceBlocking,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-ban',
|
2021-04-22 22:29:33 +09:00
|
|
|
});
|
|
|
|
</script>
|