paricafe/packages/frontend/src/pages/admin/instance-block.vue

52 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
<FormSuspense :p="init">
2023-01-07 00:09:46 -06:00
<MkTextarea v-model="blockedHosts">
<span>{{ i18n.ts.blockedInstances }}</span>
<template #caption>{{ i18n.ts.blockedInstancesDescription }}</template>
2023-01-07 00:09:46 -06:00
</MkTextarea>
2023-01-05 18:41:14 -06:00
<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
</FormSuspense>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { } from 'vue';
import XHeader from './_header_.vue';
2023-01-05 18:41:14 -06:00
import MkButton from '@/components/MkButton.vue';
2023-01-07 00:09:46 -06:00
import MkTextarea from '@/components/MkTextarea.vue';
2022-01-04 03:47:54 -06:00
import FormSuspense from '@/components/form/suspense.vue';
2021-11-11 11:02:25 -06:00
import * as os from '@/os';
import { fetchInstance } from '@/instance';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
let blockedHosts: string = $ref('');
async function init() {
const meta = await os.api('admin/meta');
blockedHosts = meta.blockedHosts.join('\n');
}
function save() {
os.apiWithDialog('admin/update-meta', {
blockedHosts: blockedHosts.split('\n') || [],
}).then(() => {
fetchInstance();
});
}
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts.instanceBlocking,
icon: 'ti ti-ban',
});
</script>