From a7894ede515b498deac003942646383d0effc09a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 01:29:27 +0000 Subject: [PATCH] v1.0.1-beta: replace nodeIntegration/contextIsolation:false with contextBridge preload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All 6 popup BrowserWindows (lockout, prompt, pause, pin, keyboard ×2) now use contextIsolation:true + popup-preload.js instead of the deprecated nodeIntegration:true pattern. A new popup-preload.js file exposes crypto.hashPassword, fs.readPin, ipcRenderer.send/on/once to the renderer via contextBridge. All affected HTML files updated to use window.electronAPI.* instead of direct require('electron') calls. The popup-preload.js heredoc is also added to the upgrade extract_file list so upgrades re-extract it correctly. https://claude.ai/code/session_01M3tiofbGfmTddeMcXr8nXr --- ubuntu-based-kiosk-v1.0.1-beta.sh | 154 ++++++++++++++++-------------- 1 file changed, 80 insertions(+), 74 deletions(-) diff --git a/ubuntu-based-kiosk-v1.0.1-beta.sh b/ubuntu-based-kiosk-v1.0.1-beta.sh index 31de316..4a5cc8f 100644 --- a/ubuntu-based-kiosk-v1.0.1-beta.sh +++ b/ubuntu-based-kiosk-v1.0.1-beta.sh @@ -4204,8 +4204,8 @@ function showLockoutScreen(){ frame:false, backgroundColor:'#000000', webPreferences:{ - nodeIntegration:true, - contextIsolation:false + contextIsolation:true, + preload:path.join(__dirname,'popup-preload.js') } }); @@ -4262,20 +4262,17 @@ function showLockoutScreen(){
Incorrect password
@@ -5991,13 +5987,12 @@ sudo -u "$KIOSK_USER" tee "$KIOSK_DIR/pause-dialog.html" > /dev/null <<'PAUSEHTM KBHTML - + sudo chown "$KIOSK_USER:$KIOSK_USER" "$KIOSK_DIR/keyboard.html" log_success "keyboard.html created" @@ -8960,15 +8965,15 @@ function showHTMLKeyboard(){ frame:false, alwaysOnTop:true, skipTaskbar:true, - webPreferences:{nodeIntegration:true,contextIsolation:false} + webPreferences:{contextIsolation:true,preload:path.join(__dirname,'popup-preload.js')} }); - + htmlKeyboardWindow.loadFile(path.join(__dirname,'keyboard.html')); - + htmlKeyboardWindow.on('closed',()=>{ htmlKeyboardWindow=null; }); - + // Focus first input field after keyboard shows setTimeout(()=>{ let view=null; @@ -10845,6 +10850,7 @@ upgrade_kiosk() { # Extract all files using their unique heredoc markers extract_file 'tee.*main\.js.*MAINJS' 'MAINJS' "$KIOSK_DIR/main.js" extract_file 'tee.*preload\.js.*PRELOAD' 'PRELOAD' "$KIOSK_DIR/preload.js" + extract_file 'tee.*popup-preload\.js.*POPUPPRELOAD' 'POPUPPRELOAD' "$KIOSK_DIR/popup-preload.js" extract_file 'tee.*keyboard\.html.*KBHTML' 'KBHTML' "$KIOSK_DIR/keyboard.html" extract_file 'tee.*pause-dialog\.html.*PAUSEHTML' 'PAUSEHTML' "$KIOSK_DIR/pause-dialog.html" extract_file 'tee.*pin-entry\.html.*PINHTML' 'PINHTML' "$KIOSK_DIR/pin-entry.html"