diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-03 01:22:23 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-03 01:22:23 +0900 |
| commit | 8afdb5aef91bea931c1ab7ecfd9f5ba1e977652c (patch) | |
| tree | 6bef7a649feb0260cb09054e6015cc746154eca7 /src | |
| parent | Fix typo (diff) | |
| download | sharkey-8afdb5aef91bea931c1ab7ecfd9f5ba1e977652c.tar.gz sharkey-8afdb5aef91bea931c1ab7ecfd9f5ba1e977652c.tar.bz2 sharkey-8afdb5aef91bea931c1ab7ecfd9f5ba1e977652c.zip | |
Fix
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/activitypub/post.ts | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/server/activitypub/post.ts b/src/server/activitypub/post.ts index 91d91aeb95..1dadad0db8 100644 --- a/src/server/activitypub/post.ts +++ b/src/server/activitypub/post.ts @@ -1,37 +1,29 @@ 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 Post from '../../models/post'; import User from '../../models/user'; const app = express(); app.disable('x-powered-by'); -app.get('/@:user/:post', async (req, res, next) => { +app.get('/posts/:post', 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 + const post = await Post.findOne({ + _id: req.params.post }); - if (user === null) { + if (post === null) { return res.sendStatus(404); } - const post = await Post.findOne({ - _id: req.params.post, - userId: user._id + const user = await User.findOne({ + _id: post.userId }); - if (post === null) { + if (user === null) { return res.sendStatus(404); } |