mirror of
https://github.com/open-webui/desktop
synced 2025-06-26 18:15:59 +00:00
refac
This commit is contained in:
parent
c5f5681f94
commit
37cdf72959
38
src/main.ts
38
src/main.ts
@ -104,36 +104,18 @@ if (!gotTheLock) {
|
||||
// Wait for the renderer to finish loading
|
||||
mainWindow.webContents.once('did-finish-load', async () => {
|
||||
console.log('Renderer finished loading');
|
||||
|
||||
// Check installation and start the server
|
||||
if (validateInstallation()) {
|
||||
try {
|
||||
SERVER_URL = await startServer();
|
||||
console.log('Server URL:', SERVER_URL);
|
||||
|
||||
// Send the server URL to the renderer
|
||||
mainWindow.webContents.send('main:data', {
|
||||
type: 'server:url',
|
||||
data: SERVER_URL
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to start server:', error);
|
||||
|
||||
// Send an error message if the server fails to start
|
||||
mainWindow.webContents.send('main:data', {
|
||||
type: 'server:error',
|
||||
data: 'Failed to start the server'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// No valid installation, send fallback info
|
||||
mainWindow.webContents.send('main:data', {
|
||||
type: 'server:url',
|
||||
data: null
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Check installation and start the server
|
||||
if (validateInstallation()) {
|
||||
try {
|
||||
SERVER_URL = await startServer();
|
||||
mainWindow.loadURL(SERVER_URL);
|
||||
} catch (error) {
|
||||
console.error('Failed to start server:', error);
|
||||
}
|
||||
}
|
||||
|
||||
globalShortcut.register('Alt+CommandOrControl+O', () => {
|
||||
mainWindow?.show();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user