summaryrefslogtreecommitdiff
path: root/src/server/api/mastodon.ts
blob: f2ce1c384f717cd36b6e4c39901dd72f091980fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;