mirror of
https://github.com/szimek/sharedrop.git
synced 2026-06-13 21:03:07 +08:00
Temporary fix for remote IP address from CloudFlare
This commit is contained in:
parent
75bdbf97a8
commit
58349bc554
@ -22,6 +22,8 @@ module.exports.server = function (options) {
|
||||
options = options || {};
|
||||
base = options.base || ['.'];
|
||||
|
||||
app.enable('trust proxy');
|
||||
|
||||
app.use(express.logger());
|
||||
app.use(express.urlencoded());
|
||||
app.use(express.cookieParser());
|
||||
@ -58,8 +60,7 @@ module.exports.server = function (options) {
|
||||
});
|
||||
|
||||
app.get('/room', function (req, res) {
|
||||
var ips = req.headers['x-forwarded-for'] || req.ip,
|
||||
ip = ips.split(',').pop().trim(),
|
||||
var ip = req.headers['cf-connecting-ip'] || req.ip,
|
||||
name = crypto.createHmac('md5', secret).update(ip).digest('hex');
|
||||
|
||||
res.json({name: name, public_ip: ip});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user