2022-06-20 13:49:51 +03:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
2022-06-22 10:29:21 +03:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2022-06-21 11:55:38 +03:00
|
|
|
<MkSpacer v-if="instance" :content-max="600" :margin-min="16" :margin-max="32">
|
|
|
|
<div v-if="tab === 'overview'" class="_formRoot">
|
2022-06-20 13:49:51 +03:00
|
|
|
<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>
|
2022-01-04 08:36:14 +02:00
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-06-20 13:49:51 +03:00
|
|
|
<template #key>Name</template>
|
|
|
|
<template #value>{{ instance.name || `(${$ts.unknown})` }}</template>
|
2022-01-04 08:36:14 +02:00
|
|
|
</MkKeyValue>
|
2022-06-20 13:49:51 +03:00
|
|
|
<MkKeyValue>
|
|
|
|
<template #key>{{ $ts.description }}</template>
|
|
|
|
<template #value>{{ instance.description }}</template>
|
2022-01-04 08:36:14 +02:00
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-06-20 13:49:51 +03:00
|
|
|
<template #key>{{ $ts.software }}</template>
|
|
|
|
<template #value><span class="_monospace">{{ instance.softwareName || `(${$ts.unknown})` }} / {{ instance.softwareVersion || `(${$ts.unknown})` }}</span></template>
|
2022-01-04 08:36:14 +02:00
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-06-20 13:49:51 +03:00
|
|
|
<template #key>{{ $ts.administrator }}</template>
|
|
|
|
<template #value>{{ instance.maintainerName || `(${$ts.unknown})` }} ({{ instance.maintainerEmail || `(${$ts.unknown})` }})</template>
|
2022-01-04 08:36:14 +02:00
|
|
|
</MkKeyValue>
|
2022-06-20 13:49:51 +03:00
|
|
|
|
|
|
|
<FormSection v-if="iAmModerator">
|
|
|
|
<template #label>Moderation</template>
|
|
|
|
<FormSwitch v-model="suspended" class="_formBlock" @update:modelValue="toggleSuspend">{{ $ts.stopActivityDelivery }}</FormSwitch>
|
|
|
|
<FormSwitch v-model="isBlocked" class="_formBlock" @update:modelValue="toggleBlock">{{ $ts.blockThisInstance }}</FormSwitch>
|
|
|
|
<MkButton @click="refreshMetadata">Refresh metadata</MkButton>
|
|
|
|
</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>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<template #key>{{ $ts.latestStatus }}</template>
|
|
|
|
<template #value>{{ instance.latestStatus ? instance.latestStatus : 'N/A' }}</template>
|
|
|
|
</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>
|
|
|
|
</MkKeyValue>
|
|
|
|
</FormSection>
|
2022-01-04 08:36:14 +02:00
|
|
|
|
2022-06-20 13:49:51 +03:00
|
|
|
<FormSection>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<template #key>Open Registrations</template>
|
|
|
|
<template #value>{{ instance.openRegistrations ? $ts.yes : $ts.no }}</template>
|
|
|
|
</MkKeyValue>
|
|
|
|
</FormSection>
|
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<template #label>Well-known resources</template>
|
|
|
|
<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>
|
2022-06-21 18:10:34 +03:00
|
|
|
<div v-else-if="tab === 'chart'" class="_formRoot">
|
2022-06-21 11:55:38 +03:00
|
|
|
<div class="cmhjzshl">
|
|
|
|
<div class="selects">
|
|
|
|
<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>
|
|
|
|
</MkSelect>
|
|
|
|
</div>
|
|
|
|
<div class="charts">
|
|
|
|
<div class="label">{{ i18n.t('recentNHours', { n: 90 }) }}</div>
|
|
|
|
<MkChart class="chart" :src="chartSrc" span="hour" :limit="90" :args="{ host: host }" :detailed="true"></MkChart>
|
|
|
|
<div class="label">{{ i18n.t('recentNDays', { n: 90 }) }}</div>
|
|
|
|
<MkChart class="chart" :src="chartSrc" span="day" :limit="90" :args="{ host: host }" :detailed="true"></MkChart>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-21 18:10:34 +03:00
|
|
|
<div v-else-if="tab === 'raw'" class="_formRoot">
|
2022-06-21 11:55:38 +03:00
|
|
|
<MkObjectView tall :value="instance">
|
|
|
|
</MkObjectView>
|
|
|
|
</div>
|
2022-06-20 13:49:51 +03:00
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-16 11:34:06 +03:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 14:30:17 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
|
|
|
import * as misskey from 'misskey-js';
|
2021-11-11 19:02:25 +02:00
|
|
|
import MkChart from '@/components/chart.vue';
|
2022-01-04 15:42:04 +02:00
|
|
|
import MkObjectView from '@/components/object-view.vue';
|
2022-01-04 08:36:14 +02:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
|
|
|
import MkLink from '@/components/link.vue';
|
2022-01-31 13:38:26 +02:00
|
|
|
import MkButton from '@/components/ui/button.vue';
|
2022-01-04 08:36:14 +02:00
|
|
|
import FormSection from '@/components/form/section.vue';
|
|
|
|
import MkKeyValue from '@/components/key-value.vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import MkSelect from '@/components/form/select.vue';
|
2022-01-04 08:36:14 +02:00
|
|
|
import FormSwitch from '@/components/form/switch.vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import * as os from '@/os';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import bytes from '@/filters/bytes';
|
2022-01-18 14:30:17 +02:00
|
|
|
import { iAmModerator } from '@/account';
|
2022-06-20 11:38:49 +03:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-06-21 11:55:38 +03:00
|
|
|
import { i18n } from '@/i18n';
|
2022-01-18 14:30:17 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
host: string;
|
|
|
|
}>();
|
|
|
|
|
2022-06-21 11:55:38 +03:00
|
|
|
let tab = $ref('overview');
|
2022-06-21 18:10:34 +03:00
|
|
|
let chartSrc = $ref('instance-requests');
|
2022-01-18 14:30:17 +02:00
|
|
|
let meta = $ref<misskey.entities.DetailedInstanceMetadata | null>(null);
|
|
|
|
let instance = $ref<misskey.entities.Instance | null>(null);
|
|
|
|
let suspended = $ref(false);
|
|
|
|
let isBlocked = $ref(false);
|
|
|
|
|
|
|
|
async function fetch() {
|
2022-06-20 17:48:38 +03:00
|
|
|
if (iAmModerator) {
|
|
|
|
// suspended and blocked information is only displayed to moderators.
|
|
|
|
// otherwise the API will error anyway
|
|
|
|
|
|
|
|
instance = await os.api('federation/show-instance', {
|
|
|
|
host: props.host,
|
|
|
|
});
|
|
|
|
suspended = instance.isSuspended;
|
2022-06-21 17:22:18 +03:00
|
|
|
isBlocked = instance.isBlocked;
|
2022-06-20 17:48:38 +03:00
|
|
|
}
|
2022-01-18 14:30:17 +02:00
|
|
|
}
|
2021-04-16 11:34:06 +03:00
|
|
|
|
2022-01-18 14:30:17 +02:00
|
|
|
async function toggleBlock(ev) {
|
|
|
|
if (meta == null) return;
|
|
|
|
await os.api('admin/update-meta', {
|
2022-06-20 11:38:49 +03:00
|
|
|
blockedHosts: isBlocked ? meta.blockedHosts.concat([instance.host]) : meta.blockedHosts.filter(x => x !== instance.host),
|
2022-01-18 14:30:17 +02:00
|
|
|
});
|
|
|
|
}
|
2022-01-04 08:36:14 +02:00
|
|
|
|
2022-01-18 14:30:17 +02:00
|
|
|
async function toggleSuspend(v) {
|
|
|
|
await os.api('admin/federation/update-instance', {
|
|
|
|
host: instance.host,
|
|
|
|
isSuspended: suspended,
|
|
|
|
});
|
|
|
|
}
|
2022-01-04 08:36:14 +02:00
|
|
|
|
2022-01-31 13:38:26 +02:00
|
|
|
function refreshMetadata() {
|
|
|
|
os.api('admin/federation/refresh-remote-instance-metadata', {
|
|
|
|
host: instance.host,
|
|
|
|
});
|
|
|
|
os.alert({
|
|
|
|
text: 'Refresh requested',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-18 14:30:17 +02:00
|
|
|
fetch();
|
|
|
|
|
2022-06-20 13:49:51 +03:00
|
|
|
const headerActions = $computed(() => [{
|
|
|
|
text: `https://${props.host}`,
|
|
|
|
icon: 'fas fa-external-link-alt',
|
|
|
|
handler: () => {
|
|
|
|
window.open(`https://${props.host}`, '_blank');
|
|
|
|
},
|
|
|
|
}]);
|
2022-06-20 11:38:49 +03:00
|
|
|
|
2022-06-21 11:55:38 +03:00
|
|
|
const headerTabs = $computed(() => [{
|
2022-06-22 10:29:21 +03:00
|
|
|
key: 'overview',
|
2022-06-21 11:55:38 +03:00
|
|
|
title: i18n.ts.overview,
|
|
|
|
icon: 'fas fa-info-circle',
|
|
|
|
}, {
|
2022-06-22 10:29:21 +03:00
|
|
|
key: 'chart',
|
2022-06-21 11:55:38 +03:00
|
|
|
title: i18n.ts.charts,
|
|
|
|
icon: 'fas fa-chart-simple',
|
|
|
|
}, {
|
2022-06-22 10:29:21 +03:00
|
|
|
key: 'raw',
|
2022-06-21 11:55:38 +03:00
|
|
|
title: 'Raw data',
|
|
|
|
icon: 'fas fa-code',
|
|
|
|
}]);
|
2022-06-20 11:38:49 +03:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: props.host,
|
2022-06-21 11:55:38 +03:00
|
|
|
icon: 'fas fa-server',
|
2022-06-20 11:38:49 +03:00
|
|
|
bg: 'var(--bg)',
|
2021-04-16 11:34:06 +03:00
|
|
|
});
|
|
|
|
</script>
|
2021-04-16 15:47:12 +03:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.fnfelxur {
|
2021-04-25 06:31:11 +03:00
|
|
|
> .icon {
|
2021-04-16 15:47:12 +03:00
|
|
|
display: block;
|
2022-01-04 08:36:14 +02:00
|
|
|
margin: 0;
|
2021-04-16 15:47:12 +03:00
|
|
|
height: 64px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.cmhjzshl {
|
|
|
|
> .selects {
|
|
|
|
display: flex;
|
2022-01-04 08:36:14 +02:00
|
|
|
margin: 0 0 16px 0;
|
2021-04-16 15:47:12 +03:00
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
|
|
|
|
> .charts {
|
|
|
|
> .label {
|
|
|
|
margin-bottom: 12px;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
2021-04-16 15:47:12 +03:00
|
|
|
}
|
|
|
|
</style>
|