Add diagnostic script and manual fix guide for pause button issues
- diagnose_pause_button.sh: Checks actual kiosk installation for correct fixes - MANUAL_FIX_pause_button.txt: Step-by-step manual patching guide Helps troubleshoot when pause button doesn't appear on rotation sites
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
################################################################################
|
||||
# MANUAL FIX FOR PAUSE BUTTON ISSUES
|
||||
# Use this if the automated update didn't work
|
||||
################################################################################
|
||||
|
||||
ISSUE: Pause button not appearing on rotation sites
|
||||
|
||||
CAUSE: The pause button code might not be properly set up
|
||||
|
||||
SOLUTION: Manually verify/fix these sections in your kiosk files
|
||||
|
||||
================================================================================
|
||||
FIX 1: In main.js - Find the attachView function
|
||||
================================================================================
|
||||
|
||||
SEARCH FOR (around line 3735):
|
||||
// Control pause button visibility based on site duration
|
||||
|
||||
REPLACE THE NEXT 3-4 LINES WITH:
|
||||
// Control pause button visibility based on site duration
|
||||
// Show on rotation sites (duration > 0), hide on manual sites (duration = 0)
|
||||
const siteDuration=parseInt(tabs[tabIdx].duration)||0;
|
||||
const shouldShow=siteDuration>0;
|
||||
console.log('[MAIN] Sending pause-button-visibility to tab '+tabIdx+' ('+tabs[tabIdx].url+') - duration='+siteDuration+'s, shouldShow='+shouldShow);
|
||||
views[i].webContents.send('pause-button-visibility',shouldShow);
|
||||
|
||||
VERIFY: shouldShow=siteDuration>0 (NOT ===0 and NOT !==0)
|
||||
|
||||
================================================================================
|
||||
FIX 2: In preload.js - Add pause button hide timer variables
|
||||
================================================================================
|
||||
|
||||
SEARCH FOR (around line 5151):
|
||||
let pauseButton=null;
|
||||
let pauseButtonShouldShow=false;
|
||||
let pauseButtonShown=false;
|
||||
|
||||
MAKE SURE IT INCLUDES THESE TWO LINES:
|
||||
let pauseButtonHideTimer=null;
|
||||
const PAUSE_BUTTON_HIDE_DELAY=5000; // Hide after 5 seconds of inactivity
|
||||
|
||||
================================================================================
|
||||
FIX 3: In preload.js - Update showPauseButton function
|
||||
================================================================================
|
||||
|
||||
SEARCH FOR:
|
||||
function showPauseButton(){
|
||||
|
||||
REPLACE ENTIRE FUNCTION WITH:
|
||||
function showPauseButton(){
|
||||
if(!pauseButton)createPauseButton();
|
||||
pauseButton.style.display='flex';
|
||||
pauseButtonShown=true;
|
||||
|
||||
// Clear existing hide timer
|
||||
if(pauseButtonHideTimer){
|
||||
clearTimeout(pauseButtonHideTimer);
|
||||
pauseButtonHideTimer=null;
|
||||
}
|
||||
|
||||
// Set new hide timer - button will auto-hide after inactivity
|
||||
pauseButtonHideTimer=setTimeout(()=>{
|
||||
console.log('[PAUSE-BTN] Auto-hiding after '+PAUSE_BUTTON_HIDE_DELAY+'ms inactivity');
|
||||
hidePauseButton();
|
||||
},PAUSE_BUTTON_HIDE_DELAY);
|
||||
}
|
||||
|
||||
================================================================================
|
||||
FIX 4: In preload.js - Update hidePauseButton function
|
||||
================================================================================
|
||||
|
||||
SEARCH FOR:
|
||||
function hidePauseButton(){
|
||||
|
||||
REPLACE ENTIRE FUNCTION WITH:
|
||||
function hidePauseButton(){
|
||||
if(pauseButtonHideTimer){
|
||||
clearTimeout(pauseButtonHideTimer);
|
||||
pauseButtonHideTimer=null;
|
||||
}
|
||||
if(pauseButton){
|
||||
pauseButton.style.display='none';
|
||||
pauseButtonShown=false;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
FIX 5: In preload.js - Update handleUserInteraction function
|
||||
================================================================================
|
||||
|
||||
SEARCH FOR:
|
||||
function handleUserInteraction
|
||||
|
||||
REPLACE WITH THIS VERSION (note the eventType parameter):
|
||||
function handleUserInteraction(eventType){
|
||||
const now=Date.now();
|
||||
if(now-lastUserInteraction<USER_INTERACTION_THROTTLE)return;
|
||||
lastUserInteraction=now;
|
||||
|
||||
console.log('[PAUSE-BTN] User interaction ('+eventType+') - shouldShow='+pauseButtonShouldShow+', shown='+pauseButtonShown);
|
||||
// Show/refresh pause button if allowed on this site
|
||||
if(pauseButtonShouldShow){
|
||||
if(!pauseButtonShown){
|
||||
console.log('[PAUSE-BTN] Showing pause button now');
|
||||
}else{
|
||||
console.log('[PAUSE-BTN] Resetting auto-hide timer');
|
||||
}
|
||||
showPauseButton(); // This will reset the hide timer
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
FIX 6: In preload.js - Update event listener registration
|
||||
================================================================================
|
||||
|
||||
SEARCH FOR:
|
||||
const pauseButtonTriggers=['mousedown','touchstart','keydown'];
|
||||
pauseButtonTriggers.forEach(eventType=>{
|
||||
document.addEventListener(eventType,handleUserInteraction,{passive:true,capture:true});
|
||||
});
|
||||
|
||||
REPLACE WITH (note the arrow function that passes eventType):
|
||||
const pauseButtonTriggers=['mousedown','touchstart','keydown'];
|
||||
pauseButtonTriggers.forEach(eventType=>{
|
||||
document.addEventListener(eventType,()=>handleUserInteraction(eventType),{passive:true,capture:true});
|
||||
});
|
||||
|
||||
================================================================================
|
||||
AFTER MAKING CHANGES:
|
||||
================================================================================
|
||||
|
||||
1. Save all files
|
||||
2. Restart kiosk: sudo systemctl restart kiosk
|
||||
3. Open DevTools console (if enabled) or check logs
|
||||
4. Look for these messages:
|
||||
- [MAIN] Sending pause-button-visibility to tab X - duration=15s, shouldShow=true
|
||||
- [PAUSE-BTN] Visibility update: shouldShow=true
|
||||
- [PAUSE-BTN] User interaction (mousedown) - shouldShow=true, shown=false
|
||||
- [PAUSE-BTN] Showing pause button now
|
||||
|
||||
5. On rotation sites (15s duration), click/touch the screen
|
||||
6. Pause button should appear and auto-hide after 5 seconds
|
||||
7. On manual sites (0 duration), pause button should NOT appear
|
||||
|
||||
================================================================================
|
||||
SIMPLER ALTERNATIVE: Full Reinstall
|
||||
================================================================================
|
||||
|
||||
If manual editing is too complex, run:
|
||||
|
||||
cd /home/user/ubk
|
||||
bash install_kiosk_0.9.2.sh
|
||||
|
||||
And choose "Full Reinstall" from the Core Settings menu.
|
||||
This will apply all fixes automatically.
|
||||
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
# Pause Button Diagnostic Script
|
||||
# Checks the actual state of pause button code in installed kiosk
|
||||
################################################################################
|
||||
|
||||
echo "===================================="
|
||||
echo " Pause Button Diagnostic Tool"
|
||||
echo "===================================="
|
||||
echo ""
|
||||
|
||||
# Find kiosk directory
|
||||
KIOSK_DIR=""
|
||||
if [ -f "/home/kiosk/kiosk-app/main.js" ]; then
|
||||
KIOSK_DIR="/home/kiosk/kiosk-app"
|
||||
elif systemctl show -p WorkingDirectory kiosk.service 2>/dev/null | grep -q "/"; then
|
||||
KIOSK_DIR=$(systemctl show -p WorkingDirectory kiosk.service 2>/dev/null | cut -d= -f2)
|
||||
fi
|
||||
|
||||
if [ -z "$KIOSK_DIR" ] || [ ! -f "$KIOSK_DIR/main.js" ]; then
|
||||
echo "✗ Cannot find kiosk installation"
|
||||
echo " Please run this on the kiosk machine"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found kiosk at: $KIOSK_DIR"
|
||||
echo ""
|
||||
|
||||
echo "=== CHECK 1: Pause button visibility logic in main.js ==="
|
||||
echo ""
|
||||
grep -A 2 "pause-button-visibility" "$KIOSK_DIR/main.js" | head -5
|
||||
echo ""
|
||||
|
||||
echo "=== CHECK 2: Duration check logic ==="
|
||||
echo ""
|
||||
grep -B 1 -A 1 "siteDuration>0\|siteDuration!==0\|siteDuration===0" "$KIOSK_DIR/main.js" | head -10
|
||||
echo ""
|
||||
|
||||
echo "=== CHECK 3: Pause button auto-hide in preload.js ==="
|
||||
echo ""
|
||||
if grep -q "PAUSE_BUTTON_HIDE_DELAY" "$KIOSK_DIR/preload.js"; then
|
||||
echo "✓ Auto-hide timer found"
|
||||
grep "PAUSE_BUTTON_HIDE_DELAY" "$KIOSK_DIR/preload.js"
|
||||
else
|
||||
echo "✗ Auto-hide timer NOT found"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "=== CHECK 4: Return-to-home logic ==="
|
||||
echo ""
|
||||
grep -A 3 "ONLY show inactivity prompt\|Don't show inactivity prompt" "$KIOSK_DIR/main.js" | head -8
|
||||
echo ""
|
||||
|
||||
echo "=== CHECK 5: User interaction handler ==="
|
||||
echo ""
|
||||
if grep -q "function handleUserInteraction(eventType)" "$KIOSK_DIR/preload.js"; then
|
||||
echo "✓ Event type parameter found"
|
||||
else
|
||||
echo "✗ Event type parameter NOT found - might be broken"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "===================================="
|
||||
echo "RECOMMENDATIONS:"
|
||||
echo "===================================="
|
||||
echo ""
|
||||
|
||||
# Check each issue
|
||||
NEEDS_FIX=0
|
||||
|
||||
if ! grep -q "siteDuration>0" "$KIOSK_DIR/main.js"; then
|
||||
echo "⚠ Pause button visibility logic needs update"
|
||||
echo " Current: Should check siteDuration>0"
|
||||
NEEDS_FIX=1
|
||||
fi
|
||||
|
||||
if ! grep -q "PAUSE_BUTTON_HIDE_DELAY" "$KIOSK_DIR/preload.js"; then
|
||||
echo "⚠ Pause button auto-hide not implemented"
|
||||
NEEDS_FIX=1
|
||||
fi
|
||||
|
||||
if ! grep -q "Rotation site - skip return-to-home" "$KIOSK_DIR/main.js"; then
|
||||
echo "⚠ Return-to-home logic needs update"
|
||||
NEEDS_FIX=1
|
||||
fi
|
||||
|
||||
if [ $NEEDS_FIX -eq 1 ]; then
|
||||
echo ""
|
||||
echo ">> Run a full reinstall with install_kiosk_0.9.2.sh"
|
||||
echo " The update script may not have applied correctly"
|
||||
else
|
||||
echo "✓ All fixes appear to be in place!"
|
||||
echo ""
|
||||
echo "If pause button still not showing:"
|
||||
echo " 1. Open Electron DevTools (if available)"
|
||||
echo " 2. Check console for [MAIN] and [PAUSE-BTN] messages"
|
||||
echo " 3. Verify site duration is > 0 for rotation sites"
|
||||
echo " 4. Try clicking/touching the screen on a rotation site"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
Reference in New Issue
Block a user