From 30c8be07e796e96a8d6c1f1571fd29d614aa5207 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Thu, 5 Sep 2024 11:54:09 -0600 Subject: [PATCH] Use readFileSync for blacklist --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 302836d..d91a201 100644 --- a/index.js +++ b/index.js @@ -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({