mirror of
https://github.com/open-webui/desktop
synced 2025-06-26 18:15:59 +00:00
refac
This commit is contained in:
parent
1a9c2ac192
commit
347ff2aa18
55
src/main.ts
55
src/main.ts
@ -99,34 +99,34 @@ if (!gotTheLock) {
|
||||
|
||||
...(SERVER_STATUS === 'started'
|
||||
? [
|
||||
{
|
||||
label: 'Stop Server',
|
||||
click: async () => {
|
||||
await stopAllServers();
|
||||
SERVER_STATUS = 'stopped';
|
||||
mainWindow.webContents.send('main:data', {
|
||||
type: 'server:status',
|
||||
data: SERVER_STATUS
|
||||
});
|
||||
updateTrayMenu('Open WebUI: Stopped', null); // Update tray menu with stopped status
|
||||
}
|
||||
{
|
||||
label: 'Stop Server',
|
||||
click: async () => {
|
||||
await stopAllServers();
|
||||
SERVER_STATUS = 'stopped';
|
||||
mainWindow.webContents.send('main:data', {
|
||||
type: 'server:status',
|
||||
data: SERVER_STATUS
|
||||
});
|
||||
updateTrayMenu('Open WebUI: Stopped', null); // Update tray menu with stopped status
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
: SERVER_STATUS === 'starting'
|
||||
? [
|
||||
{
|
||||
label: 'Starting Server...',
|
||||
enabled: false
|
||||
}
|
||||
]
|
||||
{
|
||||
label: 'Starting Server...',
|
||||
enabled: false
|
||||
}
|
||||
]
|
||||
: [
|
||||
{
|
||||
label: 'Start Server',
|
||||
click: async () => {
|
||||
await startServerHandler();
|
||||
}
|
||||
{
|
||||
label: 'Start Server',
|
||||
click: async () => {
|
||||
await startServerHandler();
|
||||
}
|
||||
]),
|
||||
}
|
||||
]),
|
||||
|
||||
{
|
||||
type: 'separator'
|
||||
@ -197,6 +197,8 @@ if (!gotTheLock) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
const onReady = async () => {
|
||||
console.log(process.resourcesPath);
|
||||
console.log(app.getName());
|
||||
@ -405,14 +407,15 @@ if (!gotTheLock) {
|
||||
notification.show();
|
||||
});
|
||||
|
||||
app.on('before-quit', () => {
|
||||
app.on('before-quit', async () => {
|
||||
app.isQuiting = true; // Ensure quit flag is set
|
||||
stopAllServers();
|
||||
await stopAllServers();
|
||||
});
|
||||
|
||||
// Quit when all windows are closed, except on macOS
|
||||
app.on('window-all-closed', () => {
|
||||
app.on('window-all-closed', async () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
await stopAllServers()
|
||||
app.isQuitting = true;
|
||||
app.quit();
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
<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="h-10 drag-region"></div>
|
||||
<div class="h-6 drag-region"></div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 w-full flex justify-center relative">
|
||||
|
||||
@ -423,7 +423,7 @@ export async function startServer(installationPath?: string, port?: number): Pro
|
||||
const childProcess = spawn(startCommand, {
|
||||
shell: true,
|
||||
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
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user