Compare commits

...

3 Commits

Author SHA1 Message Date
Timothy Jaeryang Baek 238cce6dc8 refac 2025-07-29 14:31:03 +04:00
Timothy Jaeryang Baek b255f22fe7 refac 2025-07-29 14:30:09 +04:00
Timothy Jaeryang Baek d205c176ef refac 2025-07-29 14:19:48 +04:00
2 changed files with 28 additions and 5 deletions
+25 -4
View File
@@ -129,8 +129,7 @@ function createWindow(show = true): void {
{
label: "Reset",
click: async () => {
await stopServerHandler();
await resetApp();
await resetAppHandler();
},
},
],
@@ -359,6 +358,29 @@ const stopServerHandler = async () => {
}
};
const resetAppHandler = async () => {
try {
await stopServerHandler(); // Stop the server if running
SERVER_STATUS = null;
await resetApp(); // Reset the application state
// Show success notification
const notification = new Notification({
title: "Open WebUI",
body: "Application has been reset successfully.",
});
notification.show();
} catch (error) {
log.error("Failed to reset application:", error);
// Show error notification
const notification = new Notification({
title: "Open WebUI",
body: `Failed to reset application: ${error.message}`,
});
notification.show();
}
};
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit(); // Quit if another instance is already running
@@ -496,8 +518,7 @@ if (!gotTheLock) {
});
ipcMain.handle("app:reset", async (event) => {
await stopServerHandler();
return await resetApp();
return await resetAppHandler();
});
ipcMain.handle("get:config", async (event) => {
@@ -49,10 +49,12 @@
(await window.electronAPI.getPythonStatus()) &&
(await window.electronAPI.getPackageStatus())
) {
// Notify the user that the installation is complete
// Start the server if it's not already running
if (!(await window.electronAPI.getServerStatus())) {
await window.electronAPI.startServer();
}
// Notify the user that the installation is complete
await window.electronAPI.notification(
"Installation Complete",
"Open WebUI is now ready to use."