From 8f692b6f4d6f4e225507f7fd7633ed3913cc3e18 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Mon, 2 Jun 2025 20:32:05 -0700 Subject: [PATCH] call remote shutdown on app quit --- src/main/features/core/remote/index.ts | 2 +- src/main/index.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/features/core/remote/index.ts b/src/main/features/core/remote/index.ts index ea37b635..be192734 100644 --- a/src/main/features/core/remote/index.ts +++ b/src/main/features/core/remote/index.ts @@ -75,7 +75,7 @@ function send({ client, data, event }: SendData): void { } } -const shutdownServer = () => { +export const shutdownServer = () => { if (wsServer) { wsServer.clients.forEach((client) => client.close(4000)); wsServer.close(); diff --git a/src/main/index.ts b/src/main/index.ts index 9e5f9edc..331ce151 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -23,6 +23,7 @@ import path, { join } from 'path'; import { deflate, inflate } from 'zlib'; import { disableMediaKeys, enableMediaKeys } from './features/core/player/media-keys'; +import { shutdownServer } from './features/core/remote'; import { store } from './features/core/settings'; import MenuBuilder from './menu'; import { @@ -310,6 +311,7 @@ async function createWindow(first = true): Promise { }); ipcMain.on('window-quit', () => { + shutdownServer(); mainWindow?.close(); app.exit(); });