call remote shutdown on app quit

This commit is contained in:
jeffvli 2025-06-02 20:32:05 -07:00
parent 7562c619d2
commit 8f692b6f4d
2 changed files with 3 additions and 1 deletions

View file

@ -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();

View file

@ -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<void> {
});
ipcMain.on('window-quit', () => {
shutdownServer();
mainWindow?.close();
app.exit();
});