Implement URL filtering in Electron navigation handlers
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Added checks in the Electron context to prevent navigation to '/favicon.ico', improving the handling of unwanted requests. - Enhanced logging for navigation events to provide better visibility into the navigation process.
This commit is contained in:
parent
643dc46402
commit
6b9e4bff63
@ -132,6 +132,9 @@ const ElectronProvider = ({ children }) => {
|
|||||||
applyWindowState
|
applyWindowState
|
||||||
)
|
)
|
||||||
const unsubNavigate = desktopBridge.onMessage('navigate', (url) => {
|
const unsubNavigate = desktopBridge.onMessage('navigate', (url) => {
|
||||||
|
if (url.toLowerCase() == '/favicon.ico') {
|
||||||
|
return
|
||||||
|
}
|
||||||
console.log('[ElectronContext] Navigating to:', url)
|
console.log('[ElectronContext] Navigating to:', url)
|
||||||
navigate(url)
|
navigate(url)
|
||||||
})
|
})
|
||||||
@ -166,6 +169,10 @@ const ElectronProvider = ({ children }) => {
|
|||||||
ipcRenderer.on('window-state', windowStateHandler)
|
ipcRenderer.on('window-state', windowStateHandler)
|
||||||
|
|
||||||
const navigateHandler = (_event, url) => {
|
const navigateHandler = (_event, url) => {
|
||||||
|
if (url.toLowerCase() == '/favicon.ico') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('[ElectronContext] Navigating to:', url)
|
||||||
navigate(url)
|
navigate(url)
|
||||||
}
|
}
|
||||||
ipcRenderer.on('navigate', navigateHandler)
|
ipcRenderer.on('navigate', navigateHandler)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user