randydev commited on
Commit
6c8d3a7
·
verified ·
1 Parent(s): 3893e2e

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +6 -4
index.js CHANGED
@@ -101,14 +101,16 @@ app.use(async (req, res, next) => {
101
  }
102
 
103
  req.realIP = realIP;
104
- if (req.path === '/env') {
105
- console.log("check path /env");
106
- return await AddIpisBlocked(realIP)
107
- }
108
  const isBlocked = await CheckIsBlocked(realIP)
109
  if (isBlocked && isBlocked.blocked === true) {
110
  return res.status(403).send("Access denied: IP is blocked");
111
  }
 
 
 
 
 
 
112
  await IPAddressAndUpdate(realIP);
113
  console.log(`Real IP address is: ${realIP}, header: ${xForwardedFor ? "x-forwarded-for" : xRealIP ? "x-real-ip" : cfConnectingIP ? "cf-connecting-ip" : "req.ip"} `);
114
  await next();
 
101
  }
102
 
103
  req.realIP = realIP;
 
 
 
 
104
  const isBlocked = await CheckIsBlocked(realIP)
105
  if (isBlocked && isBlocked.blocked === true) {
106
  return res.status(403).send("Access denied: IP is blocked");
107
  }
108
+ if (req.path === '/env') {
109
+ console.log("check path /env");
110
+ await AddIpisBlocked(realIP)
111
+ return res.status(403).send("Access denied: IP is blocked..");
112
+ }
113
+
114
  await IPAddressAndUpdate(realIP);
115
  console.log(`Real IP address is: ${realIP}, header: ${xForwardedFor ? "x-forwarded-for" : xRealIP ? "x-real-ip" : cfConnectingIP ? "cf-connecting-ip" : "req.ip"} `);
116
  await next();