(scanDirectoryPath, window = null)
| 2582 | await shell.openExternal('https://discord.gg/JXcZHT77ua'); |
| 2583 | } |
| 2584 | }, |
| 2585 | { |
| 2586 | label: 'Patreon', |
| 2587 | click: async () => { |
| 2588 | await shell.openExternal('https://patreon.com/Printventory'); |
| 2589 | } |
| 2590 | }, |
| 2591 | { |
| 2592 | label: 'Support Printventory', |
| 2593 | click: async () => { |
| 2594 | await shell.openExternal('https://printventory.com/support.html'); |
| 2595 | } |
| 2596 | }, |
| 2597 | { |
| 2598 | label: 'GitHub', |
| 2599 | click: async () => { |
| 2600 | await shell.openExternal('https://github.com/TechJeeper/Printventory'); |
| 2601 | } |
| 2602 | }, |
| 2603 | { type: 'separator' }, |
| 2604 | { |
| 2605 | label: 'Library Stats', |
| 2606 | click: () => { |
| 2607 | mainWindow.webContents.send('open-stats'); |
| 2608 | } |
| 2609 | }, |
| 2610 | ...(isServerMode ? [{ |
| 2611 | label: 'System Report', |
| 2612 | click: () => { |
| 2613 | mainWindow.webContents.send('open-system-report'); |
| 2614 | } |
| 2615 | }] : []), |
| 2616 | { |
| 2617 | label: 'Server Mode Info', |
| 2618 | click: async () => { |
| 2619 | await shell.openExternal('https://github.com/TechJeeper/Printventory?tab=readme-ov-file#server-mode'); |
| 2620 | } |
| 2621 | }, |
| 2622 | { |
| 2623 | label: 'Debug Console', |
| 2624 | click: () => mainWindow.webContents.openDevTools() |
| 2625 | } |
| 2626 | ] |
| 2627 | } |
| 2628 | ]; |
| 2629 | |
| 2630 | const menu = Menu.buildFromTemplate(template); |
| 2631 | Menu.setApplicationMenu(menu); |
| 2632 | |
| 2633 | // Register before loadURL — localhost static server can finish before await returns, |
| 2634 | // so attaching ready-to-show after loadURL misses the event and the window stays hidden. |
| 2635 | let mainWindowShown = false; |
| 2636 | const showMainWindowWhenReady = () => { |
| 2637 | if (mainWindowShown || !mainWindow || mainWindow.isDestroyed()) return; |
| 2638 | mainWindowShown = true; |
| 2639 | mainWindow.show(); |
| 2640 | }; |
| 2641 | mainWindow.once('ready-to-show', showMainWindowWhenReady); |
no test coverage detected