misskey/packages/client/src/pages/instance-info.vue

224 lines
7.6 KiB
Vue
Raw Normal View History

<template>
2022-01-04 07:36:14 +01:00
<MkSpacer :content-max="600" :margin-min="16" :margin-max="32">
<div v-if="instance" class="_formRoot">
<div class="fnfelxur">
<img :src="instance.iconUrl || instance.faviconUrl" alt="" class="icon"/>
</div>
<MkKeyValue :copy="host" oneline style="margin: 1em 0;">
<template #key>Host</template>
<template #value><span class="_monospace"><MkLink :url="`https://${host}`">{{ host }}</MkLink></span></template>
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>Name</template>
<template #value>{{ instance.name || `(${$ts.unknown})` }}</template>
</MkKeyValue>
<MkKeyValue>
<template #key>{{ $ts.description }}</template>
<template #value>{{ instance.description }}</template>
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.software }}</template>
<template #value><span class="_monospace">{{ instance.softwareName || `(${$ts.unknown})` }} / {{ instance.softwareVersion || `(${$ts.unknown})` }}</span></template>
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.administrator }}</template>
<template #value>{{ instance.maintainerName || `(${$ts.unknown})` }} ({{ instance.maintainerEmail || `(${$ts.unknown})` }})</template>
</MkKeyValue>
<FormSection v-if="iAmModerator">
<template #label>Moderation</template>
<FormSwitch v-model="suspended" class="_formBlock" @update:modelValue="toggleSuspend">{{ $ts.stopActivityDelivery }}</FormSwitch>
<FormSwitch :model-value="isBlocked" class="switch" @update:modelValue="changeBlock">{{ $ts.blockThisInstance }}</FormSwitch>
</FormSection>
<FormSection>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.registeredAt }}</template>
<template #value><MkTime mode="detail" :time="instance.caughtAt"/></template>
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.updatedAt }}</template>
<template #value><MkTime mode="detail" :time="instance.infoUpdatedAt"/></template>
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.latestRequestSentAt }}</template>
<template #value><MkTime v-if="instance.latestRequestSentAt" :time="instance.latestRequestSentAt"/><span v-else>N/A</span></template>
2022-01-04 07:36:14 +01:00
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.latestStatus }}</template>
<template #value>{{ instance.latestStatus ? instance.latestStatus : 'N/A' }}</template>
2022-01-04 07:36:14 +01:00
</MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ $ts.latestRequestReceivedAt }}</template>
<template #value><MkTime v-if="instance.latestRequestReceivedAt" :time="instance.latestRequestReceivedAt"/><span v-else>N/A</span></template>
2022-01-04 07:36:14 +01:00
</MkKeyValue>
</FormSection>
<FormSection>
<MkKeyValue oneline style="margin: 1em 0;">
<template #key>Open Registrations</template>
<template #value>{{ instance.openRegistrations ? $ts.yes : $ts.no }}</template>
2022-01-04 07:36:14 +01:00
</MkKeyValue>
</FormSection>
<FormSection>
<template #label>{{ $ts.statistics }}</template>
<div class="cmhjzshl">
2021-04-16 14:47:12 +02:00
<div class="selects">
2022-01-04 07:36:14 +01:00
<MkSelect v-model="chartSrc" style="margin: 0 10px 0 0; flex: 1;">
<option value="instance-requests">{{ $ts._instanceCharts.requests }}</option>
<option value="instance-users">{{ $ts._instanceCharts.users }}</option>
<option value="instance-users-total">{{ $ts._instanceCharts.usersTotal }}</option>
<option value="instance-notes">{{ $ts._instanceCharts.notes }}</option>
<option value="instance-notes-total">{{ $ts._instanceCharts.notesTotal }}</option>
<option value="instance-ff">{{ $ts._instanceCharts.ff }}</option>
<option value="instance-ff-total">{{ $ts._instanceCharts.ffTotal }}</option>
<option value="instance-drive-usage">{{ $ts._instanceCharts.cacheSize }}</option>
<option value="instance-drive-usage-total">{{ $ts._instanceCharts.cacheSizeTotal }}</option>
<option value="instance-drive-files">{{ $ts._instanceCharts.files }}</option>
<option value="instance-drive-files-total">{{ $ts._instanceCharts.filesTotal }}</option>
2021-04-16 14:47:12 +02:00
</MkSelect>
2021-08-06 15:29:19 +02:00
<MkSelect v-model="chartSpan" style="margin: 0;">
2021-04-16 14:47:12 +02:00
<option value="hour">{{ $ts.perHour }}</option>
<option value="day">{{ $ts.perDay }}</option>
</MkSelect>
</div>
<div class="chart">
2022-01-04 07:36:14 +01:00
<MkChart :src="chartSrc" :span="chartSpan" :limit="90" :args="{ host: host }" :detailed="true"></MkChart>
2021-04-16 14:47:12 +02:00
</div>
</div>
2022-01-04 07:36:14 +01:00
</FormSection>
2022-01-04 14:42:04 +01:00
<MkObjectView tall :value="instance">
</MkObjectView>
2022-01-04 07:36:14 +01:00
<FormSection>
2021-04-19 13:06:23 +02:00
<template #label>Well-known resources</template>
2022-01-04 07:36:14 +01:00
<FormLink :to="`https://${host}/.well-known/host-meta`" external style="margin-bottom: 8px;">host-meta</FormLink>
<FormLink :to="`https://${host}/.well-known/host-meta.json`" external style="margin-bottom: 8px;">host-meta.json</FormLink>
<FormLink :to="`https://${host}/.well-known/nodeinfo`" external style="margin-bottom: 8px;">nodeinfo</FormLink>
<FormLink :to="`https://${host}/robots.txt`" external style="margin-bottom: 8px;">robots.txt</FormLink>
<FormLink :to="`https://${host}/manifest.json`" external style="margin-bottom: 8px;">manifest.json</FormLink>
</FormSection>
</div>
</MkSpacer>
</template>
<script lang="ts">
import { defineAsyncComponent, defineComponent } from 'vue';
2021-11-11 18:02:25 +01:00
import MkChart from '@/components/chart.vue';
2022-01-04 14:42:04 +01:00
import MkObjectView from '@/components/object-view.vue';
2022-01-04 07:36:14 +01:00
import FormTextarea from '@/components/form/textarea.vue';
import FormLink from '@/components/form/link.vue';
import MkLink from '@/components/link.vue';
import FormSection from '@/components/form/section.vue';
import FormButton from '@/components/ui/button.vue';
import MkKeyValue from '@/components/key-value.vue';
2021-11-11 18:02:25 +01:00
import MkSelect from '@/components/form/select.vue';
2022-01-04 07:36:14 +01:00
import FormSwitch from '@/components/form/switch.vue';
2021-11-11 18:02:25 +01:00
import * as os from '@/os';
import number from '@/filters/number';
import bytes from '@/filters/bytes';
import * as symbols from '@/symbols';
export default defineComponent({
components: {
FormTextarea,
2022-01-04 14:42:04 +01:00
MkObjectView,
FormButton,
FormLink,
2022-01-04 07:36:14 +01:00
FormSection,
FormSwitch,
MkKeyValue,
2021-04-16 14:47:12 +02:00
MkSelect,
MkChart,
2022-01-04 07:36:14 +01:00
MkLink,
},
props: {
host: {
type: String,
required: true
}
},
data() {
return {
[symbols.PAGE_INFO]: {
2022-01-04 07:36:14 +01:00
title: this.host,
icon: 'fas fa-info-circle',
2022-01-04 07:36:14 +01:00
bg: 'var(--bg)',
2021-04-16 14:47:12 +02:00
actions: [{
text: `https://${this.host}`,
icon: 'fas fa-external-link-alt',
2021-04-16 14:47:12 +02:00
handler: () => {
window.open(`https://${this.host}`, '_blank');
}
}],
},
instance: null,
2022-01-04 07:36:14 +01:00
suspended: false,
chartSrc: 'instance-requests',
2021-04-16 14:47:12 +02:00
chartSpan: 'hour',
}
},
2022-01-04 07:36:14 +01:00
computed: {
iAmModerator(): boolean {
return this.$i && (this.$i.isAdmin || this.$i.isModerator);
},
isBlocked() {
return this.instance && this.$instance && this.$instance.blockedHosts && this.$instance.blockedHosts.includes(this.instance.host);
}
},
mounted() {
this.fetch();
},
methods: {
number,
bytes,
async fetch() {
this.instance = await os.api('federation/show-instance', {
host: this.host
});
2022-01-04 07:36:14 +01:00
this.suspended = this.instance.isSuspended;
2021-04-16 14:47:12 +02:00
},
2022-01-04 07:36:14 +01:00
changeBlock(e) {
os.api('admin/update-meta', {
blockedHosts: this.isBlocked ? this.meta.blockedHosts.concat([this.instance.host]) : this.meta.blockedHosts.filter(x => x !== this.instance.host)
});
},
async toggleSuspend(v) {
await os.api('admin/federation/update-instance', {
host: this.instance.host,
isSuspended: this.suspended
});
},
}
});
</script>
2021-04-16 14:47:12 +02:00
<style lang="scss" scoped>
.fnfelxur {
2021-04-25 05:31:11 +02:00
> .icon {
2021-04-16 14:47:12 +02:00
display: block;
2022-01-04 07:36:14 +01:00
margin: 0;
2021-04-16 14:47:12 +02:00
height: 64px;
border-radius: 8px;
}
}
.cmhjzshl {
> .selects {
display: flex;
2022-01-04 07:36:14 +01:00
margin: 0 0 16px 0;
2021-04-16 14:47:12 +02:00
}
}
</style>