Skip to content

Node.js based forum software built for the modern web

fix: optimizations

Julian Lame697d600d1c1
diff --git a/install/package.json b/install/package.json
index 3e79753f0d..9f68b5a0d5 100644
--- a/install/package.json
+++ b/install/package.json
@@ -103,7 +103,7 @@
"nodebb-plugin-emoji-android": "4.1.1",
"nodebb-plugin-link-preview": "2.2.2",
"nodebb-plugin-markdown": "13.2.3",
- "nodebb-plugin-mentions": "4.8.5",
+ "nodebb-plugin-mentions": "4.8.6",
"nodebb-plugin-spam-be-gone": "2.3.2",
"nodebb-plugin-web-push": "0.7.6",
"nodebb-rewards-essentials": "1.0.2",
@@ -203,4 +203,4 @@
"url": "https://github.com/barisusakli"
}
]
-}
\ No newline at end of file
+}
diff --git a/src/activitypub/actors.js b/src/activitypub/actors.js
index 4720390ed3..bd339a7f5d 100644
--- a/src/activitypub/actors.js
+++ b/src/activitypub/actors.js
@@ -45,6 +45,9 @@ Actors.qualify = async (ids, options = {}) => {
// Filter out uids if passed in
ids = ids.filter(id => !utils.isNumber(id));
+ // Filter out constants
+ ids = ids.filter(id => !activitypub._constants.acceptablePublicAddresses.includes(id));
+
// Translate webfinger handles to uris
ids = (await Promise.all(ids.map(async (id) => {
const originalId = id;
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index ff028c4888..7dab8ad6ba 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -491,13 +491,23 @@ ActivityPub.buildRecipients = async function (object, { pid, uid, cid }) {
const targets = new Set([...followers, ...to, ...cc]);
- // Remove any ids that aren't asserted actors
- const exists = await db.isSortedSetMembers('usersRemote:lastCrawled', [...targets]);
- Array.from(targets).forEach((uri, idx) => {
- if (!exists[idx]) {
- targets.delete(uri);
+ // Remove local uris, public addresses, and any ids that aren't asserted actors
+ targets.forEach((address) => {
+ if (address.startsWith(nconf.get('url'))) {
+ targets.delete(address);
}
});
+ ActivityPub._constants.acceptablePublicAddresses.forEach((address) => {
+ targets.delete(address);
+ });
+ if (targets.size) {
+ const exists = await db.isSortedSetMembers('usersRemote:lastCrawled', [...targets]);
+ Array.from(targets).forEach((uri, idx) => {
+ if (!exists[idx]) {
+ targets.delete(uri);
+ }
+ });
+ }
// Topic posters, post announcers and their followers
if (pid) {
diff --git a/src/plugins/install.js b/src/plugins/install.js
index f3da1c3fb8..b79831982f 100644
--- a/src/plugins/install.js
+++ b/src/plugins/install.js
@@ -177,7 +177,9 @@ module.exports = function (Plugins) {
if (nconf.get('plugins:active')) {
return nconf.get('plugins:active');
}
- return await db.getSortedSetRange('plugins:active', 0, -1);
+ const active = await db.getSortedSetRange('plugins:active', 0, -1);
+ nconf.set('plugins:active', active);
+ return active;
};
Plugins.autocomplete = async (fragment) => {