mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-16 22:39:00 +01:00
072492c29b
* Implement /api/v1/instance/peers * Use punycode * Remove Cache-Control * Rename
14 lines
400 B
TypeScript
14 lines
400 B
TypeScript
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;
|