chore: replace amy's localhost hack
ya so basically it is either reverse proxy or everyone gets access granted in shit yourself if you dont use a reverse proxy Signed-off-by: deslokitty <deslokitty@desloratadyna.net>
This commit is contained in:
3
index.js
3
index.js
@@ -75,10 +75,11 @@ app.use((req, res, next) => {
|
|||||||
});
|
});
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
req.userId = verifyToken(req.cookies.token);
|
req.userId = verifyToken(req.cookies.token);
|
||||||
|
if (req.headers['x-forwarded-for']) return next();
|
||||||
|
|
||||||
const geo = geoip.lookup(req.headers['x-forwarded-for']);
|
const geo = geoip.lookup(req.headers['x-forwarded-for']);
|
||||||
console.log(geo);
|
console.log(geo);
|
||||||
|
|
||||||
if (geo)
|
|
||||||
if (geo.country !== "US")
|
if (geo.country !== "US")
|
||||||
if (geo.country !== "UA")
|
if (geo.country !== "UA")
|
||||||
if (geo.country !== "PL") {
|
if (geo.country !== "PL") {
|
||||||
|
|||||||
Reference in New Issue
Block a user