From 6a96de4073e3fba603dc52c69e2d19decc60badd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Nov 2025 12:59:22 +0000 Subject: [PATCH 1/2] Fix: Resolve BrowserView attachment error on password unlock Fixes JavaScript error "given browserview is not attached to the window" that occurred when unlocking the screen after boot with password protection. Changes to unlockScreen() function: - Add try-catch around hidden view restoration to prevent crashes - Ensure view is attached with addBrowserView() before setTopBrowserView() - Add fallback to regular views if hidden view restoration fails - Validate currentIndex is within bounds before using it - Check views.length>0 before attempting to attach views This ensures safe view restoration in all unlock scenarios, particularly when unlocking immediately after boot with password protection enabled. --- install_kiosk_0.9.5-10.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/install_kiosk_0.9.5-10.sh b/install_kiosk_0.9.5-10.sh index 63acaa2..e2852ab 100644 --- a/install_kiosk_0.9.5-10.sh +++ b/install_kiosk_0.9.5-10.sh @@ -4040,12 +4040,26 @@ function unlockScreen(){ } // Restore current view using proper method + // For boot unlock, always use attachView for regular views (safe path) if(showingHidden&&hiddenViews[currentHiddenIndex]){ - const[w,h]=mainWindow.getContentSize(); - mainWindow.setTopBrowserView(hiddenViews[currentHiddenIndex]); - hiddenViews[currentHiddenIndex].setBounds({x:0,y:0,width:w,height:h}); - }else if(views[currentIndex]){ - attachView(currentIndex); + try{ + const[w,h]=mainWindow.getContentSize(); + // Ensure view is added to window before setting as top + mainWindow.addBrowserView(hiddenViews[currentHiddenIndex]); + mainWindow.setTopBrowserView(hiddenViews[currentHiddenIndex]); + hiddenViews[currentHiddenIndex].setBounds({x:0,y:0,width:w,height:h}); + }catch(e){ + console.error('[LOCKOUT] Error restoring hidden view:',e); + // Fallback to regular views + if(views.length>0){ + showingHidden=false; + attachView(0); + } + } + }else if(views.length>0){ + // Use valid index or default to 0 + const idx=(currentIndex>=0&¤tIndex Date: Sat, 22 Nov 2025 15:42:06 +0000 Subject: [PATCH 2/2] Fix: Accept uppercase Y in installation prompt The installation prompt was only accepting lowercase 'y', causing the script to exit when users entered uppercase 'Y'. This fix aligns the prompt behavior with all other y/n prompts in the script by using case-insensitive pattern matching (=~ ^[Yy]$). Fixes issue where installation would bail after selecting Y to proceed. --- install_kiosk_0.9.5-10.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_kiosk_0.9.5-10.sh b/install_kiosk_0.9.5-10.sh index e2852ab..d0e77d4 100644 --- a/install_kiosk_0.9.5-10.sh +++ b/install_kiosk_0.9.5-10.sh @@ -3699,7 +3699,7 @@ first_time_install() { echo " • Onboard touchscreen keyboard" echo read -r -p "Proceed with installation? (y/n): " proceed - [[ "$proceed" != "y" ]] && exit 0 + [[ ! "$proceed" =~ ^[Yy]$ ]] && exit 0 echo echo "[1/27] Installing packages..."