diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2020-02-06 17:07:37 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-06 17:07:37 +0900 |
| commit | 988ac80087a116173ab36043a7a9dd2228d2986c (patch) | |
| tree | 6b336163f728769d0c1852a78d68d5cb45122930 /src/server/activitypub.ts | |
| parent | Fix #5838 (diff) | |
| download | misskey-988ac80087a116173ab36043a7a9dd2228d2986c.tar.gz misskey-988ac80087a116173ab36043a7a9dd2228d2986c.tar.bz2 misskey-988ac80087a116173ab36043a7a9dd2228d2986c.zip | |
Correct Like id generation (#5852)
Diffstat (limited to 'src/server/activitypub.ts')
| -rw-r--r-- | src/server/activitypub.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index be8a118b9d..c665fe28ca 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -13,10 +13,11 @@ import Following from './activitypub/following'; import Featured from './activitypub/featured'; import { inbox as processInbox } from '../queue'; import { isSelfHost } from '../misc/convert-host'; -import { Notes, Users, Emojis, UserKeypairs } from '../models'; +import { Notes, Users, Emojis, UserKeypairs, NoteReactions } from '../models'; import { ILocalUser, User } from '../models/entities/user'; import { In } from 'typeorm'; import { ensure } from '../prelude/ensure'; +import { renderLike } from '../remote/activitypub/renderer/like'; // Init router const router = new Router(); @@ -202,4 +203,25 @@ router.get('/emojis/:emoji', async ctx => { setResponseType(ctx); }); +// like +router.get('/likes/:like', async ctx => { + const reaction = await NoteReactions.findOne(ctx.params.like); + + if (reaction == null) { + ctx.status = 404; + return; + } + + const note = await Notes.findOne(reaction.noteId); + + if (note == null) { + ctx.status = 404; + return; + } + + ctx.body = renderActivity(await renderLike(reaction, note)); + ctx.set('Cache-Control', 'public, max-age=180'); + setResponseType(ctx); +}); + export default router; |