Use readFileSync for blacklist

This commit is contained in:
Christopher Cookman 2024-09-05 11:54:09 -06:00
parent 0ae45cda07
commit 30c8be07e7
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -13,7 +13,7 @@ if (!fs.existsSync("./blacklist.json")) {
}
app.use((req, res, next) => { // Blacklist handler
let blacklist = require("./blacklist.json"); // Get it every time to update it
const blacklist = JSON.parse(fs.readFileSync("./blacklist.json", "utf-8"));
if (blacklist.includes(req.ip)) {
console.log(`[${new Date().toLocaleString()}] ${req.ip} ${req.method} ${req.url} - Blacklisted`);
return res.status(403).json({