2022-06-20 10:49:51 +00:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
2022-06-22 07:29:21 +00:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2022-06-21 08:55:38 +00:00
|
|
|
<MkSpacer v-if="instance" :content-max="600" :margin-min="16" :margin-max="32">
|
|
|
|
<div v-if="tab === 'overview'" class="_formRoot">
|
2022-06-20 10:49:51 +00:00
|
|
|
<div class="fnfelxur">
|
2022-12-08 07:57:57 +00:00
|
|
|
<img :src="faviconUrl" alt="" class="icon"/>
|
2022-07-20 13:24:26 +00:00
|
|
|
<span class="name">{{ instance.name || `(${i18n.ts.unknown})` }}</span>
|
2022-06-20 10:49:51 +00:00
|
|
|
</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 06:36:14 +00:00
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.software }}</template>
|
|
|
|
<template #value><span class="_monospace">{{ instance.softwareName || `(${i18n.ts.unknown})` }} / {{ instance.softwareVersion || `(${i18n.ts.unknown})` }}</span></template>
|
2022-01-04 06:36:14 +00:00
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.administrator }}</template>
|
|
|
|
<template #value>{{ instance.maintainerName || `(${i18n.ts.unknown})` }} ({{ instance.maintainerEmail || `(${i18n.ts.unknown})` }})</template>
|
2022-01-04 06:36:14 +00:00
|
|
|
</MkKeyValue>
|
2022-06-26 07:57:12 +00:00
|
|
|
<MkKeyValue>
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.description }}</template>
|
2022-06-26 07:57:12 +00:00
|
|
|
<template #value>{{ instance.description }}</template>
|
|
|
|
</MkKeyValue>
|
2022-06-20 10:49:51 +00:00
|
|
|
|
|
|
|
<FormSection v-if="iAmModerator">
|
|
|
|
<template #label>Moderation</template>
|
2022-12-22 07:51:48 +00:00
|
|
|
<FormSwitch v-model="suspended" class="_formBlock" @update:model-value="toggleSuspend">{{ i18n.ts.stopActivityDelivery }}</FormSwitch>
|
|
|
|
<FormSwitch v-model="isBlocked" class="_formBlock" @update:model-value="toggleBlock">{{ i18n.ts.blockThisInstance }}</FormSwitch>
|
2022-12-19 10:01:30 +00:00
|
|
|
<MkButton @click="refreshMetadata"><i class="ti ti-refresh"></i> Refresh metadata</MkButton>
|
2022-06-20 10:49:51 +00:00
|
|
|
</FormSection>
|
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.registeredAt }}</template>
|
2022-06-20 10:49:51 +00:00
|
|
|
<template #value><MkTime mode="detail" :time="instance.caughtAt"/></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.updatedAt }}</template>
|
2022-06-20 10:49:51 +00:00
|
|
|
<template #value><MkTime mode="detail" :time="instance.infoUpdatedAt"/></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.latestStatus }}</template>
|
2022-06-20 10:49:51 +00:00
|
|
|
<template #value>{{ instance.latestStatus ? instance.latestStatus : 'N/A' }}</template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<template #key>{{ i18n.ts.latestRequestReceivedAt }}</template>
|
2022-06-20 10:49:51 +00:00
|
|
|
<template #value><MkTime v-if="instance.latestRequestReceivedAt" :time="instance.latestRequestReceivedAt"/><span v-else>N/A</span></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
</FormSection>
|
2022-01-04 06:36:14 +00:00
|
|
|
|
2022-06-20 10:49:51 +00:00
|
|
|
<FormSection>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
2022-07-07 09:06:34 +00:00
|
|
|
<template #key>Following (Pub)</template>
|
|
|
|
<template #value>{{ number(instance.followingCount) }}</template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<template #key>Followers (Sub)</template>
|
|
|
|
<template #value>{{ number(instance.followersCount) }}</template>
|
2022-06-20 10:49:51 +00:00
|
|
|
</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 15:10:34 +00:00
|
|
|
<div v-else-if="tab === 'chart'" class="_formRoot">
|
2022-06-21 08:55:38 +00:00
|
|
|
<div class="cmhjzshl">
|
|
|
|
<div class="selects">
|
|
|
|
<MkSelect v-model="chartSrc" style="margin: 0 10px 0 0; flex: 1;">
|
2022-07-20 13:24:26 +00:00
|
|
|
<option value="instance-requests">{{ i18n.ts._instanceCharts.requests }}</option>
|
|
|
|
<option value="instance-users">{{ i18n.ts._instanceCharts.users }}</option>
|
|
|
|
<option value="instance-users-total">{{ i18n.ts._instanceCharts.usersTotal }}</option>
|
|
|
|
<option value="instance-notes">{{ i18n.ts._instanceCharts.notes }}</option>
|
|
|
|
<option value="instance-notes-total">{{ i18n.ts._instanceCharts.notesTotal }}</option>
|
|
|
|
<option value="instance-ff">{{ i18n.ts._instanceCharts.ff }}</option>
|
|
|
|
<option value="instance-ff-total">{{ i18n.ts._instanceCharts.ffTotal }}</option>
|
|
|
|
<option value="instance-drive-usage">{{ i18n.ts._instanceCharts.cacheSize }}</option>
|
|
|
|
<option value="instance-drive-usage-total">{{ i18n.ts._instanceCharts.cacheSizeTotal }}</option>
|
|
|
|
<option value="instance-drive-files">{{ i18n.ts._instanceCharts.files }}</option>
|
|
|
|
<option value="instance-drive-files-total">{{ i18n.ts._instanceCharts.filesTotal }}</option>
|
2022-06-21 08:55:38 +00:00
|
|
|
</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-29 05:14:27 +00:00
|
|
|
<div v-else-if="tab === 'users'" class="_formRoot">
|
|
|
|
<MkPagination v-slot="{items}" :pagination="usersPagination" style="display: grid; grid-template-columns: repeat(auto-fill,minmax(270px,1fr)); grid-gap: 12px;">
|
2023-01-01 08:11:33 +00:00
|
|
|
<MkA v-for="user in items" :key="user.id" v-tooltip.mfm="`Last posted: ${dateString(user.updatedAt)}`" class="user" :to="`/user-info/${user.id}`">
|
2022-06-29 05:14:27 +00:00
|
|
|
<MkUserCardMini :user="user"/>
|
|
|
|
</MkA>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
2022-06-21 15:10:34 +00:00
|
|
|
<div v-else-if="tab === 'raw'" class="_formRoot">
|
2022-06-21 08:55:38 +00:00
|
|
|
<MkObjectView tall :value="instance">
|
|
|
|
</MkObjectView>
|
|
|
|
</div>
|
2022-06-20 10:49:51 +00:00
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-16 08:34:06 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 12:30:17 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
|
|
|
import * as misskey from 'misskey-js';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkChart from '@/components/MkChart.vue';
|
|
|
|
import MkObjectView from '@/components/MkObjectView.vue';
|
2022-01-04 06:36:14 +00:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkLink from '@/components/MkLink.vue';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-01-04 06:36:14 +00:00
|
|
|
import FormSection from '@/components/form/section.vue';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkKeyValue from '@/components/MkKeyValue.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import MkSelect from '@/components/form/select.vue';
|
2022-01-04 06:36:14 +00:00
|
|
|
import FormSwitch from '@/components/form/switch.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import * as os from '@/os';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import bytes from '@/filters/bytes';
|
2022-01-18 12:30:17 +00:00
|
|
|
import { iAmModerator } from '@/account';
|
2022-06-20 08:38:49 +00:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-06-21 08:55:38 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2022-12-08 07:57:57 +00:00
|
|
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy';
|
2023-01-01 08:11:33 +00:00
|
|
|
import { dateString } from '@/filters/date';
|
2022-01-18 12:30:17 +00:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
host: string;
|
|
|
|
}>();
|
|
|
|
|
2022-06-21 08:55:38 +00:00
|
|
|
let tab = $ref('overview');
|
2022-06-21 15:10:34 +00:00
|
|
|
let chartSrc = $ref('instance-requests');
|
2022-01-18 12:30:17 +00: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);
|
2022-12-08 07:57:57 +00:00
|
|
|
let faviconUrl = $ref(null);
|
2022-01-18 12:30:17 +00:00
|
|
|
|
2022-06-29 05:14:27 +00:00
|
|
|
const usersPagination = {
|
2022-06-30 06:32:11 +00:00
|
|
|
endpoint: iAmModerator ? 'admin/show-users' : 'users' as const,
|
2022-06-29 05:14:27 +00:00
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
sort: '+updatedAt',
|
|
|
|
state: 'all',
|
|
|
|
hostname: props.host,
|
|
|
|
},
|
|
|
|
offsetMode: true,
|
|
|
|
};
|
|
|
|
|
2022-01-18 12:30:17 +00:00
|
|
|
async function fetch() {
|
2022-06-28 13:56:18 +00:00
|
|
|
instance = await os.api('federation/show-instance', {
|
|
|
|
host: props.host,
|
|
|
|
});
|
|
|
|
suspended = instance.isSuspended;
|
|
|
|
isBlocked = instance.isBlocked;
|
2022-12-08 07:57:57 +00:00
|
|
|
faviconUrl = getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.iconUrl, 'preview');
|
2022-01-18 12:30:17 +00:00
|
|
|
}
|
2021-04-16 08:34:06 +00:00
|
|
|
|
2022-01-18 12:30:17 +00:00
|
|
|
async function toggleBlock(ev) {
|
|
|
|
if (meta == null) return;
|
|
|
|
await os.api('admin/update-meta', {
|
2022-06-20 08:38:49 +00:00
|
|
|
blockedHosts: isBlocked ? meta.blockedHosts.concat([instance.host]) : meta.blockedHosts.filter(x => x !== instance.host),
|
2022-01-18 12:30:17 +00:00
|
|
|
});
|
|
|
|
}
|
2022-01-04 06:36:14 +00:00
|
|
|
|
2022-01-18 12:30:17 +00:00
|
|
|
async function toggleSuspend(v) {
|
|
|
|
await os.api('admin/federation/update-instance', {
|
|
|
|
host: instance.host,
|
|
|
|
isSuspended: suspended,
|
|
|
|
});
|
|
|
|
}
|
2022-01-04 06:36:14 +00:00
|
|
|
|
2022-01-31 11:38:26 +00:00
|
|
|
function refreshMetadata() {
|
|
|
|
os.api('admin/federation/refresh-remote-instance-metadata', {
|
|
|
|
host: instance.host,
|
|
|
|
});
|
|
|
|
os.alert({
|
|
|
|
text: 'Refresh requested',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-18 12:30:17 +00:00
|
|
|
fetch();
|
|
|
|
|
2022-06-20 10:49:51 +00:00
|
|
|
const headerActions = $computed(() => [{
|
|
|
|
text: `https://${props.host}`,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-external-link',
|
2022-06-20 10:49:51 +00:00
|
|
|
handler: () => {
|
|
|
|
window.open(`https://${props.host}`, '_blank');
|
|
|
|
},
|
|
|
|
}]);
|
2022-06-20 08:38:49 +00:00
|
|
|
|
2022-06-21 08:55:38 +00:00
|
|
|
const headerTabs = $computed(() => [{
|
2022-06-22 07:29:21 +00:00
|
|
|
key: 'overview',
|
2022-06-21 08:55:38 +00:00
|
|
|
title: i18n.ts.overview,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-info-circle',
|
2022-06-21 08:55:38 +00:00
|
|
|
}, {
|
2022-06-22 07:29:21 +00:00
|
|
|
key: 'chart',
|
2022-06-21 08:55:38 +00:00
|
|
|
title: i18n.ts.charts,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-chart-line',
|
2022-06-29 05:14:27 +00:00
|
|
|
}, {
|
|
|
|
key: 'users',
|
|
|
|
title: i18n.ts.users,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-users',
|
2022-06-21 08:55:38 +00:00
|
|
|
}, {
|
2022-06-22 07:29:21 +00:00
|
|
|
key: 'raw',
|
2022-06-29 05:19:40 +00:00
|
|
|
title: 'Raw',
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-code',
|
2022-06-21 08:55:38 +00:00
|
|
|
}]);
|
2022-06-20 08:38:49 +00:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: props.host,
|
2022-12-19 10:01:30 +00:00
|
|
|
icon: 'ti ti-server',
|
2021-04-16 08:34:06 +00:00
|
|
|
});
|
|
|
|
</script>
|
2021-04-16 12:47:12 +00:00
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2021-04-16 12:47:12 +00:00
|
|
|
.fnfelxur {
|
2022-06-26 07:57:12 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
2021-04-25 03:31:11 +00:00
|
|
|
> .icon {
|
2021-04-16 12:47:12 +00:00
|
|
|
display: block;
|
2022-06-26 07:57:12 +00:00
|
|
|
margin: 0 16px 0 0;
|
2021-04-16 12:47:12 +00:00
|
|
|
height: 64px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
2022-06-26 07:57:12 +00:00
|
|
|
|
|
|
|
> .name {
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
2021-04-16 12:47:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.cmhjzshl {
|
|
|
|
> .selects {
|
|
|
|
display: flex;
|
2022-01-04 06:36:14 +00:00
|
|
|
margin: 0 0 16px 0;
|
2021-04-16 12:47:12 +00:00
|
|
|
}
|
2022-06-21 08:55:38 +00:00
|
|
|
|
|
|
|
> .charts {
|
|
|
|
> .label {
|
|
|
|
margin-bottom: 12px;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
2021-04-16 12:47:12 +00:00
|
|
|
}
|
|
|
|
</style>
|