1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-04 17:58:10 +09:00

Add AP emojis endpoint (#3667)

This commit is contained in:
MeiMei 2018-12-19 04:23:08 +09:00 committed by syuilo
parent 081578c604
commit 5dddc75d09

View File

@ -7,9 +7,11 @@ import { createHttpJob } from '../queue';
import pack from '../remote/activitypub/renderer';
import Note from '../models/note';
import User, { isLocalUser, ILocalUser, IUser } from '../models/user';
import Emoji from '../models/emoji';
import renderNote from '../remote/activitypub/renderer/note';
import renderKey from '../remote/activitypub/renderer/key';
import renderPerson from '../remote/activitypub/renderer/person';
import renderEmoji from '../remote/activitypub/renderer/emoji';
import Outbox, { packActivity } from './activitypub/outbox';
import Followers from './activitypub/followers';
import Following from './activitypub/following';
@ -188,4 +190,21 @@ router.get('/@:user', async (ctx, next) => {
});
//#endregion
// emoji
router.get('/emojis/:emoji', async ctx => {
const emoji = await Emoji.findOne({
host: null,
name: ctx.params.emoji
});
if (emoji === null) {
ctx.status = 404;
return;
}
ctx.body = pack(await renderEmoji(emoji));
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
});
export default router;