Wake lock persistence, button reposition, docs, dev LAN support
Wake lock (Prevent Sleep) toggles now persist across reloads via localStorage in both AdminView and DisplayView. Buttons repositioned inline in AdminView campaigns header bar (was floating overlay causing overlap on tablets). DisplayView buttons persist localStorage too. Wake lock acquire failure now shows toast with fix hint (HTTPS or Chrome flag). Fullscreenchange listener re-acquires wake lock (Android discards on screen off). dev-start.sh: auto-detects LAN IP (en0/en1), frontend binds 0.0.0.0, backend URL inlined as LAN IP so phones reach backend. DANGEROUSLY_DISABLE_HOST_CHECK for LAN access. Outputs LAN URL + wake lock flag instructions. Docs: README 'Prevent Sleep (Wake Lock)' section covering secure context requirement, Android Chrome flag workaround for LAN testing, iOS Safari standalone PWA bug. DEVELOPMENT.md LAN access + wake lock note.
This commit is contained in:
@@ -307,6 +307,26 @@ ttrpg-initiative-tracker/
|
||||
* `docs/GLOSSARY.md` — domain terms (turn vs. round, etc.)
|
||||
* `TODO.md` — known bugs and backlog
|
||||
|
||||
## Prevent Sleep (Wake Lock)
|
||||
|
||||
DM and Player views have a Coffee/Moon toggle to keep screen awake during combat.
|
||||
|
||||
**Requires secure context** (HTTPS or localhost). The Screen Wake Lock API refuses
|
||||
on plain HTTP.
|
||||
|
||||
- **Prod (HTTPS):** works automatically on all devices.
|
||||
- **Local dev (localhost):** works automatically — localhost is a trusted origin.
|
||||
- **LAN IP (phones, plain HTTP):** wake lock fails silently. Two options:
|
||||
1. **Android Chrome flag (dev testing):** `chrome://flags/#unsafely-treat-insecure-origin-as-secure` → add full URL with port, e.g. `http://10.0.0.5:3999`. Enable flag, relaunch.
|
||||
2. **mkcert local CA:** generate trusted cert for LAN IP. Heavier setup.
|
||||
|
||||
**iOS Safari:** Wake Lock API broken in standalone PWA mode (iOS 16.4–18.4, WebKit bug 254545). Fixed in 18.4+. Works in browser tab (not installed PWA).
|
||||
|
||||
**Troubleshooting:** if toggle shows active but screen still sleeps, check:
|
||||
- Battery saver / power save mode (browser refuses)
|
||||
- Chrome devtools console for `WakeLockError`
|
||||
- Secure context: `window.isSecureContext` must be `true`
|
||||
|
||||
## Contributing
|
||||
|
||||
If you want to contribute, send me a message here: [https://discourse.draft13.com/c/ttrpg-initiative-tracker/16](https://discourse.draft13.com/c/ttrpg-initiative-tracker/16), and I can add to this Gitea instance and you can feel free to fork the repository and submit pull requests. For major changes, please pose a topic to the Discourse instance above linked above first to discuss what you would like to change.
|
||||
|
||||
Reference in New Issue
Block a user