Commit Graph

6 Commits

Author SHA1 Message Date
eduard256 397f9dd78b Add end-to-end tests for Frigate config writer
Covers every writer in pkg/generate/writer.go through the public Generate
entry-point: inputs/roles, needMP4 (bubble), ffmpeg, live, detect
(including the Objects auto-enable branch), objects, motion, record
(retain, alerts, detections, fractional days), snapshots, audio,
birdseye, onvif (host-gated emission, default port, credentials,
autotracking, required zones), ptz (only inside onvif), notifications,
ui, Frigate/Go2RTC overrides, Name override, extractIP fallbacks,
Added line numbers, and top-level/camera section ordering.
2026-04-18 11:53:47 +00:00
eduard256 f4d414124b Fix stray ONVIF block and Go2RTC sub-stream rename desync
- www/config.html: stop prefilling the ONVIF host with the camera IP so
  the onvif block is only emitted when the user opts in.
- pkg/generate/config.go: apply Go2RTC.SubStreamName before deriving the
  Frigate restream path so go2rtc.streams and ffmpeg.inputs stay in sync
  on rename (matches the existing main-stream order).
2026-04-18 11:53:37 +00:00
eduard256 3a48e23100 Nest credential sections under go2rtc in frigate config
Frigate rejects unknown top-level keys (extra="forbid" on root config),
but its RestreamConfig (go2rtc: block) allows extra keys. Move credential
sections under go2rtc: with 2/4 space indentation.

- writeCredentials emits "  xiaomi:" + "    \"<key>\": <value>"
- upsertSection matches 2-space section header + 4-space key regex
- insertNewSection places new nested sections after streams: block
- findStreamInsertPoint stops at sibling headers (2-space) inside go2rtc:
- Add xiaomi_test.go with 16 scenarios covering new config, addToConfig
  merging, token refresh, dedup, sort order, malformed URLs, special chars,
  go2rtc override, mixed protocols, and section order
2026-04-18 08:49:04 +00:00
eduard256 12780d7803 Add credential extraction registry for generate
Protocols like Xiaomi need credentials (tokens) in a separate top-level
YAML section, not in the stream URL itself. Introduce a registry pattern
mirroring streams.HandleFunc / tester.RegisterSource:

- pkg/generate/registry.go: ExtractFunc + RegisterExtract
- Extractors clean the URL (strip ?token=...) and return section/key/value
- writeCredentials emits sorted sections between go2rtc: and cameras:
- upsertCredentials in addToConfig merges into existing sections:
  * replaces value if key exists (token refresh)
  * inserts in sorted order if new
  * creates new top-level section before cameras: if missing

Xiaomi registers its extractor from internal/xiaomi/xiaomi.go. Adding
Tapo/Ring/Roborock later is one line + a small function in their
internal/*/ module -- zero changes in pkg/generate/.
2026-04-18 08:36:48 +00:00
eduard256 f34a7b96c7 Add go2rtc module, test/config/urls pages, Frigate config fixes 2026-03-26 22:45:32 +00:00
eduard256 27117900eb Rewrite Strix from scratch as single binary
Complete architecture rewrite following go2rtc patterns:
- pkg/ for pure logic (camdb, tester, probe, generate)
- internal/ for application glue with Init() modules
- Single HTTP server on :4567 with all endpoints
- zerolog with password masking and memory ring buffer
- Environment-based config only (no YAML files)

API endpoints: /api/search, /api/streams, /api/test,
/api/probe, /api/generate, /api/health, /api/log

Dependencies: go2rtc v1.9.14, go-sqlite3, miekg/dns, zerolog
2026-03-25 10:38:46 +00:00