mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-17 00:44:23 +02:00
call remote shutdown on app quit
This commit is contained in:
@@ -75,7 +75,7 @@ function send({ client, data, event }: SendData): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const shutdownServer = () => {
|
export const shutdownServer = () => {
|
||||||
if (wsServer) {
|
if (wsServer) {
|
||||||
wsServer.clients.forEach((client) => client.close(4000));
|
wsServer.clients.forEach((client) => client.close(4000));
|
||||||
wsServer.close();
|
wsServer.close();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import path, { join } from 'path';
|
|||||||
import { deflate, inflate } from 'zlib';
|
import { deflate, inflate } from 'zlib';
|
||||||
|
|
||||||
import { disableMediaKeys, enableMediaKeys } from './features/core/player/media-keys';
|
import { disableMediaKeys, enableMediaKeys } from './features/core/player/media-keys';
|
||||||
|
import { shutdownServer } from './features/core/remote';
|
||||||
import { store } from './features/core/settings';
|
import { store } from './features/core/settings';
|
||||||
import MenuBuilder from './menu';
|
import MenuBuilder from './menu';
|
||||||
import {
|
import {
|
||||||
@@ -310,6 +311,7 @@ async function createWindow(first = true): Promise<void> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('window-quit', () => {
|
ipcMain.on('window-quit', () => {
|
||||||
|
shutdownServer();
|
||||||
mainWindow?.close();
|
mainWindow?.close();
|
||||||
app.exit();
|
app.exit();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user