mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
refactor(client): refactor admin/instance-block to use Composition API (#8663)
This commit is contained in:
parent
18307c822c
commit
bf6cc34961
@ -2,57 +2,45 @@
|
|||||||
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
||||||
<FormSuspense :p="init">
|
<FormSuspense :p="init">
|
||||||
<FormTextarea v-model="blockedHosts" class="_formBlock">
|
<FormTextarea v-model="blockedHosts" class="_formBlock">
|
||||||
<span>{{ $ts.blockedInstances }}</span>
|
<span>{{ i18n.ts.blockedInstances }}</span>
|
||||||
<template #caption>{{ $ts.blockedInstancesDescription }}</template>
|
<template #caption>{{ i18n.ts.blockedInstancesDescription }}</template>
|
||||||
</FormTextarea>
|
</FormTextarea>
|
||||||
|
|
||||||
<FormButton primary class="_formBlock" @click="save"><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
<FormButton primary class="_formBlock" @click="save"><i class="fas fa-save"></i> {{ i18n.ts.save }}</FormButton>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
import FormButton from '@/components/ui/button.vue';
|
import FormButton from '@/components/ui/button.vue';
|
||||||
import FormTextarea from '@/components/form/textarea.vue';
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
import FormSuspense from '@/components/form/suspense.vue';
|
import FormSuspense from '@/components/form/suspense.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
import { fetchInstance } from '@/instance';
|
import { fetchInstance } from '@/instance';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
export default defineComponent({
|
let blockedHosts: string = $ref('');
|
||||||
components: {
|
|
||||||
FormButton,
|
|
||||||
FormTextarea,
|
|
||||||
FormSuspense,
|
|
||||||
},
|
|
||||||
|
|
||||||
emits: ['info'],
|
async function init() {
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
[symbols.PAGE_INFO]: {
|
|
||||||
title: this.$ts.instanceBlocking,
|
|
||||||
icon: 'fas fa-ban',
|
|
||||||
bg: 'var(--bg)',
|
|
||||||
},
|
|
||||||
blockedHosts: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
async init() {
|
|
||||||
const meta = await os.api('admin/meta');
|
const meta = await os.api('admin/meta');
|
||||||
this.blockedHosts = meta.blockedHosts.join('\n');
|
blockedHosts = meta.blockedHosts.join('\n');
|
||||||
},
|
}
|
||||||
|
|
||||||
save() {
|
function save() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
blockedHosts: this.blockedHosts.split('\n') || [],
|
blockedHosts: blockedHosts.split('\n') || [],
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
fetchInstance();
|
fetchInstance();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
[symbols.PAGE_INFO]: {
|
||||||
|
title: i18n.ts.instanceBlocking,
|
||||||
|
icon: 'fas fa-ban',
|
||||||
|
bg: 'var(--bg)',
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user