mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-09-02 11:46:44 +02:00
feat: temporarily deny handling non-public notes
This commit is contained in:
@@ -19,6 +19,11 @@ inbox.create = async (req) => {
|
||||
const { object } = req.body;
|
||||
const postData = await activitypub.mocks.post(object);
|
||||
|
||||
// Temporary, reject non-public notes.
|
||||
if (![...postData._activitypub.to, ...postData._activitypub.cc].includes(activitypub._constants.publicAddress)) {
|
||||
throw new Error('[[error:activitypub.not-implemented]]');
|
||||
}
|
||||
|
||||
if (postData) {
|
||||
await activitypub.notes.assert(0, [postData]);
|
||||
const tid = await activitypub.notes.assertTopic(0, postData.pid);
|
||||
|
||||
@@ -4,6 +4,7 @@ const nconf = require('nconf');
|
||||
|
||||
const user = require('../../user');
|
||||
const activitypub = require('../../activitypub');
|
||||
const helpers = require('../helpers');
|
||||
|
||||
const Controller = module.exports;
|
||||
|
||||
@@ -117,6 +118,10 @@ Controller.postInbox = async (req, res) => {
|
||||
return res.sendStatus(501);
|
||||
}
|
||||
|
||||
await activitypub.inbox[method](req);
|
||||
res.sendStatus(200);
|
||||
try {
|
||||
await activitypub.inbox[method](req);
|
||||
helpers.formatApiResponse(200, res);
|
||||
} catch (e) {
|
||||
helpers.formatApiResponse(500, res, e);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user