mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
fix: export sendMessage as _sendMessage for use in ap jobs lib
This commit is contained in:
@@ -355,7 +355,7 @@ ActivityPub.get = async (type, id, uri, options) => {
|
||||
}
|
||||
};
|
||||
|
||||
async function sendMessage(uri, id, type, payload) {
|
||||
ActivityPub._sendMessage = async function (uri, id, type, payload) {
|
||||
try {
|
||||
const keyData = await ActivityPub.getPrivateKey(type, id);
|
||||
const headers = await ActivityPub.sign(keyData, uri, payload);
|
||||
@@ -381,7 +381,7 @@ async function sendMessage(uri, id, type, payload) {
|
||||
ActivityPub.helpers.log(`[activitypub/send] Could not send ${payload.type} to ${uri}; error: ${e.message}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ActivityPub.send = async (type, id, targets, payload) => {
|
||||
if (!meta.config.activitypubEnabled) {
|
||||
@@ -415,7 +415,7 @@ ActivityPub.send = async (type, id, targets, payload) => {
|
||||
const retryQueuedSet = [];
|
||||
|
||||
await Promise.all(inboxBatch.map(async (uri) => {
|
||||
const ok = await sendMessage(uri, id, type, payload);
|
||||
const ok = await ActivityPub._sendMessage(uri, id, type, payload);
|
||||
if (!ok) {
|
||||
const queueId = crypto.createHash('sha256').update(`${type}:${id}:${uri}`).digest('hex');
|
||||
const nextTryOn = Date.now() + oneMinute;
|
||||
|
||||
@@ -65,7 +65,7 @@ async function retryFailedMessages() {
|
||||
queueIdsToRemove.push(queueId);
|
||||
return;
|
||||
}
|
||||
const ok = await sendMessage(uri, id, type, payloadObj);
|
||||
const ok = await activitypub._sendMessage(uri, id, type, payloadObj);
|
||||
if (ok) {
|
||||
queueIdsToRemove.push(queueId);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user