mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-08 05:30:40 +01: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();
|
||||
}
|
||||
|
||||
if (meta.config.activitypubEnabled && !res.locals.isAPI && !utils.isNumber(userData.uid)) {
|
||||
return helpers.redirect(res, `/outgoing?url=${encodeURIComponent(userData.uid)}`);
|
||||
}
|
||||
|
||||
await incrementProfileViews(req, userData);
|
||||
|
||||
const [latestPosts, bestPosts, customUserFields] = await Promise.all([
|
||||
|
||||
@@ -19,12 +19,16 @@ postsController.redirectToPost = async function (req, res, next) {
|
||||
return next();
|
||||
}
|
||||
|
||||
// Kickstart note assertion if applicable
|
||||
if (!utils.isNumber(pid) && req.uid && meta.config.activitypubEnabled) {
|
||||
const exists = await posts.exists(pid);
|
||||
if (!exists) {
|
||||
await activitypub.notes.assert(req.uid, pid);
|
||||
}
|
||||
// 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) {
|
||||
// const exists = await posts.exists(pid);
|
||||
// if (!exists) {
|
||||
// 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([
|
||||
|
||||
Reference in New Issue
Block a user