Discovers ONVIF cameras (Hikvision/Annke) over WS-Discovery, keeps a server-side registry and an encrypted credential store, and serves info, snapshot and credentials routes for each camera. The home page is now a Server Component that lists known cameras from the registry on load, without a scan (vrek iss-a0hz0py). The snapshot refresh rate lives in the URL (?refresh=), and a scan refreshes the server-rendered list. Route input is validated with zod (iss-rjqy3hy), and /api/discover no longer returns raw error messages (iss-dbwgww8). Adds @tanstack/react-query and zod as dependencies, with a QueryClient provider in the root layout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
12 lines
450 B
TypeScript
12 lines
450 B
TypeScript
import { z } from "zod";
|
|
|
|
/** Snapshot refresh intervals offered in the UI, in milliseconds. */
|
|
export const REFRESH_OPTIONS_MS = [250, 500, 1000, 2000, 5000] as const;
|
|
export const DEFAULT_REFRESH_MS = 1000;
|
|
|
|
/** The `?refresh=` search param; anything unexpected falls back to the default. */
|
|
export const refreshMsSchema = z.coerce
|
|
.number()
|
|
.refine((ms) => (REFRESH_OPTIONS_MS as readonly number[]).includes(ms))
|
|
.catch(DEFAULT_REFRESH_MS);
|