Skip to content

Commit

Permalink
v0.9.0 Hotfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsRiprod committed Oct 31, 2024
1 parent cae145b commit 76fbb7a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
9 changes: 8 additions & 1 deletion DeskThingServer/src/main/handlers/musicHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class MusicHandler {
const settings = await settingsStore.getSettings() // Get from your settings store
this.updateRefreshInterval(settings.refreshInterval)
dataListener.on(MESSAGE_TYPES.SETTINGS, this.handleSettingsUpdate)

setTimeout(() => {
this.refreshMusicData()
}, 5000) // Delay to ensure settings are loaded
}

private handleSettingsUpdate = (settings: Settings): void => {
Expand Down Expand Up @@ -51,7 +55,10 @@ export class MusicHandler {

private async refreshMusicData(): Promise<void> {
if (!this.currentApp || this.currentApp.length == 0) {
dataListener.asyncEmit(MESSAGE_TYPES.ERROR, `[MusicHandler]: No current app set!`)
dataListener.asyncEmit(
MESSAGE_TYPES.ERROR,
`[MusicHandler]: No playback location set! Go to settings -> Music to the playback location!`
)
return
}

Expand Down
2 changes: 2 additions & 0 deletions DeskThingServer/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ async function loadModules(): Promise<void> {

const { loadAndRunEnabledApps } = await import('./services/apps')
loadAndRunEnabledApps()

import('./handlers/musicHandler')
} catch (error) {
console.error('Error loading modules:', error)
}
Expand Down
2 changes: 1 addition & 1 deletion DeskThingServer/src/main/services/client/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
sendSettingsData
} from './clientCom'
import { sendIpcData } from '../..'
import MusicHandler from '../../handlers/musicHandler'

export let server: WebSocketServer | null = null
export let httpServer: HttpServer
Expand Down Expand Up @@ -194,6 +193,7 @@ export const setupServer = async (): Promise<void> => {
handleServerMessage(socket, client, messageData)
} else if (messageData.app === 'utility' || messageData.app === 'music') {
// Handle music requests
const MusicHandler = (await import('../../handlers/musicHandler')).default
MusicHandler.handleClientRequest(messageData)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ const AppSettings: React.FC<AppSettingProps> = ({ app }) => {
...prev,
settings: {
...prev.settings,
[key]: { ...prev.settings[key], value: value as any }
[key]: {
...prev.settings[key],
// It had to be this way... The way that the type expects a specific value for each type of object means that this can only be every type of value but only one at a time. We have no way of knowing which type of setting it is.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value: value as any
}
}
}
: prev
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { useNotificationStore } from '@renderer/stores'
import { IconTrash, IconX } from '@renderer/assets/icons'
import { IconTrash } from '@renderer/assets/icons'
import Button from '@renderer/components/Button'

const EvensPage: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const RequestsPage: React.FC = () => {
<div className="w-full h-full p-4 flex flex-col">
<h1 className="text-2xl font-bold mb-4">App Requests</h1>
<div className="bg-red-950 px-4 py-1 rounded-lg shadow-lg my-2">
<p className="text-xs italic text-gray-300">Requests will be depreciated in a future release</p>
<p className="text-xs italic text-gray-300">
Requests will be depreciated in a future release
</p>
</div>
<div className="w-full h-full relative overflow-y-auto">
{requests.length > 0 ? (
Expand Down
6 changes: 3 additions & 3 deletions DeskThingServer/src/renderer/src/pages/Apps/AppsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ const AppsList: React.FC = () => {
})
}

const handleDragOver = (e: React.DragEvent<HTMLDivElement>, index: number) => {
const handleDragOver = (e: React.DragEvent<HTMLDivElement>, index: number): void => {
e.preventDefault()
setDragOverIndex(index)
}

const handleDragLeave = () => {
const handleDragLeave = (): void => {
setDragOverIndex(null)
}

const handleDrop = (targetAppName: string) => {
const handleDrop = (targetAppName: string): void => {
if (draggedApp && draggedApp !== targetAppName) {
const newOrder = [...order]
const draggedIndex = newOrder.indexOf(draggedApp)
Expand Down

0 comments on commit 76fbb7a

Please sign in to comment.