diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2019-02-21 23:20:25 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-02-21 23:20:25 +0900 |
| commit | bae874eb4593e206c29d5bb6fae1eecb3ea35fb5 (patch) | |
| tree | 37ab45982cbeca376f799ee9e97063b96d423467 /src/server/api | |
| parent | 10.88.0 (diff) | |
| download | sharkey-bae874eb4593e206c29d5bb6fae1eecb3ea35fb5.tar.gz sharkey-bae874eb4593e206c29d5bb6fae1eecb3ea35fb5.tar.bz2 sharkey-bae874eb4593e206c29d5bb6fae1eecb3ea35fb5.zip | |
/api/v1/instance/peers 復活 (#4339)
* /api/v1/instance/peers 復活
* use Instance
Diffstat (limited to 'src/server/api')
| -rw-r--r-- | src/server/api/index.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/api/index.ts b/src/server/api/index.ts index 711e0791e7..6c523a9d49 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -15,6 +15,8 @@ import signin from './private/signin'; import discord from './service/discord'; import github from './service/github'; import twitter from './service/twitter'; +import Instance from '../../models/instance'; +import { toASCII } from 'punycode'; // Init app const app = new Koa(); @@ -60,6 +62,17 @@ router.use(discord.routes()); router.use(github.routes()); router.use(twitter.routes()); +router.get('/v1/instance/peers', async ctx => { + const instances = await Instance.find({ + }, { + host: 1 + }); + + const punyCodes = instances.map(instance => toASCII(instance.host)); + + ctx.body = punyCodes; +}); + // Return 404 for unknown API router.all('*', async ctx => { ctx.status = 404; |