This commit is contained in:
Timothy Jaeryang Baek 2025-01-14 00:42:05 -08:00
parent 1a9c2ac192
commit 347ff2aa18
3 changed files with 31 additions and 28 deletions

View File

@ -99,34 +99,34 @@ if (!gotTheLock) {
...(SERVER_STATUS === 'started' ...(SERVER_STATUS === 'started'
? [ ? [
{ {
label: 'Stop Server', label: 'Stop Server',
click: async () => { click: async () => {
await stopAllServers(); await stopAllServers();
SERVER_STATUS = 'stopped'; SERVER_STATUS = 'stopped';
mainWindow.webContents.send('main:data', { mainWindow.webContents.send('main:data', {
type: 'server:status', type: 'server:status',
data: SERVER_STATUS data: SERVER_STATUS
}); });
updateTrayMenu('Open WebUI: Stopped', null); // Update tray menu with stopped status updateTrayMenu('Open WebUI: Stopped', null); // Update tray menu with stopped status
}
} }
] }
]
: SERVER_STATUS === 'starting' : SERVER_STATUS === 'starting'
? [ ? [
{ {
label: 'Starting Server...', label: 'Starting Server...',
enabled: false enabled: false
} }
] ]
: [ : [
{ {
label: 'Start Server', label: 'Start Server',
click: async () => { click: async () => {
await startServerHandler(); await startServerHandler();
}
} }
]), }
]),
{ {
type: 'separator' type: 'separator'
@ -197,6 +197,8 @@ if (!gotTheLock) {
} }
}; };
const onReady = async () => { const onReady = async () => {
console.log(process.resourcesPath); console.log(process.resourcesPath);
console.log(app.getName()); console.log(app.getName());
@ -405,14 +407,15 @@ if (!gotTheLock) {
notification.show(); notification.show();
}); });
app.on('before-quit', () => { app.on('before-quit', async () => {
app.isQuiting = true; // Ensure quit flag is set app.isQuiting = true; // Ensure quit flag is set
stopAllServers(); await stopAllServers();
}); });
// Quit when all windows are closed, except on macOS // Quit when all windows are closed, except on macOS
app.on('window-all-closed', () => { app.on('window-all-closed', async () => {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
await stopAllServers()
app.isQuitting = true; app.isQuitting = true;
app.quit(); app.quit();
} }

View File

@ -81,7 +81,7 @@
<div class="w-full h-full absolute top-0 left-0 backdrop-blur-sm bg-black/50"></div> <div class="w-full h-full absolute top-0 left-0 backdrop-blur-sm bg-black/50"></div>
<div class=" absolute w-full top-0 left-0 right-0 z-10"> <div class=" absolute w-full top-0 left-0 right-0 z-10">
<div class="h-10 drag-region"></div> <div class="h-6 drag-region"></div>
</div> </div>
<div class="flex-1 w-full flex justify-center relative"> <div class="flex-1 w-full flex justify-center relative">

View File

@ -423,7 +423,7 @@ export async function startServer(installationPath?: string, port?: number): Pro
const childProcess = spawn(startCommand, { const childProcess = spawn(startCommand, {
shell: true, shell: true,
detached: false, detached: false,
stdio: ['ignore', 'pipe'], // Let us capture logs via stdout/stderr stdio: ['ignore', 'pipe', 'pipe'], // Let us capture logs via stdout/stderr
windowsHide: true windowsHide: true
}); });