mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-24 08:19:48 +01:00
fix: optimizations
- plugins.isActive response now cached in nconf - public addresses filtered out of actor assertion logic during qualification stage - bump mentions to fix db call with empty values - update buildRecipients to exclude public addresses and local URIs when building targeting array
This commit is contained in:
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user