Skip to content

Commit

Permalink
Merge pull request #85 from ItsRiprod/v0.10.0
Browse files Browse the repository at this point in the history
Crucial v0.10.2 fixes
  • Loading branch information
ItsRiprod authored Dec 10, 2024
2 parents 0d4e549 + 5bb615d commit c3b5da3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DeskThingServer/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion DeskThingServer/src/main/services/client/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -198,7 +200,7 @@ export const setupServer = async (): Promise<void> => {
* 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 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const AvailableKeys: React.FC<AvailableKeysProps> = ({
handleKeyPress={handleModeClick}
Key={key}
currentKey={currentKey}
action={currentMapping.mapping[key.id][mode]}
action={currentMapping.mapping[key.id]?.[mode || EventMode.KeyDown] || undefined}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ const CarThingPage: React.FC<PageProps> = ({
<div className="flex -translate-x-12 flex-col h-1/3 items-center justify-center aspect-square">
<div className="flex w-full h-full items-center justify-center">
<Button
className={`flex hover:bg-zinc-700 items-center justify-center rounded-lg p-3 ${mode == EventMode.SwipeUp ? 'bg-zinc-800' : 'bg-zinc-900'}`}
onClick={() => onPress('Swipe', EventMode.SwipeUp)}
className={`flex hover:bg-zinc-700 items-center justify-center rounded-lg p-3 ${mode == EventMode.SwipeDown ? 'bg-zinc-800' : 'bg-zinc-900'}`}
onClick={() => onPress('Swipe', EventMode.SwipeDown)}
>
<ActionIcon
className="w-fit h-fit"
action={
currentMapping && miniplayerKeys.length > 0
? currentMapping.mapping['Swipe'][EventMode.SwipeUp]
? currentMapping.mapping['Swipe'][EventMode.SwipeDown]
: undefined
}
/>
Expand Down Expand Up @@ -87,14 +87,14 @@ const CarThingPage: React.FC<PageProps> = ({
</div>
<div className="flex w-full h-full items-center justify-center">
<Button
className={`flex hover:bg-zinc-700 items-center justify-center rounded-lg p-3 ${mode == EventMode.SwipeDown ? 'bg-zinc-800' : 'bg-zinc-900'}`}
onClick={() => onPress('Swipe', EventMode.SwipeDown)}
className={`flex hover:bg-zinc-700 items-center justify-center rounded-lg p-3 ${mode == EventMode.SwipeUp ? 'bg-zinc-800' : 'bg-zinc-900'}`}
onClick={() => onPress('Swipe', EventMode.SwipeUp)}
>
<ActionIcon
className="w-fit h-fit"
action={
currentMapping && miniplayerKeys.length > 0
? currentMapping.mapping['Swipe'][EventMode.SwipeDown]
? currentMapping.mapping['Swipe'][EventMode.SwipeUp]
: undefined
}
/>
Expand Down

0 comments on commit c3b5da3

Please sign in to comment.