1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-29 05:58:06 +09:00
hotomoe/src/server/api/mastodon.ts

15 lines
400 B
TypeScript
Raw Normal View History

import * as Router from 'koa-router';
import User from '../../models/user';
import { toASCII } from 'punycode';
// Init router
const router = new Router();
router.get('/v1/instance/peers', async ctx => {
const peers = await User.distinct('host', { host: { $ne: null } }) as any as string[];
const punyCodes = peers.map(peer => toASCII(peer));
ctx.body = punyCodes;
});
module.exports = router;