15 lines
343 B
JavaScript
15 lines
343 B
JavaScript
/**
|
|
* Check the blacklist to see if we can serve files from this package.
|
|
*/
|
|
function checkBlacklist(blacklist) {
|
|
return function (req, res, next) {
|
|
if (blacklist.includes(req.packageName)) {
|
|
res.status(403).send(`Package ${req.packageName} is blacklisted`)
|
|
} else {
|
|
next()
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = checkBlacklist
|