2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-06-21 10:55:38 +02:00
|
|
|
<template>
|
2023-10-16 13:11:27 +02:00
|
|
|
<div :class="[$style.root, { yellow: instance.isNotResponding, red: instance.isBlocked, gray: instance.isSuspended, blue: instance.isSilenced }]">
|
2023-01-09 06:00:04 +01:00
|
|
|
<img class="icon" :src="getInstanceIcon(instance)" alt="" loading="lazy"/>
|
2022-06-21 10:55:38 +02:00
|
|
|
<div class="body">
|
2022-06-22 16:40:53 +02:00
|
|
|
<span class="host">{{ instance.name ?? instance.host }}</span>
|
|
|
|
<span class="sub _monospace"><b>{{ instance.host }}</b> / {{ instance.softwareName || '?' }} {{ instance.softwareVersion }}</span>
|
2022-06-21 10:55:38 +02:00
|
|
|
</div>
|
2022-06-26 08:54:07 +02:00
|
|
|
<MkMiniChart v-if="chartValues" class="chart" :src="chartValues"/>
|
2022-06-21 10:55:38 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { ref } from 'vue';
|
2023-09-04 06:33:38 +02:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkMiniChart from '@/components/MkMiniChart.vue';
|
2024-01-04 10:32:46 +01:00
|
|
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
2022-06-21 10:55:38 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
2023-12-02 13:00:05 +01:00
|
|
|
instance: Misskey.entities.FederationInstance;
|
2022-06-21 10:55:38 +02:00
|
|
|
}>();
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const chartValues = ref<number[] | null>(null);
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
|
2022-06-26 08:54:07 +02:00
|
|
|
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
2023-12-02 13:00:05 +01:00
|
|
|
res['requests.received'].splice(0, 1);
|
2023-12-07 06:42:09 +01:00
|
|
|
chartValues.value = res['requests.received'];
|
2022-06-21 10:55:38 +02:00
|
|
|
});
|
2022-12-10 08:52:05 +01:00
|
|
|
|
|
|
|
function getInstanceIcon(instance): string {
|
|
|
|
return getProxiedImageUrlNullable(instance.iconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? '/client-assets/dummy.png';
|
|
|
|
}
|
2022-06-21 10:55:38 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
|
|
|
$bodyTitleHieght: 18px;
|
|
|
|
$bodyInfoHieght: 16px;
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 16px;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
> :global(.icon) {
|
|
|
|
display: block;
|
|
|
|
width: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
height: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
object-fit: cover;
|
|
|
|
border-radius: 4px;
|
2022-06-22 16:40:53 +02:00
|
|
|
margin-right: 10px;
|
2022-06-21 10:55:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.body) {
|
|
|
|
flex: 1;
|
|
|
|
overflow: hidden;
|
|
|
|
font-size: 0.9em;
|
|
|
|
color: var(--fg);
|
|
|
|
padding-right: 8px;
|
|
|
|
|
|
|
|
> :global(.host) {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
line-height: $bodyTitleHieght;
|
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.sub) {
|
2022-06-23 06:39:28 +02:00
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
font-size: 80%;
|
2022-06-21 10:55:38 +02:00
|
|
|
opacity: 0.7;
|
|
|
|
line-height: $bodyInfoHieght;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.chart) {
|
|
|
|
height: 30px;
|
|
|
|
}
|
|
|
|
|
2023-10-16 13:11:27 +02:00
|
|
|
&:global(.blue) {
|
|
|
|
--c: rgba(0, 42, 255, 0.15);
|
|
|
|
background-image: linear-gradient(45deg, var(--c) 16.67%, transparent 16.67%, transparent 50%, var(--c) 50%, var(--c) 66.67%, transparent 66.67%, transparent 100%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
2022-06-21 10:55:38 +02:00
|
|
|
&:global(.yellow) {
|
|
|
|
--c: rgb(255 196 0 / 15%);
|
|
|
|
background-image: linear-gradient(45deg, var(--c) 16.67%, transparent 16.67%, transparent 50%, var(--c) 50%, var(--c) 66.67%, transparent 66.67%, transparent 100%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.red) {
|
|
|
|
--c: rgb(255 0 0 / 15%);
|
|
|
|
background-image: linear-gradient(45deg, var(--c) 16.67%, transparent 16.67%, transparent 50%, var(--c) 50%, var(--c) 66.67%, transparent 66.67%, transparent 100%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.gray) {
|
|
|
|
--c: var(--bg);
|
|
|
|
background-image: linear-gradient(45deg, var(--c) 16.67%, transparent 16.67%, transparent 50%, var(--c) 50%, var(--c) 66.67%, transparent 66.67%, transparent 100%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|