2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-06-20 19:49:51 +09:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
2022-06-22 16:29:21 +09:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 16:20:53 +09:00
|
|
|
<MkSpacer v-if="instance" :contentMax="600" :marginMin="16" :marginMax="32">
|
2024-01-18 18:21:33 +09:00
|
|
|
<MkHorizontalSwipe v-model:tab="tab" :tabs="headerTabs">
|
|
|
|
<div v-if="tab === 'overview'" key="overview" class="_gaps_m">
|
|
|
|
<div class="fnfelxur">
|
|
|
|
<img :src="faviconUrl" alt="" class="icon"/>
|
|
|
|
<span class="name">{{ instance.name || `(${i18n.ts.unknown})` }}</span>
|
|
|
|
</div>
|
|
|
|
<div style="display: flex; flex-direction: column; gap: 1em;">
|
|
|
|
<MkKeyValue :copy="host" oneline>
|
|
|
|
<template #key>Host</template>
|
|
|
|
<template #value><span class="_monospace"><MkLink :url="`https://${host}`">{{ host }}</MkLink></span></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline>
|
|
|
|
<template #key>{{ i18n.ts.software }}</template>
|
|
|
|
<template #value><span class="_monospace">{{ instance.softwareName || `(${i18n.ts.unknown})` }} / {{ instance.softwareVersion || `(${i18n.ts.unknown})` }}</span></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline>
|
|
|
|
<template #key>{{ i18n.ts.administrator }}</template>
|
|
|
|
<template #value>{{ instance.maintainerName || `(${i18n.ts.unknown})` }} ({{ instance.maintainerEmail || `(${i18n.ts.unknown})` }})</template>
|
|
|
|
</MkKeyValue>
|
|
|
|
</div>
|
|
|
|
<MkKeyValue>
|
|
|
|
<template #key>{{ i18n.ts.description }}</template>
|
|
|
|
<template #value>{{ instance.description }}</template>
|
2023-01-05 21:04:56 +09:00
|
|
|
</MkKeyValue>
|
2022-06-20 19:49:51 +09:00
|
|
|
|
2024-01-18 18:21:33 +09:00
|
|
|
<FormSection v-if="iAmModerator">
|
|
|
|
<template #label>Moderation</template>
|
|
|
|
<div class="_gaps_s">
|
|
|
|
<MkSwitch v-model="suspended" :disabled="!instance" @update:modelValue="toggleSuspend">{{ i18n.ts.stopActivityDelivery }}</MkSwitch>
|
|
|
|
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
|
|
|
|
<MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch>
|
2024-01-21 21:11:23 +09:00
|
|
|
<MkSwitch v-model="isNSFW" :disabled="!instance" @update:modelValue="toggleNSFW">Mark as NSFW</MkSwitch>
|
2024-02-07 05:23:37 +09:00
|
|
|
<MkButton @click="refreshMetadata"><i class="ph-arrows-clockwise ph-bold ph-lg"></i> Refresh metadata</MkButton>
|
2024-01-18 18:21:33 +09:00
|
|
|
</div>
|
|
|
|
</FormSection>
|
2022-06-20 19:49:51 +09:00
|
|
|
|
2024-01-18 18:21:33 +09:00
|
|
|
<FormSection>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<template #key>{{ i18n.ts.registeredAt }}</template>
|
|
|
|
<template #value><MkTime mode="detail" :time="instance.firstRetrievedAt"/></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<template #key>{{ i18n.ts.updatedAt }}</template>
|
|
|
|
<template #value><MkTime mode="detail" :time="instance.infoUpdatedAt"/></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<template #key>{{ i18n.ts.latestRequestReceivedAt }}</template>
|
|
|
|
<template #value><MkTime v-if="instance.latestRequestReceivedAt" :time="instance.latestRequestReceivedAt"/><span v-else>N/A</span></template>
|
|
|
|
</MkKeyValue>
|
|
|
|
</FormSection>
|
2023-07-08 07:08:16 +09:00
|
|
|
|
2024-01-18 18:21:33 +09:00
|
|
|
<FormSection>
|
|
|
|
<MkKeyValue oneline style="margin: 1em 0;">
|
|
|
|
<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>
|
|
|
|
</MkKeyValue>
|
|
|
|
</FormSection>
|
2022-06-20 19:49:51 +09:00
|
|
|
|
2024-01-18 18:21:33 +09:00
|
|
|
<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>
|
|
|
|
<div v-else-if="tab === 'chart'" key="chart" class="_gaps_m">
|
|
|
|
<div class="cmhjzshl">
|
|
|
|
<div class="selects">
|
|
|
|
<MkSelect v-model="chartSrc" style="margin: 0 10px 0 0; flex: 1;">
|
|
|
|
<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>
|
|
|
|
</MkSelect>
|
|
|
|
</div>
|
|
|
|
<div class="charts">
|
2024-01-20 08:11:59 +09:00
|
|
|
<div class="label">{{ i18n.tsx.recentNHours({ n: 90 }) }}</div>
|
2024-01-18 18:21:33 +09:00
|
|
|
<MkChart class="chart" :src="chartSrc" span="hour" :limit="90" :args="{ host: host }" :detailed="true"></MkChart>
|
2024-01-20 08:11:59 +09:00
|
|
|
<div class="label">{{ i18n.tsx.recentNDays({ n: 90 }) }}</div>
|
2024-01-18 18:21:33 +09:00
|
|
|
<MkChart class="chart" :src="chartSrc" span="day" :limit="90" :args="{ host: host }" :detailed="true"></MkChart>
|
|
|
|
</div>
|
2022-06-21 17:55:38 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-18 18:21:33 +09:00
|
|
|
<div v-else-if="tab === 'users'" key="users" class="_gaps_m">
|
|
|
|
<MkPagination v-slot="{items}" :pagination="usersPagination" style="display: grid; grid-template-columns: repeat(auto-fill,minmax(270px,1fr)); grid-gap: 12px;">
|
|
|
|
<MkA v-for="user in items" :key="user.id" v-tooltip.mfm="`Last posted: ${dateString(user.updatedAt)}`" class="user" :to="`/admin/user/${user.id}`">
|
|
|
|
<MkUserCardMini :user="user"/>
|
|
|
|
</MkA>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'raw'" key="raw" class="_gaps_m">
|
|
|
|
<MkObjectView tall :value="instance">
|
|
|
|
</MkObjectView>
|
|
|
|
</div>
|
|
|
|
</MkHorizontalSwipe>
|
2022-06-20 19:49:51 +09:00
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-16 17:34:06 +09:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 21:30:17 +09:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 14:42:09 +09:00
|
|
|
import { ref, computed } from 'vue';
|
2023-09-04 13:33:38 +09:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkChart from '@/components/MkChart.vue';
|
|
|
|
import MkObjectView from '@/components/MkObjectView.vue';
|
2022-01-04 15:36:14 +09:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkLink from '@/components/MkLink.vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-01-04 15:36:14 +09:00
|
|
|
import FormSection from '@/components/form/section.vue';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkKeyValue from '@/components/MkKeyValue.vue';
|
2023-01-07 15:09:46 +09:00
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
2023-01-07 14:59:54 +09:00
|
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import * as os from '@/os.js';
|
2024-01-04 18:32:46 +09:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 16:37:43 +09:00
|
|
|
import number from '@/filters/number.js';
|
|
|
|
import { iAmModerator, iAmAdmin } from '@/account.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
2023-12-27 15:55:09 +09:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2024-01-18 18:21:33 +09:00
|
|
|
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
|
|
|
import { dateString } from '@/filters/date.js';
|
2022-01-18 21:30:17 +09:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
host: string;
|
|
|
|
}>();
|
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
const tab = ref('overview');
|
2024-01-18 18:21:33 +09:00
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
const chartSrc = ref('instance-requests');
|
|
|
|
const meta = ref<Misskey.entities.AdminMetaResponse | null>(null);
|
|
|
|
const instance = ref<Misskey.entities.FederationInstance | null>(null);
|
|
|
|
const suspended = ref(false);
|
|
|
|
const isBlocked = ref(false);
|
|
|
|
const isSilenced = ref(false);
|
2023-12-23 10:09:23 +09:00
|
|
|
const isNSFW = ref(false);
|
2023-12-07 14:42:09 +09:00
|
|
|
const faviconUrl = ref<string | null>(null);
|
2022-01-18 21:30:17 +09:00
|
|
|
|
2022-06-29 14:14:27 +09:00
|
|
|
const usersPagination = {
|
2022-06-30 15:32:11 +09:00
|
|
|
endpoint: iAmModerator ? 'admin/show-users' : 'users' as const,
|
2022-06-29 14:14:27 +09:00
|
|
|
limit: 10,
|
|
|
|
params: {
|
|
|
|
sort: '+updatedAt',
|
|
|
|
state: 'all',
|
|
|
|
hostname: props.host,
|
|
|
|
},
|
|
|
|
offsetMode: true,
|
2023-12-27 15:55:09 +09:00
|
|
|
};
|
2022-06-29 14:14:27 +09:00
|
|
|
|
2023-07-31 12:22:57 +09:00
|
|
|
async function fetch(): Promise<void> {
|
|
|
|
if (iAmAdmin) {
|
2024-01-04 18:32:46 +09:00
|
|
|
meta.value = await misskeyApi('admin/meta');
|
2023-07-31 12:22:57 +09:00
|
|
|
}
|
2024-01-04 18:32:46 +09:00
|
|
|
instance.value = await misskeyApi('federation/show-instance', {
|
2022-06-28 22:56:18 +09:00
|
|
|
host: props.host,
|
|
|
|
});
|
2023-12-07 14:42:09 +09:00
|
|
|
suspended.value = instance.value?.isSuspended ?? false;
|
|
|
|
isBlocked.value = instance.value?.isBlocked ?? false;
|
|
|
|
isSilenced.value = instance.value?.isSilenced ?? false;
|
2023-12-23 10:09:23 +09:00
|
|
|
isNSFW.value = instance.value?.isNSFW ?? false;
|
2023-12-07 14:42:09 +09:00
|
|
|
faviconUrl.value = getProxiedImageUrlNullable(instance.value?.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.value?.iconUrl, 'preview');
|
2022-01-18 21:30:17 +09:00
|
|
|
}
|
2021-04-16 17:34:06 +09:00
|
|
|
|
2023-07-31 12:22:57 +09:00
|
|
|
async function toggleBlock(): Promise<void> {
|
2023-12-07 14:42:09 +09:00
|
|
|
if (!meta.value) throw new Error('No meta?');
|
|
|
|
if (!instance.value) throw new Error('No instance?');
|
|
|
|
const { host } = instance.value;
|
2024-01-04 18:32:46 +09:00
|
|
|
await misskeyApi('admin/update-meta', {
|
2023-12-07 14:42:09 +09:00
|
|
|
blockedHosts: isBlocked.value ? meta.value.blockedHosts.concat([host]) : meta.value.blockedHosts.filter(x => x !== host),
|
2022-01-18 21:30:17 +09:00
|
|
|
});
|
|
|
|
}
|
2023-10-29 16:09:20 +09:00
|
|
|
|
2023-10-16 20:11:27 +09:00
|
|
|
async function toggleSilenced(): Promise<void> {
|
2023-12-07 14:42:09 +09:00
|
|
|
if (!meta.value) throw new Error('No meta?');
|
|
|
|
if (!instance.value) throw new Error('No instance?');
|
|
|
|
const { host } = instance.value;
|
|
|
|
const silencedHosts = meta.value.silencedHosts ?? [];
|
2024-01-04 18:32:46 +09:00
|
|
|
await misskeyApi('admin/update-meta', {
|
2023-12-07 14:42:09 +09:00
|
|
|
silencedHosts: isSilenced.value ? silencedHosts.concat([host]) : silencedHosts.filter(x => x !== host),
|
2023-10-29 16:09:20 +09:00
|
|
|
});
|
2023-10-16 20:11:27 +09:00
|
|
|
}
|
2023-10-29 16:09:20 +09:00
|
|
|
|
2023-07-31 12:22:57 +09:00
|
|
|
async function toggleSuspend(): Promise<void> {
|
2023-12-07 14:42:09 +09:00
|
|
|
if (!instance.value) throw new Error('No instance?');
|
2024-01-04 18:32:46 +09:00
|
|
|
await misskeyApi('admin/federation/update-instance', {
|
2023-12-07 14:42:09 +09:00
|
|
|
host: instance.value.host,
|
|
|
|
isSuspended: suspended.value,
|
2022-01-18 21:30:17 +09:00
|
|
|
});
|
|
|
|
}
|
2022-01-04 15:36:14 +09:00
|
|
|
|
2023-12-06 06:19:53 +09:00
|
|
|
async function toggleNSFW(): Promise<void> {
|
2023-12-23 12:26:23 +09:00
|
|
|
if (!instance.value) throw new Error('No instance?');
|
2024-01-09 10:57:57 +09:00
|
|
|
await misskeyApi('admin/federation/update-instance', {
|
2023-12-23 12:26:23 +09:00
|
|
|
host: instance.value.host,
|
|
|
|
isNSFW: isNSFW.value,
|
2023-12-06 06:19:53 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-07-31 12:22:57 +09:00
|
|
|
function refreshMetadata(): void {
|
2023-12-07 14:42:09 +09:00
|
|
|
if (!instance.value) throw new Error('No instance?');
|
2024-01-04 18:32:46 +09:00
|
|
|
misskeyApi('admin/federation/refresh-remote-instance-metadata', {
|
2023-12-07 14:42:09 +09:00
|
|
|
host: instance.value.host,
|
2022-01-31 20:38:26 +09:00
|
|
|
});
|
|
|
|
os.alert({
|
|
|
|
text: 'Refresh requested',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-18 21:30:17 +09:00
|
|
|
fetch();
|
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
const headerActions = computed(() => [{
|
2022-06-20 19:49:51 +09:00
|
|
|
text: `https://${props.host}`,
|
2023-10-01 04:53:52 +09:00
|
|
|
icon: 'ph-arrow-square-out ph-bold ph-lg',
|
2022-06-20 19:49:51 +09:00
|
|
|
handler: () => {
|
2023-12-08 17:48:18 +09:00
|
|
|
window.open(`https://${props.host}`, '_blank', 'noopener');
|
2022-06-20 19:49:51 +09:00
|
|
|
},
|
|
|
|
}]);
|
2022-06-20 17:38:49 +09:00
|
|
|
|
2023-12-07 14:42:09 +09:00
|
|
|
const headerTabs = computed(() => [{
|
2022-06-22 16:29:21 +09:00
|
|
|
key: 'overview',
|
2022-06-21 17:55:38 +09:00
|
|
|
title: i18n.ts.overview,
|
2023-10-01 04:53:52 +09:00
|
|
|
icon: 'ph-info ph-bold ph-lg',
|
2022-06-21 17:55:38 +09:00
|
|
|
}, {
|
2022-06-22 16:29:21 +09:00
|
|
|
key: 'chart',
|
2022-06-21 17:55:38 +09:00
|
|
|
title: i18n.ts.charts,
|
2023-11-04 07:20:53 +09:00
|
|
|
icon: 'ph-chart-line ph-bold ph-lg',
|
2022-06-29 14:14:27 +09:00
|
|
|
}, {
|
|
|
|
key: 'users',
|
|
|
|
title: i18n.ts.users,
|
2023-11-04 07:20:53 +09:00
|
|
|
icon: 'ph-users ph-bold ph-lg',
|
2022-06-21 17:55:38 +09:00
|
|
|
}, {
|
2022-06-22 16:29:21 +09:00
|
|
|
key: 'raw',
|
2022-06-29 14:19:40 +09:00
|
|
|
title: 'Raw',
|
2023-11-04 07:20:53 +09:00
|
|
|
icon: 'ph-code ph-bold ph-lg',
|
2022-06-21 17:55:38 +09:00
|
|
|
}]);
|
2022-06-20 17:38:49 +09:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: props.host,
|
2023-10-01 07:46:42 +09:00
|
|
|
icon: 'ph-hard-drives ph-bold ph-lg',
|
2021-04-16 17:34:06 +09:00
|
|
|
});
|
|
|
|
</script>
|
2021-04-16 21:47:12 +09:00
|
|
|
|
2022-12-27 18:29:39 +09:00
|
|
|
<style lang="scss" scoped>
|
2021-04-16 21:47:12 +09:00
|
|
|
.fnfelxur {
|
2022-06-26 16:57:12 +09:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
2021-04-25 12:31:11 +09:00
|
|
|
> .icon {
|
2021-04-16 21:47:12 +09:00
|
|
|
display: block;
|
2022-06-26 16:57:12 +09:00
|
|
|
margin: 0 16px 0 0;
|
2021-04-16 21:47:12 +09:00
|
|
|
height: 64px;
|
2023-11-01 03:44:34 +09:00
|
|
|
border-radius: var(--radius-sm);
|
2021-04-16 21:47:12 +09:00
|
|
|
}
|
2022-06-26 16:57:12 +09:00
|
|
|
|
|
|
|
> .name {
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
2021-04-16 21:47:12 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
.cmhjzshl {
|
|
|
|
> .selects {
|
|
|
|
display: flex;
|
2022-01-04 15:36:14 +09:00
|
|
|
margin: 0 0 16px 0;
|
2021-04-16 21:47:12 +09:00
|
|
|
}
|
2022-06-21 17:55:38 +09:00
|
|
|
|
|
|
|
> .charts {
|
|
|
|
> .label {
|
|
|
|
margin-bottom: 12px;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
2021-04-16 21:47:12 +09:00
|
|
|
}
|
|
|
|
</style>
|