move getIP function to its own module
This commit is contained in:
@@ -102,16 +102,7 @@ const cookiesecret = fs.readFileSync("cookiesecret.txt").toString()
|
||||
|
||||
const SHA = require("./extra_modules/SHA.js")
|
||||
|
||||
/**
|
||||
* gets ip of a request
|
||||
* @param {request} req
|
||||
* @returns ip of the given request, after taking preferred headers into account
|
||||
*/
|
||||
function getIP(req) {
|
||||
let ip = req.socket.remoteAddress;
|
||||
if(req.headers[config.preferred_ip_header] != undefined && ip == config.only_prefer_when_ip)ip = req.headers[config.preferred_ip_header]
|
||||
return ip
|
||||
}
|
||||
const getIP = require("./extra_modules/getip.js")
|
||||
|
||||
/**
|
||||
* quick function to convert data to base64
|
||||
|
||||
Reference in New Issue
Block a user