Repository navigation
Insights (privacy-safe usage counts and problem reports) + fix the iPhone freeze when launching Bit - #40
Merged
Conversation
…rts with steps, stats page Not finished: stats.html not yet in the deploy script, Privacy Policy not updated, not tested or deployed (needs STATS_TOKEN on the server). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Freeze detection ignores the pause while the tab is hidden. - stats.html shows kind, steps and screen for each problem, plus freeze and report totals. - Deploy script uploads stats.html (and keeps it out of robots); compose passes STATS_TOKEN. - Privacy Policy: new section on anonymous counts and problem reports (online edition). - Smoke test: a visit and a problem report reach the dev server, /api/stats needs the key, and the free edition keeps insights off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iOS Safari has no Pointer Lock API, so document.exitPointerLock() is undefined there. openRobotPanel() called it bare from inside the frame loop: the TypeError stopped frame() before it asked for the next frame, so the whole game froze and Bit stayed at "Running... step 0". Trading with a villager and fainting in survival had the same bare call inside the loop. - exitLock() guards every call. - frame() asks for the next frame first, so one error can't stop the game. - Smoke test: no bare exitPointerLock() calls in src/. - sw.js -> v29. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our own privacy-safe bug tracking and usage counts for the online edition (instead of Sentry or any third-party tracker). The free GitHub Pages edition sends nothing.
What it does
Daily counts, not people:
POST /api/eventsadds 1 to day counters such as visits by device/OS/browser family, game version, mode, and features used (Play Together, Bit, Photo Mode, courses, quests, circuits, accounts…). Each is counted at most once per browser session.Problem reports:
POST /api/errorskeeps three kinds:error: uncaught errors and unhandled promise rejections;freeze: the game stopped drawing for more than 5 s while on screen (hidden-tab pauses are ignored);report: the new 🐞 Report a problem menu button, with a fixed list of categories (no typing).Each keeps the message, place, game version, browser/device family, screen size and the last 12 game steps (e.g.
opened Bit's panel → Bit run). Identical reports are grouped per day and deleted after 90 days.Stats page:
stats.html(noindex, kept out ofrobots.txt) asks for the key and shows totals, devices, systems, browsers, modes, features, versions, visits per day and the problem list with steps.Privacy
GET /api/statsneedsAuthorization: Bearer $STATS_TOKEN. Without the token it's closed.site-config.jsonhas"online": trueand"insights": true. The copy in Git doesn't, so GitHub Pages never sends anything.TERMS_VERSIONis untouched.Also: fix the iPhone freeze when launching Bit
Cause: iOS Safari has no Pointer Lock API, so
document.exitPointerLockis undefined there.openRobotPanel()called it bare from inside the frame loop. The TypeError stoppedframe()before it asked for the next frame, so the whole game froze and Bit sat at "Running… step 0". Trading with a villager and fainting in survival had the same bare call inside the loop.Fix:
exitLock()guards every call.frame()now asks for the next frame first, so one error can never stop the game.exitPointerLock()insrc/.sw.js→minicrafter-v29.Reproduced and verified with Playwright WebKit, iPhone 13 (landscape) emulation and
?touch=1against the dev server: place Bit, tap it, tap ▶ Run. Before the fix: the TypeError above and the game stuck at step 0. After it: Bit runs all 16 steps to "All done!".Other changes
tools/deploy-site.shuploadsstats.htmland the"insights": trueconfig.server/docker-compose.ymlpassesSTATS_TOKEN;server/Dockerfilecopiesstats.mjs;server/README.mddocuments insights.Testing
SMOKE_CHANNEL=chrome node tests/smoke.mjs: all checks pass, including the new ones:/api/statsrefuses access without the key;node server/dev.mjs: visit counts, a thrown error, a forced 6 s freeze and a "Bit isn't working" report all showed up with steps onstats.html(keydev). The free copy made no/apirequests./api/eventsreturns 204 (403 from another origin),/api/statsreturns 401 without the key and 200 with it, and a real visit landed in the counters.🤖 Generated with Claude Code