mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
cleanup and unit tests (#4434)
* put socket.updateHistory behind SessionCommand * rename /websocket files from .tsx to .ts * add unit tests to websocket commands * complete unit tests for webClient commands * secure wss Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
parent
e9ba195d7d
commit
f75ff2a7c8
14 changed files with 611 additions and 48 deletions
|
|
@ -1,75 +0,0 @@
|
|||
import { ServerDispatch } from "store";
|
||||
import { Log, StatusEnum, User } from "types";
|
||||
|
||||
import { sanitizeHtml } from "websocket/utils";
|
||||
import NormalizeService from "../utils/NormalizeService";
|
||||
|
||||
export class SessionPersistence {
|
||||
static clearStore() {
|
||||
ServerDispatch.clearStore();
|
||||
}
|
||||
|
||||
static connectionClosed(reason: number) {
|
||||
ServerDispatch.connectionClosed(reason);
|
||||
}
|
||||
|
||||
static updateBuddyList(buddyList) {
|
||||
ServerDispatch.updateBuddyList(buddyList);
|
||||
}
|
||||
|
||||
static addToBuddyList(user: User) {
|
||||
ServerDispatch.addToBuddyList(user);
|
||||
}
|
||||
|
||||
static removeFromBuddyList(userName: string) {
|
||||
ServerDispatch.removeFromBuddyList(userName);
|
||||
}
|
||||
|
||||
static updateIgnoreList(ignoreList) {
|
||||
ServerDispatch.updateIgnoreList(ignoreList);
|
||||
}
|
||||
|
||||
static addToIgnoreList(user: User) {
|
||||
ServerDispatch.addToIgnoreList(user);
|
||||
}
|
||||
|
||||
static removeFromIgnoreList(userName: string) {
|
||||
ServerDispatch.removeFromIgnoreList(userName);
|
||||
}
|
||||
|
||||
static updateInfo(name: string, version: string) {
|
||||
ServerDispatch.updateInfo(name, version);
|
||||
}
|
||||
|
||||
static updateStatus(state: number, description: string) {
|
||||
ServerDispatch.updateStatus(state, description);
|
||||
|
||||
if (state === StatusEnum.DISCONNECTED) {
|
||||
this.connectionClosed(state);
|
||||
}
|
||||
}
|
||||
|
||||
static updateUser(user: User) {
|
||||
ServerDispatch.updateUser(user);
|
||||
}
|
||||
|
||||
static updateUsers(users: User[]) {
|
||||
ServerDispatch.updateUsers(users);
|
||||
}
|
||||
|
||||
static userJoined(user: User) {
|
||||
ServerDispatch.userJoined(user);
|
||||
}
|
||||
|
||||
static userLeft(userName: string) {
|
||||
ServerDispatch.userLeft(userName);
|
||||
}
|
||||
|
||||
static viewLogs(logs: Log[]) {
|
||||
ServerDispatch.viewLogs(NormalizeService.normalizeLogs(logs));
|
||||
}
|
||||
|
||||
static serverMessage(message: string) {
|
||||
ServerDispatch.serverMessage(sanitizeHtml(message));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue