@@ -3,6 +3,7 @@ import pkg from 'electron-updater'
33import path from 'path'
44import { existsSync , mkdirSync , copyFileSync , writeFileSync , appendFileSync } from 'fs'
55import { fileURLToPath } from 'url'
6+
67const { autoUpdater } = pkg
78
89const __filename = fileURLToPath ( import . meta. url )
@@ -179,10 +180,11 @@ async function waitForServer(url, timeout = 30000) {
179180 if ( response . ok || response . status === 404 ) {
180181 return true
181182 }
182- } catch {
183+ }
184+ catch {
183185 // Server not ready yet
184186 }
185- await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) )
187+ await new Promise ( resolve => setTimeout ( resolve , 500 ) )
186188 }
187189
188190 throw new Error ( `Server did not start within ${ timeout } ms` )
@@ -277,7 +279,8 @@ function createWindow() {
277279 if ( isWindows ) {
278280 windowOptions . titleBarStyle = 'hidden'
279281 windowOptions . titleBarOverlay = currentTheme . titleBarOverlay
280- } else {
282+ }
283+ else {
281284 // Linux/macOS: Hide menu bar for cleaner look
282285 windowOptions . autoHideMenuBar = true
283286 // Set window icon (Linux needs this explicitly, Windows/macOS use app bundle icon)
@@ -344,7 +347,8 @@ ipcMain.handle('export-database', async () => {
344347 try {
345348 copyFileSync ( paths . databasePath , result . filePath )
346349 return { success : true , filePath : result . filePath }
347- } catch ( error ) {
350+ }
351+ catch ( error ) {
348352 return { success : false , error : error . message }
349353 }
350354} )
@@ -361,7 +365,8 @@ ipcMain.handle('open-uploads-folder', async () => {
361365 try {
362366 await shell . openPath ( paths . uploadPath )
363367 return { success : true }
364- } catch ( error ) {
368+ }
369+ catch ( error ) {
365370 return { success : false , error : error . message }
366371 }
367372} )
@@ -378,7 +383,8 @@ ipcMain.handle('open-logs-folder', async () => {
378383 try {
379384 await shell . openPath ( paths . logsPath )
380385 return { success : true }
381- } catch ( error ) {
386+ }
387+ catch ( error ) {
382388 return { success : false , error : error . message }
383389 }
384390} )
@@ -388,7 +394,8 @@ ipcMain.handle('open-external-url', async (event, url) => {
388394 try {
389395 await shell . openExternal ( url )
390396 return { success : true }
391- } catch ( error ) {
397+ }
398+ catch ( error ) {
392399 return { success : false , error : error . message }
393400 }
394401} )
@@ -426,7 +433,8 @@ ipcMain.handle('check-for-updates', async () => {
426433 }
427434 }
428435 return { updateAvailable : false }
429- } catch ( error ) {
436+ }
437+ catch ( error ) {
430438 console . error ( '[AutoUpdater] Check failed:' , error . message )
431439 return { updateAvailable : false , error : error . message }
432440 }
@@ -441,7 +449,7 @@ ipcMain.handle('download-update', async () => {
441449 // Simulate progress events
442450 const simulateProgress = async ( ) => {
443451 for ( let percent = 0 ; percent <= 100 ; percent += 10 ) {
444- await new Promise ( ( resolve ) => setTimeout ( resolve , 300 ) )
452+ await new Promise ( resolve => setTimeout ( resolve , 300 ) )
445453 if ( mainWindow ) {
446454 mainWindow . webContents . send ( 'update-download-progress' , {
447455 percent,
@@ -464,7 +472,8 @@ ipcMain.handle('download-update', async () => {
464472 try {
465473 await autoUpdater . downloadUpdate ( )
466474 return { started : true }
467- } catch ( error ) {
475+ }
476+ catch ( error ) {
468477 console . error ( '[AutoUpdater] Download failed:' , error . message )
469478 return { started : false , error : error . message }
470479 }
@@ -558,7 +567,8 @@ ipcMain.handle('save-file-dialog', async (event, options) => {
558567 const buffer = Buffer . from ( fileData )
559568 writeFileSync ( result . filePath , buffer )
560569 return { success : true , filePath : result . filePath }
561- } catch ( error ) {
570+ }
571+ catch ( error ) {
562572 return { success : false , error : error . message }
563573 }
564574} )
@@ -582,7 +592,8 @@ function logToFile(message) {
582592 const logLine = `[${ timestamp } ] [FATAL] [Electron Main] ${ message } \n`
583593
584594 appendFileSync ( logFile , logLine , 'utf-8' )
585- } catch ( err ) {
595+ }
596+ catch ( err ) {
586597 console . error ( '[Electron] Failed to write to log file:' , err )
587598 }
588599}
@@ -604,7 +615,8 @@ app.whenReady().then(async () => {
604615 try {
605616 await startServer ( )
606617 createWindow ( )
607- } catch ( error ) {
618+ }
619+ catch ( error ) {
608620 console . error ( '[Electron] Failed to start:' , error )
609621 app . quit ( )
610622 }
0 commit comments