diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-08 06:55:26 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-08 06:55:26 +0900 |
| commit | 6e34e77372bd74c85ebf5a6b4214c818231dbe8b (patch) | |
| tree | 614e46573693bb4e0b6d097fde88a52d1cd0fa1f /src/server/activitypub/note.ts | |
| parent | Fix bug (diff) | |
| download | sharkey-6e34e77372bd74c85ebf5a6b4214c818231dbe8b.tar.gz sharkey-6e34e77372bd74c85ebf5a6b4214c818231dbe8b.tar.bz2 sharkey-6e34e77372bd74c85ebf5a6b4214c818231dbe8b.zip | |
Implement announce
And bug fixes
Diffstat (limited to 'src/server/activitypub/note.ts')
| -rw-r--r-- | src/server/activitypub/note.ts | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/server/activitypub/note.ts b/src/server/activitypub/note.ts index cea9be52da..1c2e695b80 100644 --- a/src/server/activitypub/note.ts +++ b/src/server/activitypub/note.ts @@ -1,40 +1,25 @@ import * as express from 'express'; import context from '../../remote/activitypub/renderer/context'; import render from '../../remote/activitypub/renderer/note'; -import parseAcct from '../../acct/parse'; import Note from '../../models/note'; -import User from '../../models/user'; const app = express.Router(); -app.get('/@:user/:note', async (req, res, next) => { +app.get('/notes/:note', async (req, res, next) => { const accepted = req.accepts(['html', 'application/activity+json', 'application/ld+json']); if (!(['application/activity+json', 'application/ld+json'] as any[]).includes(accepted)) { return next(); } - const { username, host } = parseAcct(req.params.user); - if (host !== null) { - return res.sendStatus(422); - } - - const user = await User.findOne({ - usernameLower: username.toLowerCase(), - host: null - }); - if (user === null) { - return res.sendStatus(404); - } - const note = await Note.findOne({ - _id: req.params.note, - userId: user._id + _id: req.params.note }); + if (note === null) { return res.sendStatus(404); } - const rendered = await render(user, note); + const rendered = await render(note); rendered['@context'] = context; res.json(rendered); |