mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-17 21:12:50 +01:00
Merge branch 'develop' of https://github.com/NodeBB/NodeBB into develop
This commit is contained in:
@@ -28,7 +28,13 @@ const sha256 = payload => crypto.createHash('sha256').update(payload).digest('he
|
||||
|
||||
const Helpers = module.exports;
|
||||
|
||||
let _lastLog;
|
||||
Helpers.log = (message) => {
|
||||
if (!message) {
|
||||
return _lastLog;
|
||||
}
|
||||
|
||||
_lastLog = message;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
winston.verbose(message);
|
||||
}
|
||||
|
||||
@@ -263,6 +263,10 @@ ActivityPub.verify = async (req) => {
|
||||
};
|
||||
|
||||
ActivityPub.get = async (type, id, uri, options) => {
|
||||
if (!meta.config.activitypubEnabled) {
|
||||
throw new Error('[[error:activitypub.not-enabled]]');
|
||||
}
|
||||
|
||||
options = {
|
||||
cache: true,
|
||||
...options,
|
||||
@@ -358,6 +362,10 @@ async function sendMessage(uri, id, type, payload, attempts = 1) {
|
||||
}
|
||||
|
||||
ActivityPub.send = async (type, id, targets, payload) => {
|
||||
if (!meta.config.activitypubEnabled) {
|
||||
return ActivityPub.helpers.log('[activitypub/send] Federation not enabled; not sending.');
|
||||
}
|
||||
|
||||
if (!Array.isArray(targets)) {
|
||||
targets = [targets];
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
const nconf = require('nconf');
|
||||
const winston = require('winston');
|
||||
|
||||
const meta = require('../../meta');
|
||||
const user = require('../../user');
|
||||
const activitypub = require('../../activitypub');
|
||||
const helpers = require('../helpers');
|
||||
@@ -14,7 +15,7 @@ Controller.topics = require('./topics');
|
||||
|
||||
Controller.fetch = async (req, res, next) => {
|
||||
// Given a `resource` query parameter, attempts to retrieve and parse it
|
||||
if (!req.query.resource) {
|
||||
if (!meta.config.activitypubEnabled || !req.query.resource) {
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ apiController.loadConfig = async function (req) {
|
||||
version: fontawesome_version,
|
||||
},
|
||||
activitypub: {
|
||||
probe: meta.config.activitypubProbe,
|
||||
probe: meta.config.activitypubEnabled && meta.config.activitypubProbe,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user