mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 06:56:18 +02:00
feat: redirect cold requests to remote resources to their canonical source, #14043
This commit is contained in:
@@ -24,6 +24,10 @@ profileController.get = async function (req, res, next) {
|
|||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (meta.config.activitypubEnabled && !res.locals.isAPI && !utils.isNumber(userData.uid)) {
|
||||||
|
return helpers.redirect(res, `/outgoing?url=${encodeURIComponent(userData.uid)}`);
|
||||||
|
}
|
||||||
|
|
||||||
await incrementProfileViews(req, userData);
|
await incrementProfileViews(req, userData);
|
||||||
|
|
||||||
const [latestPosts, bestPosts, customUserFields] = await Promise.all([
|
const [latestPosts, bestPosts, customUserFields] = await Promise.all([
|
||||||
|
|||||||
@@ -19,12 +19,16 @@ postsController.redirectToPost = async function (req, res, next) {
|
|||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kickstart note assertion if applicable
|
// Kickstart note assertion if applicable -- might not be needed, if no ill effects, remove 1 Apr 2026
|
||||||
if (!utils.isNumber(pid) && req.uid && meta.config.activitypubEnabled) {
|
// if (!utils.isNumber(pid) && req.uid && meta.config.activitypubEnabled) {
|
||||||
const exists = await posts.exists(pid);
|
// const exists = await posts.exists(pid);
|
||||||
if (!exists) {
|
// if (!exists) {
|
||||||
await activitypub.notes.assert(req.uid, pid);
|
// await activitypub.notes.assert(req.uid, pid);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (meta.config.activitypubEnabled && !res.locals.isAPI && !utils.isNumber(pid)) {
|
||||||
|
return helpers.redirect(res, `/outgoing?url=${encodeURIComponent(pid)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [canRead, path] = await Promise.all([
|
const [canRead, path] = await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user