mirror of
https://github.com/thelounge/thelounge
synced 2024-11-27 06:20:26 +00:00
Merge pull request #1625 from thelounge/socket.io-2.0.3
Update socket.io to 2.0.3
This commit is contained in:
commit
b2985a2c2a
2 changed files with 8 additions and 8 deletions
|
@ -54,7 +54,7 @@
|
|||
"read": "1.0.7",
|
||||
"request": "2.83.0",
|
||||
"semver": "5.4.1",
|
||||
"socket.io": "1.7.4",
|
||||
"socket.io": "2.0.3",
|
||||
"spdy": "3.4.7",
|
||||
"ua-parser-js": "0.7.14",
|
||||
"urijs": "1.19.0",
|
||||
|
@ -80,7 +80,7 @@
|
|||
"mousetrap": "1.6.1",
|
||||
"npm-run-all": "4.1.1",
|
||||
"nyc": "11.2.1",
|
||||
"socket.io-client": "1.7.4",
|
||||
"socket.io-client": "2.0.3",
|
||||
"stylelint": "8.2.0",
|
||||
"stylelint-config-standard": "17.0.0",
|
||||
"webpack": "3.7.0"
|
||||
|
|
|
@ -181,11 +181,11 @@ module.exports = function() {
|
|||
return server;
|
||||
};
|
||||
|
||||
function getClientIp(request) {
|
||||
let ip = request.connection.remoteAddress;
|
||||
function getClientIp(socket) {
|
||||
let ip = socket.handshake.address;
|
||||
|
||||
if (Helper.config.reverseProxy) {
|
||||
const forwarded = (request.headers["x-forwarded-for"] || "").split(/\s*,\s*/).filter(Boolean);
|
||||
const forwarded = (socket.request.headers["x-forwarded-for"] || "").split(/\s*,\s*/).filter(Boolean);
|
||||
|
||||
if (forwarded.length && net.isIP(forwarded[0])) {
|
||||
ip = forwarded[0];
|
||||
|
@ -458,7 +458,7 @@ function initializeClient(socket, client, token, lastMessage) {
|
|||
client.generateToken((newToken) => {
|
||||
token = newToken;
|
||||
|
||||
client.updateSession(token, getClientIp(socket.request), socket.request);
|
||||
client.updateSession(token, getClientIp(socket), socket.request);
|
||||
|
||||
sendInitEvent(token);
|
||||
});
|
||||
|
@ -474,7 +474,7 @@ function performAuthentication(data) {
|
|||
const finalInit = () => initializeClient(socket, client, data.token || null, data.lastMessage || -1);
|
||||
|
||||
const initClient = () => {
|
||||
client.ip = getClientIp(socket.request);
|
||||
client.ip = getClientIp(socket);
|
||||
|
||||
// If webirc is enabled perform reverse dns lookup
|
||||
if (Helper.config.webirc === null) {
|
||||
|
@ -523,7 +523,7 @@ function performAuthentication(data) {
|
|||
|
||||
// We have found an existing user and client has provided a token
|
||||
if (client && data.token && typeof client.config.sessions[data.token] !== "undefined") {
|
||||
client.updateSession(data.token, getClientIp(socket.request), socket.request);
|
||||
client.updateSession(data.token, getClientIp(socket), socket.request);
|
||||
|
||||
authCallback(true);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue