2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-12-23 07:21:55 +01:00
|
|
|
<template>
|
2023-05-19 13:52:15 +02:00
|
|
|
<div>
|
2023-04-01 06:42:40 +02:00
|
|
|
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" mode="out-in">
|
2022-12-26 06:34:46 +01:00
|
|
|
<MkLoading v-if="fetching"/>
|
2023-05-19 13:52:15 +02:00
|
|
|
<div v-else :class="$style.instances">
|
|
|
|
<MkA v-for="(instance, i) in instances" :key="instance.id" v-tooltip.mfm.noDelay="`${instance.name}\n${instance.host}\n${instance.softwareName} ${instance.softwareVersion}`" :to="`/instance-info/${instance.host}`" :class="$style.instance">
|
2022-12-26 06:34:46 +01:00
|
|
|
<MkInstanceCardMini :instance="instance"/>
|
|
|
|
</MkA>
|
|
|
|
</div>
|
2022-12-30 05:37:14 +01:00
|
|
|
</Transition>
|
2022-12-23 07:21:55 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-02-16 15:09:41 +01:00
|
|
|
import { ref } from 'vue';
|
2022-12-23 07:21:55 +01:00
|
|
|
import * as os from '@/os';
|
|
|
|
import { useInterval } from '@/scripts/use-interval';
|
|
|
|
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
|
2023-04-01 06:42:40 +02:00
|
|
|
import { defaultStore } from '@/store';
|
2022-12-23 07:21:55 +01:00
|
|
|
|
|
|
|
const instances = ref([]);
|
|
|
|
const fetching = ref(true);
|
|
|
|
|
|
|
|
const fetch = async () => {
|
|
|
|
const fetchedInstances = await os.api('federation/instances', {
|
2023-01-03 01:00:42 +01:00
|
|
|
sort: '+latestRequestReceivedAt',
|
2022-12-23 07:21:55 +01:00
|
|
|
limit: 6,
|
|
|
|
});
|
|
|
|
instances.value = fetchedInstances;
|
|
|
|
fetching.value = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
useInterval(fetch, 1000 * 60, {
|
|
|
|
immediate: true,
|
|
|
|
afterMounted: true,
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-05-19 13:52:15 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.instances {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
|
|
grid-gap: 12px;
|
|
|
|
}
|
2022-12-23 07:21:55 +01:00
|
|
|
|
2023-05-19 13:52:15 +02:00
|
|
|
.instance:hover {
|
|
|
|
text-decoration: none;
|
2022-12-23 07:21:55 +01:00
|
|
|
}
|
|
|
|
</style>
|