PadMessageHandler: Inline createSessionInfoAuth()

This function is only used once so it doesn't need to be separate.
This commit is contained in:
Richard Hansen 2021-10-30 00:27:09 -04:00
parent fa54dc1053
commit ce730b0493

View file

@ -187,8 +187,14 @@ exports.handleMessage = async (socket, message) => {
}
if (message.type === 'CLIENT_READY') {
// client tried to auth for the first time (first msg from the client)
createSessionInfoAuth(thisSession, 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.
thisSession.auth = {
sessionID: message.sessionID,
padID: message.padId,
token: message.token,
};
}
const auth = thisSession.auth;
@ -788,20 +794,6 @@ const _correctMarkersInPad = (atext, apool) => {
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
* to the server. The Client sends his token