2021-04-22 16:29:33 +03:00
|
|
|
<template>
|
|
|
|
<FormBase>
|
|
|
|
<FormSuspense :p="init">
|
2021-04-23 08:43:40 +03:00
|
|
|
<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>
|
|
|
|
|
2021-04-22 16:29:33 +03:00
|
|
|
<FormSuspense :p="fetchStats" v-slot="{ result: stats }">
|
|
|
|
<FormGroup>
|
|
|
|
<FormKeyValueView>
|
|
|
|
<template #key>Users</template>
|
|
|
|
<template #value>{{ number(stats.originalUsersCount) }}</template>
|
|
|
|
</FormKeyValueView>
|
|
|
|
<FormKeyValueView>
|
|
|
|
<template #key>Notes</template>
|
|
|
|
<template #value>{{ number(stats.originalNotesCount) }}</template>
|
|
|
|
</FormKeyValueView>
|
|
|
|
</FormGroup>
|
|
|
|
</FormSuspense>
|
|
|
|
|
|
|
|
<div class="_formItem">
|
|
|
|
<div class="_formPanel">
|
|
|
|
<MkInstanceStats :chart-limit="300" :detailed="true"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<XMetrics/>
|
|
|
|
|
|
|
|
<FormSuspense :p="fetchServerInfo" v-slot="{ result: serverInfo }">
|
|
|
|
<FormGroup>
|
|
|
|
<FormKeyValueView>
|
|
|
|
<template #key>Node.js</template>
|
|
|
|
<template #value>{{ serverInfo.node }}</template>
|
|
|
|
</FormKeyValueView>
|
|
|
|
<FormKeyValueView>
|
|
|
|
<template #key>PostgreSQL</template>
|
|
|
|
<template #value>{{ serverInfo.psql }}</template>
|
|
|
|
</FormKeyValueView>
|
|
|
|
<FormKeyValueView>
|
|
|
|
<template #key>Redis</template>
|
|
|
|
<template #value>{{ serverInfo.redis }}</template>
|
|
|
|
</FormKeyValueView>
|
|
|
|
</FormGroup>
|
|
|
|
</FormSuspense>
|
|
|
|
</FormSuspense>
|
|
|
|
</FormBase>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { computed, defineComponent, markRaw } from 'vue';
|
|
|
|
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';
|
|
|
|
import FormBase from '@client/components/form/base.vue';
|
|
|
|
import FormGroup from '@client/components/form/group.vue';
|
|
|
|
import FormTextarea from '@client/components/form/textarea.vue';
|
|
|
|
import FormInfo from '@client/components/form/info.vue';
|
|
|
|
import FormSuspense from '@client/components/form/suspense.vue';
|
|
|
|
import MkInstanceStats from '@client/components/instance-stats.vue';
|
|
|
|
import MkButton from '@client/components/ui/button.vue';
|
|
|
|
import MkSelect from '@client/components/ui/select.vue';
|
|
|
|
import MkInput from '@client/components/ui/input.vue';
|
|
|
|
import MkContainer from '@client/components/ui/container.vue';
|
|
|
|
import MkFolder from '@client/components/ui/folder.vue';
|
|
|
|
import { version, url } from '@client/config';
|
2021-08-05 10:34:18 +03:00
|
|
|
import bytes from '@client/filters/bytes';
|
|
|
|
import number from '@client/filters/number';
|
2021-04-22 16:29:33 +03:00
|
|
|
import MkInstanceInfo from './instance.vue';
|
|
|
|
import XMetrics from './metrics.vue';
|
|
|
|
import * as os from '@client/os';
|
|
|
|
import * as symbols from '@client/symbols';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
FormBase,
|
|
|
|
FormSuspense,
|
|
|
|
FormGroup,
|
2021-04-23 08:43:40 +03:00
|
|
|
FormInfo,
|
2021-04-22 16:29:33 +03:00
|
|
|
FormKeyValueView,
|
|
|
|
MkInstanceStats,
|
|
|
|
XMetrics,
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
[symbols.PAGE_INFO]: {
|
|
|
|
title: this.$ts.overview,
|
|
|
|
icon: 'fas fa-tachometer-alt'
|
|
|
|
},
|
|
|
|
page: 'index',
|
|
|
|
version,
|
|
|
|
url,
|
|
|
|
stats: null,
|
2021-05-31 06:02:02 +03:00
|
|
|
meta: null,
|
2021-04-22 16:29:33 +03:00
|
|
|
fetchStats: () => os.api('stats', {}),
|
|
|
|
fetchServerInfo: () => os.api('admin/server-info', {}),
|
|
|
|
fetchJobs: () => os.api('admin/queue/deliver-delayed', {}),
|
|
|
|
fetchModLogs: () => os.api('admin/show-moderation-logs', {}),
|
2021-04-23 08:43:40 +03:00
|
|
|
noMaintainerInformation: false,
|
|
|
|
noBotProtection: false,
|
2021-04-22 16:29:33 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async mounted() {
|
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async init() {
|
|
|
|
this.meta = await os.api('meta', { detail: true });
|
2021-04-23 08:43:40 +03:00
|
|
|
|
|
|
|
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;
|
2021-04-22 16:29:33 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
async showInstanceInfo(q) {
|
|
|
|
let instance = q;
|
|
|
|
if (typeof q === 'string') {
|
|
|
|
instance = await os.api('federation/show-instance', {
|
|
|
|
host: q
|
|
|
|
});
|
|
|
|
}
|
|
|
|
os.popup(MkInstanceInfo, {
|
|
|
|
instance: instance
|
|
|
|
}, {}, 'closed');
|
|
|
|
},
|
|
|
|
|
|
|
|
bytes,
|
|
|
|
|
|
|
|
number,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|