CODEBASE: Recheck all usages of typecasting with JSON.parse (#1775)

This commit is contained in:
catloversg
2024-11-21 14:47:02 +07:00
committed by GitHub
parent 70a231e421
commit 8c4fcfe045
7 changed files with 55 additions and 28 deletions
+4
View File
@@ -40,6 +40,10 @@ export class Remote {
}
function handleMessageEvent(this: WebSocket, e: MessageEvent): void {
/**
* Validating e.data and the result of JSON.parse() is too troublesome, so we typecast them here. If the data is
* invalid, it means the RFA "client" (the tool that the player is using) is buggy, but that's not our problem.
*/
const msg = JSON.parse(e.data as string) as RFAMessage;
if (!msg.method || !RFARequestHandler[msg.method]) {