From c20cd6bda1f831b477181084cc83028c3a254ba1 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sun, 7 Apr 2024 14:57:22 +0200 Subject: [PATCH] publicClient: add FIXME and ignore the type mismatch The publicClient interface is utterly horrific. It allows any client to inject arbitrary events into the socket.io event stream. This should get wrapped into a "plugin" event so that it can get properly typed, better yet, this should get removed completely. --- server/plugins/packages/publicClient.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/plugins/packages/publicClient.ts b/server/plugins/packages/publicClient.ts index 5774b006..8dd0f2d2 100644 --- a/server/plugins/packages/publicClient.ts +++ b/server/plugins/packages/publicClient.ts @@ -36,8 +36,11 @@ export default class PublicClient { * @param {String} event - Name of the event, must be something the browser will recognise * @param {Object} data - Body of the event, can be anything, but will need to be properly interpreted by the client */ + // FIXME: this is utterly bonkers + // This needs to get wrapped into its own, typed plugin event + // Plus it is completely insane to let a plugin inject arbitrary events like that sendToBrowser(event: string, data) { - this.client.emit(event, data); + this.client.emit(event as any, data as any); } /**