Improve usability

This commit is contained in:
syuilo 2021-04-23 14:43:40 +09:00
parent 7cfe515283
commit 2e1dac924e
2 changed files with 14 additions and 7 deletions

View File

@ -738,6 +738,9 @@ user: "ユーザー"
administration: "管理"
accounts: "アカウント"
switch: "切り替え"
noMaintainerInformationWarning: "管理者情報が設定されていません。"
noBotProtectionWarning: "Bot防御が設定されていません。"
configure: "設定する"
_email:
_follow:

View File

@ -1,6 +1,9 @@
<template>
<FormBase>
<FormSuspense :p="init">
<FormInfo v-if="noMaintainerInformation" warn>{{ $ts.noMaintainerInformationWarning }} <MkA to="/instance/settings" class="_link">{{ $ts.configure }}</MkA></FormInfo>
<FormInfo v-if="noBotProtection" warn>{{ $ts.noBotProtectionWarning }} <MkA to="/instance/bot-protection" class="_link">{{ $ts.configure }}</MkA></FormInfo>
<FormSuspense :p="fetchStats" v-slot="{ result: stats }">
<FormGroup>
<FormKeyValueView>
@ -44,7 +47,6 @@
<script lang="ts">
import { computed, defineComponent, markRaw } from 'vue';
import VueJsonPretty from 'vue-json-pretty';
import FormKeyValueView from '@client/components/form/key-value-view.vue';
import FormInput from '@client/components/form/input.vue';
import FormButton from '@client/components/form/button.vue';
@ -72,15 +74,10 @@ export default defineComponent({
FormBase,
FormSuspense,
FormGroup,
FormInfo,
FormKeyValueView,
MkInstanceStats,
MkButton,
MkSelect,
MkInput,
MkContainer,
MkFolder,
XMetrics,
VueJsonPretty,
},
emits: ['info'],
@ -99,6 +96,8 @@ export default defineComponent({
fetchServerInfo: () => os.api('admin/server-info', {}),
fetchJobs: () => os.api('admin/queue/deliver-delayed', {}),
fetchModLogs: () => os.api('admin/show-moderation-logs', {}),
noMaintainerInformation: false,
noBotProtection: false,
}
},
@ -109,6 +108,11 @@ export default defineComponent({
methods: {
async init() {
this.meta = await os.api('meta', { detail: true });
const isEmpty = (x: any) => x == null || x == '';
this.noMaintainerInformation = isEmpty(this.meta.maintainerName) || isEmpty(this.meta.maintainerEmail);
this.noBotProtection = !this.meta.enableHcaptcha && !this.meta.enableRecaptcha;
},
async showInstanceInfo(q) {