feat: runtime config, Matomo analytics, chat accounts, DM history/search, and Prometheus retention

This commit is contained in:
zwitschi committed 2026-08-13 13:12:35 +02:00
1 parent 06ab5b4655
commit 121fdbacdc
27 files changed
+1841 -161

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# BACKLOG
> All remaining work is planned in [TODO](./TODO.md) (2026-08-13). This file records completed backlog items for reference; new unplanned work is added here.
> All current work is planned in [TODO](./TODO.md) (2026-08-13). This file lists backlog items; new unplanned work is added here.
## Cloudflare Configuration
+62 -1
View File
@@ -1,6 +1,6 @@
# DONE
Completed tasks from `.github/instructions/TODO.md`. Historical record for CHANGELOG.md, README.md, architecture docs.
> Completed tasks from [TODO](./TODO.md). Historical record for [CHANGELOG](./CHANGELOG.md), [README](./README.md), [architecture docs](./architecture/README.md).
## Session 2026-08-07 — Unit Tests
@@ -1087,3 +1087,64 @@ Completed the three Playout enhancement workstreams from `TODO.md`. Remaining po
- Verify `init.mp4` + manifest are correctly published on clean completion (existing `publishManifest` path runs after every run)
- Add metrics `linearvoid_playout_loops_total` (clean completions) and `linearvoid_playout_run_duration_seconds`
- Tests: `TestPlaylistFingerprint`, `TestHLSNextStartNumber`
## Session 2026-08-13 — Application Configuration, Matomo, Chat Accounts
### Application configuration (runtime config store)
- Runtime config store in `backend/chat/src/config/runtime.go` (thread-safe `Get`/`Set`, JSON persist, typed getters/setters with validation)
- `ConfigPath()` default `/app/playlist/config.json` (shared with playout via the playlist volume)
- Typed getters: `MatomoURL()`, `MatomoSiteID()`, `HLSSegmentDuration()`, `HLSWindowSize()`
- `GET/PUT /api/admin/config` now reads/persists `matomoUrl`, `matomoSiteId`, `hlsSegmentDuration`, `hlsWindowSize`
- Admin UI config form extended (`frontend/public/admin/system.html` + `frontend/src/admin.ts`)
- Playout reads the shared `config.json` (`loadSharedHLSConfig` + `PLAYOUT_CONFIG_PATH`)
- Tests: `runtime_test.go`, config handler tests, `TestLoadSharedHLSConfig`
### Matomo analytics
- Public `GET /api/matomo` endpoint
- Viewer pageview snippet in `frontend/index.html`
- Test: `TestHandlePublicMatomo`
### Admin frontend (media status + playlist gating)
- Media library: status badges (`ready`/`needs_normalization`/`normalizing`/`failed`) + "Add to playlist" gated to `ready` media
- Playlist entries: per-item status badges
- `statusBadge`, `fetchMediaStatusMap`, `addMediaToPlaylist` in `admin.ts`
### Chat user accounts
- `db.User` model (bcrypt password hash, unique username)
- `auth.UserSessionStore` (token → username with expiry)
- Endpoints: `POST /api/auth/register`, `POST /api/auth/login`, `GET /api/auth/session`, `POST /api/auth/logout`
- Viewer sign-in UI (`frontend/index.html` + `frontend/src/main.ts`)
- Tests: `TestUserSessionStore`, register/login/session handler tests
### Private DM history & search
- `GET /api/dm/history` (paginated) + `GET /api/dm/search` (case-insensitive)
- DM search UI in viewer
- Tests: `TestHandleUserDMHistory`, `TestHandleUserDMHistory_Unauthorized`, `TestHandleUserDMSearch`
### Chat UI (typing indicator + user list)
- `Hub.BroadcastTyping` (ephemeral typing events, not persisted)
- Viewer typing indicator (`showTyping`/`hideTyping`/`sendTyping`) + user-list toggle
## Session 2026-08-13 — Prometheus TSDB Retention
- Added `--storage.tsdb.retention.time=30d` (delete metrics older than 30d) + `--storage.tsdb.retention.size=15GB` (disk cap) to the `prometheus` service `command` in `docker-compose.yml` and `docker-compose.prod.yml`
- Validated: `docker compose config --quiet` (both files), `promtool check config` (SUCCESS, 10 rules), Prometheus v3.13.2 accepts both retention flags
- Documented the retention policy in `docs/MONITORING.md` → Operational Recommendations
## Session 2026-08-13 — Architecture Documentation Update
- Updated `docs/architecture/README.md` to reflect the `[Unreleased]` changes:
- Automatic media normalization on upload (`media.NormalizeVideo`, statuses, `POST /api/admin/media/{id}/normalize`)
- Playout: seamless looping, R2 segment retention, `-validate` mode, shared runtime config, new loop/cleanup metrics
- Prometheus: TSDB retention (`30d` + `15GB`), alert rule count fixed 8 → 10
- New Cross-cutting Concepts sections: Runtime Configuration Store, Analytics (Matomo)
- Viewer user accounts (register/login/logout/session, bcrypt, `linearvoid_user_session`)
- Chat: DM history/search, typing indicator, user-list toggle
- API reference: `GET/PUT /api/admin/config`, `POST /api/admin/media/{id}/normalize`, new Viewer REST API section
- Frontend + Chat Service module tables updated
+2 -29
View File
@@ -4,36 +4,9 @@
## Enhancements
### Application configuration
### Release new version 1.0.13
- [ ] Configuration: create simple getter/setter for configuration values (e.g. `MATOMO_URL`, `MATOMO_SITE_ID`) in `backend/admin/config.go`
- [ ] Configuration: expose configuration values to frontend via `/api/admin/config` endpoint
- [ ] Configuration: make configuration values editable:
- [ ] HLS_SEGMENT_DURATION
- [ ] HLS_WINDOW_SIZE
- [ ] MATOMO_URL
- [ ] MATOMO_SITE_ID
### Admin frontend
- [ ] Playlist: show `needs_normalization` badge and block/queue playlist-add until `ready`
- [ ] Playlist: show `ready` badge and allow playlist-add when `ready`
- [ ] Extend `system.html` with a section for configuration settings on top of page (HLS segment duration, window size, Matomo URL/site ID)
- [ ] Add functions to `admin.ts` to call `/api/admin/config` for getting and updating configuration values
### User frontend
- [ ] Player frontend: Embed JavaScript snippet in `index.html` to send pageview events to Matomo
### Chat user features
- [ ] Chat: add user registration and login flows
- [ ] Chat: private DM history and search
- [ ] Chat UI: add login/logout button, show username in chat, show/toggle user list, show/toggle online status, show typing indicator
### Monitoring
- [ ] Prometheus TSDB retention policy: delete metrics older than 30d
- [ ] Follow the [release procedure](/CONTRIBUTING.md#full-release-procedure) to release a new version of the software, including updating `CHANGELOG.md`, tagging the release in Git, and creating a Gitea release with notes.
## Setup phases remaining