mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
PadMessageHandler: Inline createSessionInfoAuth()
This function is only used once so it doesn't need to be separate.
This commit is contained in:
parent
fa54dc1053
commit
ce730b0493
1 changed files with 8 additions and 16 deletions
|
@ -187,8 +187,14 @@ exports.handleMessage = async (socket, message) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === 'CLIENT_READY') {
|
if (message.type === 'CLIENT_READY') {
|
||||||
// client tried to auth for the first time (first msg from the client)
|
// Remember this information since we won't have the cookie in further socket.io messages. This
|
||||||
createSessionInfoAuth(thisSession, message);
|
// information will be used to check if the sessionId of this connection is still valid since it
|
||||||
|
// could have been deleted by the API.
|
||||||
|
thisSession.auth = {
|
||||||
|
sessionID: message.sessionID,
|
||||||
|
padID: message.padId,
|
||||||
|
token: message.token,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auth = thisSession.auth;
|
const auth = thisSession.auth;
|
||||||
|
@ -788,20 +794,6 @@ const _correctMarkersInPad = (atext, apool) => {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates/replaces the auth object in the given session info.
|
|
||||||
const createSessionInfoAuth = (sessionInfo, message) => {
|
|
||||||
// Remember this information since we won't
|
|
||||||
// have the cookie in further socket.io messages.
|
|
||||||
// This information will be used to check if
|
|
||||||
// the sessionId of this connection is still valid
|
|
||||||
// since it could have been deleted by the API.
|
|
||||||
sessionInfo.auth = {
|
|
||||||
sessionID: message.sessionID,
|
|
||||||
padID: message.padId,
|
|
||||||
token: message.token,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a CLIENT_READY. A CLIENT_READY is the first message from the client
|
* Handles a CLIENT_READY. A CLIENT_READY is the first message from the client
|
||||||
* to the server. The Client sends his token
|
* to the server. The Client sends his token
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue