summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2018-11-05 11:57:17 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-11-05 11:57:17 +0900
commit0d23ce3d459dc5c7e76f90ed0cd79e18a8980bc6 (patch)
treec0354d719d10d3188fff4e1bc6eda1cf52dc2794 /src/server
parent10.38.7 (diff)
downloadsharkey-0d23ce3d459dc5c7e76f90ed0cd79e18a8980bc6.tar.gz
sharkey-0d23ce3d459dc5c7e76f90ed0cd79e18a8980bc6.tar.bz2
sharkey-0d23ce3d459dc5c7e76f90ed0cd79e18a8980bc6.zip
Make /api/v1/instance and /api/v1/custom_emojis better (#3118)
* Separate commits From commit dca110ebaa78f64600429f812c238a07d2f1dc1d. * Re-separate commits From commit 9719387bee40363f63a837e7ecffacf2a476c334.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/api/mastodon.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/server/api/mastodon.ts b/src/server/api/mastodon.ts
index 33a0b4b5f1..d1e1068da3 100644
--- a/src/server/api/mastodon.ts
+++ b/src/server/api/mastodon.ts
@@ -5,17 +5,18 @@ import config from '../../config';
import Meta from '../../models/meta';
import { ObjectID } from 'bson';
import Emoji from '../../models/emoji';
+import { toMastodonEmojis } from '../../models/mastodon/emoji';
const pkg = require('../../../package.json');
// Init router
const router = new Router();
router.get('/v1/custom_emojis', async ctx => ctx.body =
- await Emoji.find({ host: null }, {
+ (await Emoji.find({ host: null }, {
fields: {
_id: false
}
- }));
+ })).map(toMastodonEmojis));
router.get('/v1/instance', async ctx => { // TODO: This is a temporary implementation. Consider creating helper methods!
const meta = await Meta.findOne() || {};
@@ -40,6 +41,11 @@ router.get('/v1/instance', async ctx => { // TODO: This is a temporary implement
notesCount: 0
};
const acct = maintainer.host ? `${maintainer.username}@${maintainer.host}` : maintainer.username;
+ const emojis = (await Emoji.find({ host: null }, {
+ fields: {
+ _id: false
+ }
+ })).map(toMastodonEmojis);
ctx.body = {
uri: config.hostname,
@@ -79,7 +85,7 @@ router.get('/v1/instance', async ctx => { // TODO: This is a temporary implement
followers_count: maintainer.followersCount,
following_count: maintainer.followingCount,
statuses_count: maintainer.notesCount,
- emojis: [],
+ emojis: emojis,
moved: null,
fields: null
}