From e68d11a7fcb8813fe12a13656a8de2129071208f Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Mon, 4 May 2026 15:46:17 +0000 Subject: [PATCH] fix(pwa): handle orientation.lock() promise rejection silently screen.orientation.lock() returns a Promise; the old try/catch only caught synchronous errors, leaving the rejection unhandled and triggering the auto-reporter (issue #8). Added .catch(()=>{}) to suppress it. Also fixed CI: add sleep+retry around gh release create to avoid 502 race condition after delete. Closes #8 --- .github/workflows/build-kiosk.yml | 18 ++++++++++++------ assets/js/app.js | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-kiosk.yml b/.github/workflows/build-kiosk.yml index 652bdea..54812c1 100644 --- a/.github/workflows/build-kiosk.yml +++ b/.github/workflows/build-kiosk.yml @@ -50,14 +50,20 @@ jobs: - name: Delete existing kiosk release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release delete kiosk-latest --yes || true + run: | + gh release delete kiosk-latest --yes || true + sleep 5 - name: Create GitHub Release and upload APK env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release create kiosk-latest \ - --title "EverShelf Kiosk v${{ steps.version.outputs.name }}" \ - --notes "Kiosk mode app with embedded BLE scale gateway. Install on your Android device (7.0+)." \ - --prerelease \ - artifacts/evershelf-kiosk.apk + for i in 1 2 3; do + gh release create kiosk-latest \ + --title "EverShelf Kiosk v${{ steps.version.outputs.name }}" \ + --notes "Kiosk mode app with embedded BLE scale gateway. Install on your Android device (7.0+)." \ + --prerelease \ + artifacts/evershelf-kiosk.apk && break + echo "Attempt $i failed, retrying in 10s..." + sleep 10 + done diff --git a/assets/js/app.js b/assets/js/app.js index e1f5610..2d0180b 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -10147,7 +10147,7 @@ function startCookingMode() { document.getElementById('cooking-tts-btn').textContent = '🔊'; document.getElementById('cooking-overlay').style.display = 'flex'; document.body.classList.add('cooking-mode-active'); - try { screen.orientation?.lock('portrait'); } catch (_) { /* ignore */ } + try { screen.orientation?.lock('portrait').catch(() => {}); } catch (_) { /* ignore */ } renderCookingStep(); if (_cookingTTS) { const text = ((_cookingRecipe.steps || [])[_cookingStep] || '').replace(/^Passo\s*\d+\s*[:.]\s*/i, ''); @@ -10159,7 +10159,7 @@ function closeCookingMode() { document.body.classList.remove('cooking-mode-active'); // NOTE: intentionally keep _cookingRecipe, _cookingStep, _cookingVisited // so the user can resume from the same step when they reopen - try { screen.orientation?.unlock(); } catch (_) { /* ignore */ } + try { screen.orientation?.unlock().catch(() => {}); } catch (_) { /* ignore */ } } function restartCookingMode() {