Add button for home screen add instructions

This commit is contained in:
Ettore
2026-05-22 23:50:05 +02:00
parent eeea8dfad8
commit 6f90bd2891
6 changed files with 69 additions and 33 deletions

View File

@@ -6,7 +6,8 @@ A web-based gate access management and control system. Authorized users can remo
## Features
- **Keypass authentication** — users authenticate with an access code; each keypass can have a per-gate allowlist and an optional expiration date
- **Keypass authentication** — users authenticate with an access code; each keypass can have a per-gate allowlist, an optional expiration date, and an optional time/day-of-week schedule
- **Keypass schedules** — restrict a keypass to specific days of the week and/or a time window (e.g. MondayFriday 08:0018:00, server local time)
- **Remote gate control** — integrates with [AVConnect](https://www.avconnect.it) and [Shelly Cloud](https://shelly.cloud) to trigger gate macros/relays
- **Gate icons** — each gate can be assigned any UTF-8 character or emoji as its icon, displayed on the user app button and keypass selector
- **Role-based admin panel** — two roles (`admin`, `manager`) with different permission levels
@@ -93,7 +94,7 @@ data/
|---|---|---|
| GET | `/api/admin/keypasses` | List all keypasses |
| POST | `/api/admin/keypasses` | Create a keypass |
| PATCH | `/api/admin/keypasses/{kp_id}` | Update a keypass |
| PATCH | `/api/admin/keypasses/{kp_id}` | Update a keypass (description, expiry, gates, schedule) |
| DELETE | `/api/admin/keypasses/{kp_id}` | Revoke a keypass |
| GET | `/api/admin/keypasses/{kp_id}/qr` | Download QR code PNG for a keypass |
@@ -240,6 +241,23 @@ The Shelly server URI and auth key are stored encrypted. Configure them under **
**Mock mode** — when enabled via the admin dashboard, gate open requests always succeed without contacting any external API. Useful for testing.
## Keypass Schedules
In addition to an expiry date and a per-gate allowlist, each keypass can be restricted to a configurable time window:
- **Days of the week** — select any combination of MonSun. If no day is checked the restriction applies on any day.
- **Time window** — a `From` / `To` time in 24-hour format (server local time). Both values must be provided together.
When a keypass with a schedule is used outside its allowed window the API returns **HTTP 403** (`Keypass is not valid today` / `Keypass is not valid at this time`) and the gate will not open. The restriction is enforced in `require_keypass` in `src/core/dependencies.py`.
The schedule is stored as a JSON object in the `schedule` column of the `keypasses` table:
```json
{ "days": [0, 1, 2, 3, 4], "time_start": "08:00", "time_end": "18:00" }
```
`days` uses Python's `weekday()` convention: 0 = Monday, 6 = Sunday. Any absent key is treated as unrestricted (e.g. omitting `days` means any day is allowed).
## Keypass QR Codes
Each active keypass has a **QR** button in the admin panel. Clicking it generates a PNG QR code that encodes the URL: