More web stuff (#5055)

* Add Response.gamesOfuser

* Cleanup and confirm all
This commit is contained in:
Zach H 2024-06-16 22:48:07 -04:00 committed by GitHub
parent f04702fdd1
commit 291c535edb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 71 additions and 24 deletions

View file

@ -319,14 +319,14 @@ describe.skip('SessionEvents', () => {
});
it('should update stat/info and activate account', () => {
jest.spyOn(SessionCommands, 'activateAccount').mockImplementation(() => {});
jest.spyOn(SessionCommands, 'activate').mockImplementation(() => {});
webClient.options.reason = WebSocketConnectReason.ACTIVATE_ACCOUNT;
event(data);
expect(SessionPersistence.updateInfo).toHaveBeenCalledWith(data.serverName, data.serverVersion);
expect(SessionCommands.activateAccount).toHaveBeenCalled();
expect(SessionCommands.activate).toHaveBeenCalled();
});
it('should disconnect if protocolVersion mismatched', () => {

View file

@ -2,13 +2,13 @@ import { StatusEnum, WebSocketConnectReason } from 'types';
import webClient from '../../WebClient';
import {
activateAccount,
activate,
disconnect,
login,
register,
requestPasswordSalt,
resetPassword,
resetPasswordChallenge,
forgotPasswordChallenge,
forgotPasswordRequest,
resetPasswordRequest,
updateStatus,
} from '../../commands/session';
@ -44,20 +44,20 @@ export function serverIdentification(info: ServerIdentificationData) {
if (getPasswordSalt) {
requestPasswordSalt(options);
} else {
activateAccount(options);
activate(options);
}
break;
case WebSocketConnectReason.PASSWORD_RESET_REQUEST:
resetPasswordRequest(options);
break;
case WebSocketConnectReason.PASSWORD_RESET_CHALLENGE:
resetPasswordChallenge(options);
forgotPasswordChallenge(options);
break;
case WebSocketConnectReason.PASSWORD_RESET:
if (getPasswordSalt) {
requestPasswordSalt(options);
} else {
resetPassword(options);
forgotPasswordRequest(options);
}
break;
default: