()
| 6982 | try { |
| 6983 | // Validate URL format |
| 6984 | if (!url.startsWith('http://') && !url.startsWith('https://')) { |
| 6985 | await window.electron.showMessage('Error', 'Please enter a valid URL starting with http:// or https://'); |
| 6986 | return; |
| 6987 | } |
| 6988 | |
| 6989 | await window.electron.openExternal(url); |
| 6990 | } catch (error) { |
| 6991 | console.error('Error opening URL:', error); |
| 6992 | await window.electron.showMessage('Error', 'Failed to open URL: ' + error.message); |
| 6993 | } |
| 6994 | }); |
| 6995 | |
| 6996 | |
| 6997 | // Add scan directory button event listener |
| 6998 | document.getElementById('scan-directory-button')?.addEventListener('click', async () => { |
| 6999 | if (isScanning) return; // Prevent multiple scans |
| 7000 | |
| 7001 | // First, check if there are any active filters and clear them |
| 7002 | const clearFilterButton = document.querySelector('.clear-filter-button'); |
| 7003 | if (clearFilterButton) { |
| 7004 | console.log('Clearing filters before directory scan'); |
| 7005 | clearFilterButton.click(); // Programmatically trigger the clear filters action |
| 7006 | // Wait a moment for the filter clearing to complete |
| 7007 | await new Promise(resolve => setTimeout(resolve, 100)); |
| 7008 | } |
| 7009 | |
| 7010 | // Check if we're in server mode |
| 7011 | const serverMode = await window.electron.isServerMode(); |
| 7012 | let directoryPath; |
| 7013 | |
| 7014 | if (serverMode) { |
no test coverage detected