Use readFileSync for blacklist
This commit is contained in:
		
							parent
							
								
									0ae45cda07
								
							
						
					
					
						commit
						30c8be07e7
					
				
							
								
								
									
										2
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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({ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue