From 5bb615d332b87ace75e5e8280155f5f6b04de319 Mon Sep 17 00:00:00 2001 From: ItsRiprod Date: Mon, 9 Dec 2024 17:31:29 -0700 Subject: [PATCH] Crucial v0.10.2 fixes --- DeskThingServer/package.json | 2 +- .../src/main/services/client/websocket.ts | 4 +++- .../Mapping/components/AvailableKeysComponent.tsx | 2 +- .../src/pages/Clients/Mapping/pages/CarThingPage.tsx | 12 ++++++------ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/DeskThingServer/package.json b/DeskThingServer/package.json index e5bc696..036938e 100644 --- a/DeskThingServer/package.json +++ b/DeskThingServer/package.json @@ -1,6 +1,6 @@ { "name": "deskthing", - "version": "0.10.1", + "version": "0.10.2", "description": "A DeskThing server UI to interface with the DeskThing car thing app", "main": "./out/main/index.js", "author": "Riprod", diff --git a/DeskThingServer/src/main/services/client/websocket.ts b/DeskThingServer/src/main/services/client/websocket.ts index 6cecce3..a235c84 100644 --- a/DeskThingServer/src/main/services/client/websocket.ts +++ b/DeskThingServer/src/main/services/client/websocket.ts @@ -41,6 +41,8 @@ export const Clients: { client: Client; socket }[] = [] let currentPort let currentAddress +const alwaysAllow = ['preferences', 'ping', 'pong', 'manifest'] + const messageThrottles = new Map() const THROTTLE_DELAY = 300 // milliseconds @@ -198,7 +200,7 @@ export const setupServer = async (): Promise => { * they often send the same request at the same time (i.e. song at its end). * As most, if not all, of these requests are burst to every client, they can be grouped together. */ - const alwaysAllow = ['get', 'set', 'update', 'delete'] + if ( !messageThrottles.has(messageKey) || now - messageThrottles.get(messageKey) > THROTTLE_DELAY || diff --git a/DeskThingServer/src/renderer/src/pages/Clients/Mapping/components/AvailableKeysComponent.tsx b/DeskThingServer/src/renderer/src/pages/Clients/Mapping/components/AvailableKeysComponent.tsx index c0872f3..a4a94b9 100644 --- a/DeskThingServer/src/renderer/src/pages/Clients/Mapping/components/AvailableKeysComponent.tsx +++ b/DeskThingServer/src/renderer/src/pages/Clients/Mapping/components/AvailableKeysComponent.tsx @@ -49,7 +49,7 @@ const AvailableKeys: React.FC = ({ handleKeyPress={handleModeClick} Key={key} currentKey={currentKey} - action={currentMapping.mapping[key.id][mode]} + action={currentMapping.mapping[key.id]?.[mode || EventMode.KeyDown] || undefined} /> ))} diff --git a/DeskThingServer/src/renderer/src/pages/Clients/Mapping/pages/CarThingPage.tsx b/DeskThingServer/src/renderer/src/pages/Clients/Mapping/pages/CarThingPage.tsx index 233ba5e..0c1cb2b 100644 --- a/DeskThingServer/src/renderer/src/pages/Clients/Mapping/pages/CarThingPage.tsx +++ b/DeskThingServer/src/renderer/src/pages/Clients/Mapping/pages/CarThingPage.tsx @@ -44,14 +44,14 @@ const CarThingPage: React.FC = ({