mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-19 05:58:32 +03:00
@@ -8,7 +8,7 @@
|
|||||||
"discordReportChannelWebhookURL": null, //URL from discord if you would like notifications when someone makes a report [optional]
|
"discordReportChannelWebhookURL": null, //URL from discord if you would like notifications when someone makes a report [optional]
|
||||||
"discordFirstTimeSubmissionsWebhookURL": null, //URL from discord if you would like notifications when someone makes a first time submission [optional]
|
"discordFirstTimeSubmissionsWebhookURL": null, //URL from discord if you would like notifications when someone makes a first time submission [optional]
|
||||||
"discordCompletelyIncorrectReportWebhookURL": null, //URL from discord if you would like notifications when someone reports a submission as completely incorrect [optional]
|
"discordCompletelyIncorrectReportWebhookURL": null, //URL from discord if you would like notifications when someone reports a submission as completely incorrect [optional]
|
||||||
"behindProxy": true,
|
"behindProxy": "X-Forwarded-For", //Options: "X-Forwarded-For", "Cloudflare", "X-Real-IP", anything else will mean it is not behind a proxy. True defaults to "X-Forwarded-For"
|
||||||
"db": "./databases/sponsorTimes.db",
|
"db": "./databases/sponsorTimes.db",
|
||||||
"privateDB": "./databases/private.db",
|
"privateDB": "./databases/private.db",
|
||||||
"createDatabaseIfNotExist": true, //This will run on startup every time (unless readOnly is true) - so ensure "create table if not exists" is used in the schema
|
"createDatabaseIfNotExist": true, //This will run on startup every time (unless readOnly is true) - so ensure "create table if not exists" is used in the schema
|
||||||
|
|||||||
@@ -2,5 +2,16 @@ var fs = require('fs');
|
|||||||
var config = require('../config.js');
|
var config = require('../config.js');
|
||||||
|
|
||||||
module.exports = function getIP(req) {
|
module.exports = function getIP(req) {
|
||||||
return config.behindProxy ? req.headers['x-forwarded-for'] : req.connection.remoteAddress;
|
if (config.behindProxy === true || config.behindProxy === "true") config.behindProxy = "X-Forwarded-For";
|
||||||
}
|
|
||||||
|
switch (config.behindProxy) {
|
||||||
|
case "X-Forwarded-For":
|
||||||
|
return req.headers['X-Forwarded-For'];
|
||||||
|
case "Cloudflare":
|
||||||
|
return req.headers['CF-Connecting-IP'];
|
||||||
|
case "X-Real-IP":
|
||||||
|
return req.headers['X-Real-IP'];
|
||||||
|
default:
|
||||||
|
return req.connection.remoteAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user