Kiosk mode: function with no connection
The kiosk mode should function when there is no connection.
- When online, function as normal
- Locally store cache of app/UI
- Locally store cache of users and products
- Locally store uncommitted transaction until back online
When connection is lost, a user should still be able to:
- Use the kiosk interface
- Search products (basic)
- Search users (basic)
- Place oders
To prevent duplicate transactions, we may assign an unique ID to each uncommitted transaction to identify them.
## Tasks
- [x] Basic workbox offline configuration
- [x] Set up basic cache routes for kiosk network requests
- [x] Update cache limits
- [x] Make `/` redirect to `/kiosk`
- [x] ~~Make other unknown requests route to `/kiosk`~~ (not possible right now)
- [x] Warm cache for common URLs (`/`, `/kiosk`)
- [x] Warm cache for all users/products
- [x] On search, fall back to all user/product cache
- [x] How are buy requests cached?
- [x] Show buy request queue counter?
- [x] Separate service worker for kiosk mode
- [x] Show nice offline banner in kiosk (msg: offline, transactions delayed)
- [x] Try to drain queue on connection
- [x] ~~Retry to drain queue after a while on failure (too many requests)~~ (not required, interface reloads after 15 minutes)
- [x] ~~Remove `alert()` on failure, show banner instead~~ (https://gitlab.com/timvisee/barbapappa/-/issues/636)
- [x] ~~Disable CSRF on buy endpoint?~~ (probably not required)
- [x] Disable rate limiting on buy endpoint? (not disabled, but increased)
- [x] Make sure kiosk auto-reload doesn't break offline mode/cache
- [x] Add UUID to transaction
- [x] ~~Validate UUID uniqueness~~ (https://gitlab.com/timvisee/barbapappa/-/issues/637)
issue