-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 8356c0a.
- Loading branch information
1 parent
8356c0a
commit f461037
Showing
1 changed file
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
const { sendResponse, errorResponseUnauthorized } = require('./apiHelpers') | ||
const config = require('./config') | ||
|
||
async function userNodeMiddleware (req, res, next) { | ||
// Disable all UM specific filtering | ||
return next() | ||
const isUserMetadataNode = config.get('isUserMetadataNode') | ||
const userNodeRegex = new RegExp(/(users|version|db_check|health_check|image_upload|ipfs|export)/gm) | ||
if (isUserMetadataNode) { | ||
const isValidUrl = userNodeRegex.test(req.url) | ||
if (!isValidUrl) { | ||
return sendResponse(req, res, errorResponseUnauthorized('Invalid route for user metadata node')) | ||
} | ||
next() | ||
} else { | ||
next() | ||
} | ||
} | ||
|
||
module.exports = { userNodeMiddleware } |