@sentinel-nvr/web 0.16.8 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/index.d.ts +8 -2
- package/dist/api/index.js +5 -1
- package/dist/{chunk-26BQB2OK.js → chunk-CNXMCQJ3.js} +17 -1
- package/dist/chunk-CNXMCQJ3.js.map +1 -0
- package/dist/{chunk-QAYPO6TS.js → chunk-RJXSSHIR.js} +2 -2
- package/dist/{client-ByeVd4m8.d.ts → client-C-tpCEsf.d.ts} +14 -1
- package/dist/{controller-CGUkVpMw.d.ts → controller-DE4xqYEU.d.ts} +1 -1
- package/dist/player/index.d.ts +2 -2
- package/dist/player/index.js +2 -2
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +60 -36
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/locales/de.json +4 -0
- package/dist/ui/locales/en.json +4 -0
- package/dist/ui/locales/es.json +4 -0
- package/dist/ui/locales/fr.json +4 -0
- package/dist/ui/locales/it.json +4 -0
- package/dist/ui/locales/pt.json +4 -0
- package/dist/ui/locales/sv.json +4 -0
- package/dist/ui/ui.css +10 -0
- package/package.json +1 -1
- package/dist/chunk-26BQB2OK.js.map +0 -1
- /package/dist/{chunk-QAYPO6TS.js.map → chunk-RJXSSHIR.js.map} +0 -0
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ on older servers, but only get their full behaviour with the matching plugin ver
|
|
|
36
36
|
| 0.13.x | any (smaller pictures: ≥ 1.2.0; older plugins ignore `w=` and send full-size snapshots) | opening a camera: the tile's loaded picture is the poster at once (tiles load with `crossOrigin="anonymous"`, `rememberTileSnapshot` exported for host cards), live starts without waiting for the day loads (a failed load no longer blocks it), tiles ask for `api/snapshot&w=640/960`, the fresh poster for 1280. 0.13.1: an MJPEG fallback taken before the codec was known switches to MSE-live once the day loads bring it — client only. |
|
|
37
37
|
| 0.14.x | any | Picture-in-Picture note + "Open in Safari" in iPhone/iPad Home-Screen apps (Apple blocks PiP there); `PlayerController.pip()` resolves its outcome. Client only. |
|
|
38
38
|
| 0.15.x | any (priority order from the server: ≥ 1.3.0; older servers are sorted client-side) | event classes by priority (a cyclist is a person), class filters hide an event only when all its classes are off, chips count every contained class — client only. |
|
|
39
|
-
| 0.16.x | any (spans: ≥ 1.3.0) | events as time spans: bar from first sighting to last movement on the timeline, running events pulse, duration/„running“ in the list (`endTs`/`open`); older servers show plain markers. 0.16.5: storage values in the UI language, today refresh during playback — client only. 0.16.7: overlapping timeline markers grouped with a count, a tap zooms in — client only. 0.16.8: the events tab counts the centred day — client only. |
|
|
39
|
+
| 0.16.x | any (spans: ≥ 1.3.0) | events as time spans: bar from first sighting to last movement on the timeline, running events pulse, duration/„running“ in the list (`endTs`/`open`); older servers show plain markers. 0.16.5: storage values in the UI language, today refresh during playback — client only. 0.16.7: overlapping timeline markers grouped with a count, a tap zooms in — client only. 0.16.8: the events tab counts the centred day — client only. 0.16.9: "yesterday" in front of the time in the overview events strip — client only. 0.16.10: "recording stalled" on tiles and in the status pill (`stalled` from plugin ≥ 2026-10-05; older servers: no change). |
|
|
40
40
|
|
|
41
41
|
Lab note: Scrypted's WebRTC sink re-encodes (1280 px, 15 fps) for clients that are not Windows/macOS/iOS and report a
|
|
42
42
|
screen below 1920 physical pixels, unless the source declares a width ≤ 1280. Plugin ≥ 1.2.0 declares it for recorded
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as SENTINEL_CLASS_PRIORITY, a as SENTINEL_DAY_MS, b as SENTINEL_ENDPOINT_PATH, c as SENTINEL_EVENT_CLASSES, d as SENTINEL_MIN_SPAN_MS, e as SentinelBox, f as SentinelCamera, g as SentinelClient, h as SentinelClip, i as SentinelClipsResponse, j as SentinelEvent, k as SentinelEventBox, l as SentinelEventClass, m as SentinelHttpError, n as SentinelRecentEvent, o as
|
|
1
|
+
export { S as SENTINEL_CLASS_PRIORITY, a as SENTINEL_DAY_MS, b as SENTINEL_ENDPOINT_PATH, c as SENTINEL_EVENT_CLASSES, d as SENTINEL_MIN_SPAN_MS, e as SentinelBox, f as SentinelCamera, g as SentinelClient, h as SentinelClip, i as SentinelClipsResponse, j as SentinelEvent, k as SentinelEventBox, l as SentinelEventClass, m as SentinelHttpError, n as SentinelRecentEvent, o as SentinelRecordingState, p as SentinelRun, q as SentinelSetup, r as SentinelStats, s as SentinelStorageForecast, t as SentinelStorageStatus, u as exchangeSentinelToken, v as parseSentinelSetup, w as sentinelAddDays, x as sentinelAtTime, y as sentinelClassOf, z as sentinelClassesOf, A as sentinelClipIndexFor, B as sentinelClipRuns, C as sentinelDayEnd, D as sentinelDayOf, E as sentinelDuration, F as sentinelEntryUrl, G as sentinelEventHidden, H as sentinelEventPlayTs, I as sentinelEventSpan, J as sentinelHumanBytes, K as sentinelLoginBase, L as sentinelMergeDays, M as sentinelPublicBase, N as sentinelRecordingState, O as sentinelStorageForecast, P as sentinelTimelineLink, Q as sentinelUrl, R as sentinelWallMarks, T as sentinelWallSeconds, U as timeoutSignal } from '../client-C-tpCEsf.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Locale-aware, translation-free formatting (Intl only). Word-dependent helpers
|
|
@@ -6,6 +6,12 @@ export { S as SENTINEL_CLASS_PRIORITY, a as SENTINEL_DAY_MS, b as SENTINEL_ENDPO
|
|
|
6
6
|
*/
|
|
7
7
|
/** HH:MM in the viewer's locale (24 h where the locale uses it). */
|
|
8
8
|
declare function fmtTime(ts: number, locale: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Day in front of a time where "HH:MM" alone is ambiguous: '' on the viewer's today (and for a clock running a bit
|
|
11
|
+
* ahead), the locale's word for yesterday ("gestern", "yesterday", "i går" — Intl, no dictionary key), else a short
|
|
12
|
+
* numeric date ("3.10.", "10/3"). Calendar days of the viewer's time zone, so DST days (23/25 h) count as one day.
|
|
13
|
+
*/
|
|
14
|
+
declare function fmtDayPrefix(ts: number, locale: string, now?: number): string;
|
|
9
15
|
/** HH:MM:SS. */
|
|
10
16
|
declare function fmtTimeSec(ts: number, locale: string): string;
|
|
11
17
|
/** "Mon 8 Sep" style day label. */
|
|
@@ -17,4 +23,4 @@ declare function weekdayShorts(locale: string): string[];
|
|
|
17
23
|
/** HH:MM string for a <input type="time">. */
|
|
18
24
|
declare function hhmmInput(ts: number): string;
|
|
19
25
|
|
|
20
|
-
export { fmtDay, fmtMonthYear, fmtTime, fmtTimeSec, hhmmInput, weekdayShorts };
|
|
26
|
+
export { fmtDay, fmtDayPrefix, fmtMonthYear, fmtTime, fmtTimeSec, hhmmInput, weekdayShorts };
|
package/dist/api/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
SentinelHttpError,
|
|
9
9
|
exchangeSentinelToken,
|
|
10
10
|
fmtDay,
|
|
11
|
+
fmtDayPrefix,
|
|
11
12
|
fmtMonthYear,
|
|
12
13
|
fmtTime,
|
|
13
14
|
fmtTimeSec,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
sentinelLoginBase,
|
|
31
32
|
sentinelMergeDays,
|
|
32
33
|
sentinelPublicBase,
|
|
34
|
+
sentinelRecordingState,
|
|
33
35
|
sentinelStorageForecast,
|
|
34
36
|
sentinelTimelineLink,
|
|
35
37
|
sentinelUrl,
|
|
@@ -37,7 +39,7 @@ import {
|
|
|
37
39
|
sentinelWallSeconds,
|
|
38
40
|
timeoutSignal,
|
|
39
41
|
weekdayShorts
|
|
40
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-CNXMCQJ3.js";
|
|
41
43
|
export {
|
|
42
44
|
SENTINEL_CLASS_PRIORITY,
|
|
43
45
|
SENTINEL_DAY_MS,
|
|
@@ -48,6 +50,7 @@ export {
|
|
|
48
50
|
SentinelHttpError,
|
|
49
51
|
exchangeSentinelToken,
|
|
50
52
|
fmtDay,
|
|
53
|
+
fmtDayPrefix,
|
|
51
54
|
fmtMonthYear,
|
|
52
55
|
fmtTime,
|
|
53
56
|
fmtTimeSec,
|
|
@@ -70,6 +73,7 @@ export {
|
|
|
70
73
|
sentinelLoginBase,
|
|
71
74
|
sentinelMergeDays,
|
|
72
75
|
sentinelPublicBase,
|
|
76
|
+
sentinelRecordingState,
|
|
73
77
|
sentinelStorageForecast,
|
|
74
78
|
sentinelTimelineLink,
|
|
75
79
|
sentinelUrl,
|
|
@@ -7,6 +7,11 @@ var SENTINEL_EVENT_CLASSES = [
|
|
|
7
7
|
"package",
|
|
8
8
|
"motion"
|
|
9
9
|
];
|
|
10
|
+
function sentinelRecordingState(cam) {
|
|
11
|
+
if (!cam.recording) return "off";
|
|
12
|
+
if (cam.stalled) return "stalled";
|
|
13
|
+
return cam.online ? "ok" : "offline";
|
|
14
|
+
}
|
|
10
15
|
var SENTINEL_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
11
16
|
var SENTINEL_ENDPOINT_PATH = "/endpoint/@local/sentinel-nvr";
|
|
12
17
|
function parseSentinelSetup(input) {
|
|
@@ -341,6 +346,15 @@ var pad = (n) => String(n).padStart(2, "0");
|
|
|
341
346
|
function fmtTime(ts, locale) {
|
|
342
347
|
return new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit" }).format(ts);
|
|
343
348
|
}
|
|
349
|
+
function fmtDayPrefix(ts, locale, now = Date.now()) {
|
|
350
|
+
const day = new Date(ts).setHours(0, 0, 0, 0);
|
|
351
|
+
const today = new Date(now).setHours(0, 0, 0, 0);
|
|
352
|
+
if (day >= today) return "";
|
|
353
|
+
const y = new Date(today);
|
|
354
|
+
y.setDate(y.getDate() - 1);
|
|
355
|
+
if (day === y.getTime()) return new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(-1, "day");
|
|
356
|
+
return new Intl.DateTimeFormat(locale, { day: "numeric", month: "numeric" }).format(ts);
|
|
357
|
+
}
|
|
344
358
|
function fmtTimeSec(ts, locale) {
|
|
345
359
|
return new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit", second: "2-digit" }).format(ts);
|
|
346
360
|
}
|
|
@@ -361,6 +375,7 @@ function hhmmInput(ts) {
|
|
|
361
375
|
|
|
362
376
|
export {
|
|
363
377
|
SENTINEL_EVENT_CLASSES,
|
|
378
|
+
sentinelRecordingState,
|
|
364
379
|
SENTINEL_DAY_MS,
|
|
365
380
|
SENTINEL_ENDPOINT_PATH,
|
|
366
381
|
parseSentinelSetup,
|
|
@@ -393,10 +408,11 @@ export {
|
|
|
393
408
|
exchangeSentinelToken,
|
|
394
409
|
timeoutSignal,
|
|
395
410
|
fmtTime,
|
|
411
|
+
fmtDayPrefix,
|
|
396
412
|
fmtTimeSec,
|
|
397
413
|
fmtDay,
|
|
398
414
|
fmtMonthYear,
|
|
399
415
|
weekdayShorts,
|
|
400
416
|
hhmmInput
|
|
401
417
|
};
|
|
402
|
-
//# sourceMappingURL=chunk-
|
|
418
|
+
//# sourceMappingURL=chunk-CNXMCQJ3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/model.ts","../src/api/client.ts","../src/api/format.ts"],"sourcesContent":["/**\n * Sentinel NVR — DOM-free data model + pure helpers.\n *\n * Mirrors the Sentinel NVR plugin's `docs/API.md` (the binding contract): types,\n * URL/setup parsing, event classification, the playback-start heuristic, the\n * storage forecast the status page computes, and the timeline clip-run merge.\n * No fetch/DOM here — the browser client lives in `client.ts`.\n */\n\n// ---------------------------------------------------------------------------\n// Types (docs/API.md §3)\n// ---------------------------------------------------------------------------\n\n/** UI classes of an event; anything unknown collapses to `motion`. */\nexport type SentinelEventClass = 'person' | 'car' | 'bike' | 'animal' | 'package' | 'motion';\n\nexport const SENTINEL_EVENT_CLASSES: readonly SentinelEventClass[] = [\n 'person',\n 'car',\n 'bike',\n 'animal',\n 'package',\n 'motion',\n];\n\nexport type SentinelBox = [number, number, number, number];\n\n/** `api/cameras` entry. */\nexport interface SentinelCamera {\n id: string;\n name: string;\n recording: boolean;\n online: boolean;\n /** plugin ≥ 2026-10-05: recording watchdog — ffmpeg ran ≥ 3 min without a new segment and is being restarted; stays set\n * (also while the restart is pending, `online` false) until a segment arrives again. */\n stalled?: boolean;\n /** plugin ≥ 2026-10-05: since when nothing was recorded (ms) */\n stalledSince?: number;\n lastSegmentAt?: number;\n eventsToday: number;\n lastEventTs?: number;\n latestThumbId?: string;\n latestTs?: number;\n /** RFC-6381 codec string of the recordings (MSE). */\n codecs?: string;\n}\n\n/**\n * Recording state of a camera tile: `off` = recording switched off, `stalled` = recording hangs (watchdog, outranks\n * `offline`: during the restart after a stall ffmpeg is briefly down), `offline` = ffmpeg not running (camera\n * unreachable), `ok` = recording.\n */\nexport type SentinelRecordingState = 'off' | 'stalled' | 'offline' | 'ok';\n\nexport function sentinelRecordingState(\n cam: Pick<SentinelCamera, 'recording' | 'online' | 'stalled'>,\n): SentinelRecordingState {\n if (!cam.recording) return 'off';\n if (cam.stalled) return 'stalled';\n return cam.online ? 'ok' : 'offline';\n}\n\n/** `api/stats`. */\nexport interface SentinelStats {\n cameras: number;\n /** cameras recording right now (plugin ≥ 2026-10-05; before: cameras with recording switched on) */\n recording: number;\n eventsToday: number;\n segments: number;\n bytes: number;\n earliest?: number;\n retentionDays: number;\n diskFree: number;\n diskTotal: number;\n minFreeBytes: number;\n /** plugin ≥ 2026-09-26: storage root usable (storage guard); false = not recording, nothing deleted. */\n storageOk?: boolean;\n /** why not: 'marker' (share not mounted), 'missing', 'error', 'timeout' */\n storageProblem?: string;\n}\n\n/** `api/recent-events` entry (short form). */\nexport interface SentinelRecentEvent {\n camera: string;\n cameraName: string;\n ts: number;\n startTs?: number;\n /** plugin ≥ 1.3.0: event as a time span — last movement of one of its objects */\n endTs?: number;\n /** plugin ≥ 1.3.0: the event is still running */\n open?: boolean;\n classes: string[];\n score: number;\n}\n\nexport interface SentinelEventBox {\n class: string;\n rawClass?: string;\n score: number;\n box: SentinelBox;\n nbox?: SentinelBox;\n /** plugin ≥ 1.3.0: picture time of this box (later than `timestamp` = the object joined the running event) */\n ts?: number;\n}\n\n/** Full event (`api/clips.events`). */\nexport interface SentinelEvent {\n id: string;\n timestamp: number;\n startTs?: number;\n classes: string[];\n score: number;\n source: 'object' | 'motion';\n boxes?: SentinelEventBox[];\n /** plugin ≥ 1.3.0: event as a time span — last movement of one of its objects */\n endTs?: number;\n /** plugin ≥ 1.3.0: the event is still running (its objects are still there) */\n open?: boolean;\n}\n\n/** Recording segment (`api/clips.clips`). */\nexport interface SentinelClip {\n id: string;\n videoId?: string;\n thumbnailId?: string;\n startTime: number;\n duration?: number;\n event?: string;\n detectionClasses?: string[];\n}\n\nexport interface SentinelClipsResponse {\n clips: SentinelClip[];\n events: SentinelEvent[];\n motion: [number, number][];\n codecs?: string;\n}\n\nexport const SENTINEL_DAY_MS = 24 * 60 * 60 * 1000;\n\n// ---------------------------------------------------------------------------\n// Setup / URLs (docs/API.md §1)\n// ---------------------------------------------------------------------------\n\n/** Where the plugin lives below a Scrypted origin. */\nexport const SENTINEL_ENDPOINT_PATH = '/endpoint/@local/sentinel-nvr';\n\nexport interface SentinelSetup {\n /** Scrypted origin, e.g. `https://192.0.2.10:10443` (no trailing slash). */\n origin: string;\n /** Access token found in the pasted URL (`?token=`), if any. */\n token: string | null;\n /**\n * Reverse-proxy path prefix in front of Scrypted's `/endpoint/…` (e.g. `/scrypted` for\n * `https://proxy/scrypted/endpoint/@local/sentinel-nvr/public/`), `''` without one.\n * Only derived when the pasted URL contains `/endpoint/`. Since 0.10.0.\n */\n prefix: string;\n}\n\n/**\n * Turn whatever the user pastes into a clean Scrypted origin (+ token, when the\n * pasted string was Sentinel's embed URL). Accepts a bare host (`https://` is\n * assumed), the Scrypted root, the plugin's login/public path, or the embed\n * URL with `?token=…&embed=1`. Returns null for unusable input.\n */\nexport function parseSentinelSetup(input: string | null | undefined): SentinelSetup | null {\n const raw = (input ?? '').trim();\n if (!raw) return null;\n const withScheme = /^https?:\\/\\//i.test(raw) ? raw : `https://${raw}`;\n let u: URL;\n try {\n u = new URL(withScheme);\n } catch {\n return null;\n }\n if (!u.hostname) return null;\n const token = u.searchParams.get('token');\n const at = u.pathname.indexOf('/endpoint/');\n const prefix = at > 0 ? u.pathname.slice(0, at).replace(/\\/+$/, '') : '';\n return { origin: u.origin, token: token && token.trim() ? token.trim() : null, prefix };\n}\n\n/** Token-guarded machine base (`…/public/`), always with a trailing slash; `prefix` = reverse-proxy path prefix. */\nexport function sentinelPublicBase(origin: string, prefix = ''): string {\n return `${origin.replace(/\\/+$/, '')}${prefix.replace(/\\/+$/, '')}${SENTINEL_ENDPOINT_PATH}/public/`;\n}\n\n/**\n * Human base behind the Scrypted login (`…/sentinel-nvr/`). NOT a link target:\n * without a session Scrypted answers \"Not Authorized\" here. Humans enter via\n * `sentinelEntryUrl` (the public base without a token shows Sentinel's sign-in\n * page, or redirects straight here when a session exists).\n */\nexport function sentinelLoginBase(origin: string): string {\n return `${origin.replace(/\\/+$/, '')}${SENTINEL_ENDPOINT_PATH}/`;\n}\n\n/** Where a human opens Sentinel's own UI: the public base WITHOUT a token (sign-in page / 302 into the session). */\nexport function sentinelEntryUrl(origin: string): string {\n return sentinelPublicBase(origin);\n}\n\n/**\n * Absolute URL for an API/media path below the public base, with the token as\n * a query parameter (a `GET` with a query token is a CORS \"simple request\" —\n * the `x-sentinel-token` header would force a preflight the plugin does not\n * answer; `<img>`/`<video>` sources need the query form anyway).\n */\nexport function sentinelUrl(base: string, token: string, path: string): string {\n const u = base + path;\n if (!token) return u;\n return `${u}${u.includes('?') ? '&' : '?'}token=${encodeURIComponent(token)}`;\n}\n\n/**\n * Deep link into Sentinel's own web UI for a camera timeline — via the entry\n * URL (sign-in or 302 into the session; browsers carry the `#` fragment across\n * the redirect).\n */\nexport function sentinelTimelineLink(origin: string, cameraId: string, atMs?: number): string {\n const q = atMs ? `?at=${Math.round(atMs)}` : '';\n return `${sentinelEntryUrl(origin)}#/timeline/${encodeURIComponent(cameraId)}${q}`;\n}\n\n// ---------------------------------------------------------------------------\n// Events\n// ---------------------------------------------------------------------------\n\nfunction isKnownClass(k: string): k is SentinelEventClass {\n return (SENTINEL_EVENT_CLASSES as readonly string[]).includes(k);\n}\n\n/** Which class of a multi-class event matters most (a cyclist is a person first). Servers from plugin 1.3.0 send\n * `classes` in this order; older ones sent them alphabetically — the helpers below sort themselves. */\nexport const SENTINEL_CLASS_PRIORITY: readonly SentinelEventClass[] = [\n 'person',\n 'animal',\n 'bike',\n 'car',\n 'package',\n 'motion',\n];\n\n/** Distinct known classes of an event by priority (unknown classes count as `motion`) — never empty. */\nexport function sentinelClassesOf(ev: { classes?: string[] | undefined }): SentinelEventClass[] {\n const out: SentinelEventClass[] = [];\n for (const k of ev.classes ?? []) {\n const c: SentinelEventClass = isKnownClass(k) ? k : 'motion';\n if (!out.includes(c)) out.push(c);\n }\n if (!out.length) out.push('motion');\n return out.sort((a, b) => SENTINEL_CLASS_PRIORITY.indexOf(a) - SENTINEL_CLASS_PRIORITY.indexOf(b));\n}\n\n/** Primary class of an event: its most important class (person > animal > bike > car > package), else `motion`. */\nexport function sentinelClassOf(ev: { classes?: string[] | undefined }): SentinelEventClass {\n return sentinelClassesOf(ev)[0];\n}\n\n/** A class filter hides an event only when ALL of its classes are switched off (a cyclist stays visible with\n * „Fahrzeug“ off, because it is also a person). */\nexport function sentinelEventHidden(\n ev: { classes?: string[] | undefined },\n off: Partial<Record<SentinelEventClass, boolean>>,\n): boolean {\n return sentinelClassesOf(ev).every((c) => off[c]);\n}\n\n/** Shorter spans are drawn as a plain marker. */\nexport const SENTINEL_MIN_SPAN_MS = 3000;\n\n/**\n * An event as a time span (plugin ≥ 1.3.0): from its first sighting to the last movement of its objects — a running\n * event reaches up to `now`. Undefined for short events and for servers without `endTs`.\n */\nexport function sentinelEventSpan(\n ev: { timestamp?: number; ts?: number; startTs?: number; endTs?: number; open?: boolean },\n now = Date.now(),\n): { start: number; end: number; open: boolean } | undefined {\n const t = ev.timestamp ?? ev.ts ?? 0;\n const start = Math.min(ev.startTs ?? t, t);\n const open = !!ev.open;\n const end = open ? Math.max(now, ev.endTs ?? t) : ev.endTs;\n if (end === undefined || end - start < SENTINEL_MIN_SPAN_MS)\n return open ? { start, end: end ?? now, open } : undefined;\n return { start, end, open };\n}\n\n/** A span's length as m:ss (h:mm:ss from one hour). */\nexport function sentinelDuration(ms: number): string {\n const s = Math.max(0, Math.round(ms / 1000));\n const h = Math.floor(s / 3600),\n m = Math.floor((s % 3600) / 60),\n sec = String(s % 60).padStart(2, '0');\n return h ? `${h}:${String(m).padStart(2, '0')}:${sec}` : `${m}:${sec}`;\n}\n\n/**\n * Where playback starts for an event: 2 s before the first sighting when the\n * detector recorded one, else 3 s before the trigger (docs/API.md §3.3).\n */\nexport function sentinelEventPlayTs(ev: { timestamp?: number; ts?: number; startTs?: number }): number {\n const ts = ev.startTs || ev.ts || ev.timestamp || 0;\n return ev.startTs ? ts - 2000 : ts - 3000;\n}\n\n// ---------------------------------------------------------------------------\n// Storage forecast (docs/API.md §3.2 — the same maths the Sentinel status page uses)\n// ---------------------------------------------------------------------------\n\nexport type SentinelStorageStatus = 'unknown' | 'unreachable' | 'reachable' | 'filling';\n\nexport interface SentinelStorageForecast {\n /** Days spanned by the archive (earliest segment → now). */\n spanDays: number;\n /** Bytes recorded per day (0 until at least an hour of footage exists). */\n ratePerDay: number;\n /** Free-space guard reserve, clamped to the disk size. */\n reserve: number;\n /** Free bytes above the reserve. */\n usableFree: number;\n /** Bytes available for recordings = archive + usable free. */\n capacity: number;\n /** Days the archive can grow to at the current rate (0 = unknown). */\n fitsDays: number;\n /** Days until the reserve is reached (0 = unknown). */\n fillsInDays: number;\n /** The disk is effectively full (free ≤ 2 % above the reserve) → steady-state eviction. */\n steady: boolean;\n /** Bytes used by something other than recordings. */\n other: number;\n /** Which forecast message applies. */\n status: SentinelStorageStatus;\n}\n\nexport function sentinelStorageForecast(st: SentinelStats, nowMs: number = Date.now()): SentinelStorageForecast {\n const spanDays = st.earliest ? Math.max(0, (nowMs - st.earliest) / SENTINEL_DAY_MS) : 0;\n const ratePerDay = spanDays >= 1 / 24 ? st.bytes / Math.max(spanDays, 1 / 24) : 0;\n const reserve = Math.min(st.minFreeBytes || 0, st.diskTotal);\n const usableFree = Math.max(0, st.diskFree - reserve);\n const capacity = st.bytes + usableFree;\n const fitsDays = ratePerDay ? capacity / ratePerDay : 0;\n const fillsInDays = ratePerDay ? usableFree / ratePerDay : 0;\n const steady = usableFree < 0.02 * st.diskTotal;\n const other = Math.max(0, st.diskTotal - st.diskFree - st.bytes);\n let status: SentinelStorageStatus = 'unknown';\n if (ratePerDay) {\n if (fitsDays < st.retentionDays * 0.95) status = 'unreachable';\n else if (steady || spanDays >= st.retentionDays) status = 'reachable';\n else status = 'filling';\n }\n return { spanDays, ratePerDay, reserve, usableFree, capacity, fitsDays, fillsInDays, steady, other, status };\n}\n\n// ---------------------------------------------------------------------------\n// Timeline helpers\n// ---------------------------------------------------------------------------\n\nexport interface SentinelRun {\n s: number;\n e: number;\n}\n\n/**\n * Contiguous recording runs: segments whose gap is ≤ `gapMs` (2 s) are drawn as\n * ONE band (otherwise every 60-s segment boundary shows a notch).\n */\nexport function sentinelClipRuns(clips: SentinelClip[], gapMs = 2000): SentinelRun[] {\n const out: SentinelRun[] = [];\n let cur: SentinelRun | null = null;\n for (const c of clips) {\n const e = c.startTime + (c.duration || 0);\n if (cur && c.startTime - cur.e <= gapMs) cur.e = Math.max(cur.e, e);\n else {\n cur = { s: c.startTime, e };\n out.push(cur);\n }\n }\n return out;\n}\n\n/** Index of the clip covering `ts` (60 s assumed when a duration is missing), −1 if none. */\nexport function sentinelClipIndexFor(clips: SentinelClip[], ts: number): number {\n for (let i = 0; i < clips.length; i++) {\n const c = clips[i]!;\n if (ts >= c.startTime && ts < c.startTime + (c.duration || 60000)) return i;\n }\n return -1;\n}\n\n/** Local-midnight start of the day containing `ts`. */\nexport function sentinelDayOf(ts: number): number {\n return new Date(ts).setHours(0, 0, 0, 0);\n}\n\n// Calendar-day arithmetic. A local day is 23 or 25 hours long on DST change days, so\n// \"day ± 24 h\" lands an hour off midnight there (a second key for the same day, requests\n// shifted by an hour, \"next day\" staying on the same date). Always step calendar days:\n\n/** Local midnight `n` calendar days from the day of `ts`. */\nexport function sentinelAddDays(ts: number, n: number): number {\n const d = new Date(ts);\n d.setHours(0, 0, 0, 0);\n d.setDate(d.getDate() + n);\n return d.getTime();\n}\n\n/** End of the local day of `ts` (= next local midnight). */\nexport function sentinelDayEnd(ts: number): number {\n return sentinelAddDays(ts, 1);\n}\n\n/** Wall-clock time h:m on the local day of `ts` (not `midnight + h·3600 s`, which is an hour off on DST days). */\nexport function sentinelAtTime(ts: number, h: number, m: number, s = 0): number {\n const d = new Date(ts);\n d.setHours(h, m, s, 0);\n return d.getTime();\n}\n\n/**\n * Timestamps of local wall-clock marks every `step` ms (a divisor of a day: 15 s … 6 h) within [from, to],\n * ascending: a 3-h step marks 00:00/03:00/06:00 local time in every time zone (UTC-aligned steps showed\n * 02:00/05:00/08:00 in CEST). On DST days a mark that does not exist is skipped, a repeated hour marked once.\n */\nexport function sentinelWallMarks(from: number, to: number, step: number, max = 8000): number[] {\n const stepSec = Math.max(1, Math.round(step / 1000));\n const out: number[] = [];\n for (let day = sentinelDayOf(from); day <= to && out.length < max; day = sentinelAddDays(day, 1)) {\n const end = sentinelDayEnd(day);\n const regular = end - day === SENTINEL_DAY_MS;\n // only the marks near the window (+1 h slack on DST days)\n const k0 = Math.max(0, Math.floor((from - day - 3600_000) / (stepSec * 1000)));\n const k1 = Math.min(Math.floor(86400 / stepSec), Math.ceil((to - day + 3600_000) / (stepSec * 1000)));\n for (let k = k0; k <= k1 && out.length < max; k++) {\n const sec = k * stepSec;\n if (sec >= 86400) break;\n let t: number;\n if (regular) t = day + sec * 1000;\n else {\n const d = new Date(day);\n d.setHours(Math.floor(sec / 3600), Math.floor((sec % 3600) / 60), sec % 60, 0);\n // a wall time that does not exist (spring gap) normalises to another hour: skip it\n if (d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds() !== sec) continue;\n t = d.getTime();\n }\n if (t >= from && t <= to && (!out.length || t > out[out.length - 1]!)) out.push(t);\n }\n }\n return out;\n}\n\n/** Local wall-clock seconds since midnight (for \"is this mark on a label step?\"). */\nexport function sentinelWallSeconds(ts: number): number {\n const d = new Date(ts);\n return d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds();\n}\n\n/**\n * Merge per-day clip responses into one sorted, continuous data set. A clip or motion span that\n * crosses midnight comes with both days — kept once (by id / by interval).\n */\nexport function sentinelMergeDays(days: Record<number, SentinelClipsResponse>): {\n clips: SentinelClip[];\n events: SentinelEvent[];\n motion: [number, number][];\n codecs: string | null;\n oldestDay: number | null;\n} {\n const keys = Object.keys(days)\n .map(Number)\n .sort((a, b) => a - b);\n const clips = new Map<string, SentinelClip>(),\n events = new Map<string, SentinelEvent>();\n const motionRaw: [number, number][] = [];\n let codecs: string | null = null;\n for (const k of keys) {\n const d = days[k]!;\n for (const c of d.clips) clips.set(c.id, c);\n for (const e of d.events) events.set(e.id || `${e.timestamp}`, e);\n motionRaw.push(...d.motion);\n if (d.codecs) codecs = d.codecs;\n }\n motionRaw.sort((a, b) => a[0] - b[0]);\n const motion: [number, number][] = [];\n for (const m of motionRaw) {\n const last = motion[motion.length - 1];\n if (last && m[0] <= last[1]) last[1] = Math.max(last[1], m[1]);\n else motion.push([m[0], m[1]]);\n }\n return {\n clips: [...clips.values()].sort((a, b) => a.startTime - b.startTime),\n events: [...events.values()].sort((a, b) => a.timestamp - b.timestamp),\n motion,\n codecs,\n oldestDay: keys.length ? keys[0]! : null,\n };\n}\n\nconst bytesFmt = new Map<string, Intl.NumberFormat | null>();\n/** Fixed-decimals number in a locale (\"7,7\" in German, \"7.7\" in English); an unknown tag falls back to toFixed. */\nfunction fixedIn(n: number, digits: number, locale: string): string {\n const key = `${locale}|${digits}`;\n let f = bytesFmt.get(key);\n if (f === undefined) {\n try {\n f = new Intl.NumberFormat(locale, { minimumFractionDigits: digits, maximumFractionDigits: digits });\n } catch {\n f = null;\n }\n bytesFmt.set(key, f);\n }\n return f ? f.format(n) : n.toFixed(digits);\n}\n\n/** Human-readable byte size split into value + unit (binary steps). With `locale` the value carries that language's\n * decimal separator (de \"7,7\", en \"7.7\"); without it, a plain decimal point as before. */\nexport function sentinelHumanBytes(b: number, locale?: string): { value: string; unit: string } {\n if (!b || b <= 0) return { value: '0', unit: 'B' };\n const u = ['B', 'KB', 'MB', 'GB', 'TB'];\n const i = Math.min(u.length - 1, Math.floor(Math.log(b) / Math.log(1024)));\n const n = b / Math.pow(1024, i),\n digits = i ? 1 : 0;\n return { value: locale ? fixedIn(n, digits, locale) : n.toFixed(digits), unit: u[i]! };\n}\n","/**\n * Browser client for the Sentinel NVR plugin's token-guarded `/public/` endpoint.\n *\n * The plugin sends permissive CORS on every answer (JSON, the 204 control replies,\n * api/segment incl. 206, api/livemse, images, errors) and answers OPTIONS, so a\n * cross-origin static SPA can talk to it directly with `?token=`. Media elements\n * may use crossOrigin=\"anonymous\". Older builds (JSON-only CORS) degrade: control()\n * treats an unreadable reply as delivered; media fetches fall into the next fallback.\n */\n\nimport { sentinelPublicBase, sentinelEntryUrl, sentinelUrl } from './model';\n\nexport class SentinelClient {\n readonly origin: string;\n readonly token: string;\n readonly base: string;\n /** \"Open Sentinel\" target: public base without token → sign-in / 302 into the session. */\n readonly entryUrl: string;\n /** fetch() can read media bodies (segments, live fMP4): the plugin sends CORS on media. */\n readonly corsMedia = true;\n\n /**\n * @param origin Scrypted origin, e.g. https://host:10443\n * @param token access token (empty behind a Scrypted login session)\n * @param opts.base override the request base: needed when the plugin is served\n * under a reverse-proxy prefix, or behind the Scrypted login path\n * (`…/endpoint/@local/sentinel-nvr/`, cookie session, no token). Defaults to\n * the token-guarded public base below `origin`.\n */\n constructor(origin: string, token: string, opts: { base?: string } = {}) {\n this.origin = origin;\n this.token = token;\n this.base = opts.base ? opts.base.replace(/\\/*$/, '/') : sentinelPublicBase(origin);\n this.entryUrl = sentinelEntryUrl(origin);\n }\n\n /** Cache key — a new client is built whenever origin/token change. */\n get key(): string {\n return `${this.origin} ${this.token}`;\n }\n\n url(path: string): string {\n return sentinelUrl(this.base, this.token, path);\n }\n\n /** JSON GET with a timeout (an unreachable host otherwise waits for the browser's TCP timeout). */\n async getJson<T>(path: string, signal?: AbortSignal, timeoutMs = 10_000): Promise<T> {\n const signals: AbortSignal[] = [AbortSignal.timeout(timeoutMs)];\n if (signal) signals.push(signal);\n // AbortSignal.any is Chrome 116 / Safari 17.4+; older engines get the timeout signal alone.\n const combined = typeof AbortSignal.any === 'function' ? AbortSignal.any(signals) : signals[0]!;\n const r = await fetch(this.url(path), { cache: 'no-store', signal: combined });\n if (!r.ok) throw new SentinelHttpError(r.status, path);\n return (await r.json()) as T;\n }\n\n /**\n * Fire a control GET (204 = ok, 404 = session gone). Resolves `r.ok`; a rejected\n * fetch (network error) resolves false so the player can recover instead of\n * believing a seek/rate change landed. (The plugin sends CORS on every reply.)\n */\n async control(path: string, timeoutMs = 8000): Promise<boolean> {\n try {\n // bounded: a hanging control request kept the player's \"one in flight\" gate closed for good\n const r = await fetch(this.url(path), { cache: 'no-store', signal: timeoutSignal(timeoutMs) });\n return r.ok;\n } catch {\n return false;\n }\n }\n\n /** Text POST (client telemetry). Best effort, never throws. */\n postText(path: string, body: string): void {\n try {\n void fetch(this.url(path), { method: 'POST', body, keepalive: true }).catch(() => {\n /* telemetry only */\n });\n } catch {\n /* ignore */\n }\n }\n\n /** WebSocket signaling URL (the plugin's Engine.IO handler). */\n signalingUrl(cameraId: string, params: Record<string, string> = {}): string {\n const u = new URL(this.url(''));\n u.protocol = u.protocol === 'https:' ? 'wss:' : 'ws:';\n u.hash = '';\n u.searchParams.set('camera', cameraId);\n u.searchParams.set('signaling', '1');\n for (const [k, v] of Object.entries(params)) u.searchParams.set(k, v);\n return u.href;\n }\n\n // ---- media URL helpers (all <img>/<video>-loadable) ----\n /** `width` = resized picture (plugin ≥ 2026-09-27, older ones ignore it and send the camera's original) */\n snapshotUrl(cameraId: string, bust?: number, width?: number): string {\n return (\n this.url(`api/snapshot?camera=${encodeURIComponent(cameraId)}`) +\n (width ? `&w=${Math.round(width)}` : '') +\n (bust != null ? `&_=${bust}` : '')\n );\n }\n eventThumbUrl(cameraId: string, ts: number): string {\n return this.url(`api/evthumb?camera=${encodeURIComponent(cameraId)}&ts=${Math.round(ts)}`);\n }\n eventFrameUrl(cameraId: string, ts: number): string {\n return this.url(`api/evframe?camera=${encodeURIComponent(cameraId)}&ts=${Math.round(ts)}`);\n }\n segmentThumbUrl(thumbId: string): string {\n return this.url(`api/thumb?id=${encodeURIComponent(thumbId)}`);\n }\n}\n\nexport class SentinelHttpError extends Error {\n readonly status: number;\n constructor(status: number, path: string) {\n super(`${status} ${path}`);\n this.name = 'SentinelHttpError';\n this.status = status;\n }\n}\n\n/**\n * Trade Scrypted credentials for the plugin's access token (`POST …/public/api/token-exchange`,\n * plugin ≥ 2026-09-22). Rejects with `SentinelHttpError`: 401 wrong credentials, 403 token access\n * switched off in the plugin or (plugin ≥ 2026-09-26) not a Scrypted admin, 404 plugin too old,\n * 429 too many attempts, 503 Scrypted login unavailable; 0 = unreachable. `prefix` = reverse-proxy\n * path prefix (SentinelSetup.prefix, since 0.10.0).\n */\nexport async function exchangeSentinelToken(\n origin: string,\n username: string,\n password: string,\n timeoutMs = 10_000,\n prefix = '',\n): Promise<string> {\n const path = 'api/token-exchange';\n let r: Response;\n try {\n r = await fetch(sentinelPublicBase(origin, prefix) + path, {\n method: 'POST',\n cache: 'no-store',\n signal: AbortSignal.timeout(timeoutMs),\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ username, password }),\n });\n } catch {\n throw new SentinelHttpError(0, path);\n }\n if (!r.ok) throw new SentinelHttpError(r.status, path);\n const j = (await r.json()) as { token?: unknown };\n if (typeof j.token !== 'string' || !j.token) throw new SentinelHttpError(502, path);\n return j.token;\n}\n\n/** AbortSignal that fires after `ms` (undefined on engines without AbortSignal.timeout — Safari < 16). */\nexport function timeoutSignal(ms: number): AbortSignal | undefined {\n return typeof AbortSignal !== 'undefined' && typeof AbortSignal.timeout === 'function'\n ? AbortSignal.timeout(ms)\n : undefined;\n}\n","/**\n * Locale-aware, translation-free formatting (Intl only). Word-dependent helpers\n * (relative time, \"N days\") live in @sentinel-nvr/ui, which owns the i18n dictionary.\n */\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\n/** HH:MM in the viewer's locale (24 h where the locale uses it). */\nexport function fmtTime(ts: number, locale: string): string {\n return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(ts);\n}\n\n/**\n * Day in front of a time where \"HH:MM\" alone is ambiguous: '' on the viewer's today (and for a clock running a bit\n * ahead), the locale's word for yesterday (\"gestern\", \"yesterday\", \"i går\" — Intl, no dictionary key), else a short\n * numeric date (\"3.10.\", \"10/3\"). Calendar days of the viewer's time zone, so DST days (23/25 h) count as one day.\n */\nexport function fmtDayPrefix(ts: number, locale: string, now: number = Date.now()): string {\n const day = new Date(ts).setHours(0, 0, 0, 0);\n const today = new Date(now).setHours(0, 0, 0, 0);\n if (day >= today) return '';\n const y = new Date(today);\n y.setDate(y.getDate() - 1);\n if (day === y.getTime()) return new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(-1, 'day');\n return new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'numeric' }).format(ts);\n}\n\n/** HH:MM:SS. */\nexport function fmtTimeSec(ts: number, locale: string): string {\n return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit', second: '2-digit' }).format(ts);\n}\n\n/** \"Mon 8 Sep\" style day label. */\nexport function fmtDay(ts: number, locale: string): string {\n return new Intl.DateTimeFormat(locale, { weekday: 'short', day: 'numeric', month: 'short' }).format(ts);\n}\n\n/** Month + year for a date-picker header. */\nexport function fmtMonthYear(ts: number, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(ts);\n}\n\n/** Weekday short names (Monday first) for a date-picker grid. */\nexport function weekdayShorts(locale: string): string[] {\n const f = new Intl.DateTimeFormat(locale, { weekday: 'short' });\n // 2024-01-01 is a Monday.\n return Array.from({ length: 7 }, (_, i) => f.format(new Date(2024, 0, 1 + i)));\n}\n\n/** HH:MM string for a <input type=\"time\">. */\nexport function hhmmInput(ts: number): string {\n const d = new Date(ts);\n return `${pad(d.getHours())}:${pad(d.getMinutes())}`;\n}\n"],"mappings":";AAgBO,IAAM,yBAAwD;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA+BO,SAAS,uBACd,KACwB;AACxB,MAAI,CAAC,IAAI,UAAW,QAAO;AAC3B,MAAI,IAAI,QAAS,QAAO;AACxB,SAAO,IAAI,SAAS,OAAO;AAC7B;AA8EO,IAAM,kBAAkB,KAAK,KAAK,KAAK;AAOvC,IAAM,yBAAyB;AAqB/B,SAAS,mBAAmB,OAAwD;AACzF,QAAM,OAAO,SAAS,IAAI,KAAK;AAC/B,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,aAAa,gBAAgB,KAAK,GAAG,IAAI,MAAM,WAAW,GAAG;AACnE,MAAI;AACJ,MAAI;AACF,QAAI,IAAI,IAAI,UAAU;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,CAAC,EAAE,SAAU,QAAO;AACxB,QAAM,QAAQ,EAAE,aAAa,IAAI,OAAO;AACxC,QAAM,KAAK,EAAE,SAAS,QAAQ,YAAY;AAC1C,QAAM,SAAS,KAAK,IAAI,EAAE,SAAS,MAAM,GAAG,EAAE,EAAE,QAAQ,QAAQ,EAAE,IAAI;AACtE,SAAO,EAAE,QAAQ,EAAE,QAAQ,OAAO,SAAS,MAAM,KAAK,IAAI,MAAM,KAAK,IAAI,MAAM,OAAO;AACxF;AAGO,SAAS,mBAAmB,QAAgB,SAAS,IAAY;AACtE,SAAO,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC,GAAG,OAAO,QAA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"./chunk-CNXMCQJ3.js";
|
|
4
4
|
|
|
5
5
|
// src/player/rlog.ts
|
|
6
6
|
var brand = "web";
|
|
@@ -2640,4 +2640,4 @@ export {
|
|
|
2640
2640
|
settleStep,
|
|
2641
2641
|
PlayerController
|
|
2642
2642
|
};
|
|
2643
|
-
//# sourceMappingURL=chunk-
|
|
2643
|
+
//# sourceMappingURL=chunk-RJXSSHIR.js.map
|
|
@@ -16,6 +16,11 @@ interface SentinelCamera {
|
|
|
16
16
|
name: string;
|
|
17
17
|
recording: boolean;
|
|
18
18
|
online: boolean;
|
|
19
|
+
/** plugin ≥ 2026-10-05: recording watchdog — ffmpeg ran ≥ 3 min without a new segment and is being restarted; stays set
|
|
20
|
+
* (also while the restart is pending, `online` false) until a segment arrives again. */
|
|
21
|
+
stalled?: boolean;
|
|
22
|
+
/** plugin ≥ 2026-10-05: since when nothing was recorded (ms) */
|
|
23
|
+
stalledSince?: number;
|
|
19
24
|
lastSegmentAt?: number;
|
|
20
25
|
eventsToday: number;
|
|
21
26
|
lastEventTs?: number;
|
|
@@ -24,9 +29,17 @@ interface SentinelCamera {
|
|
|
24
29
|
/** RFC-6381 codec string of the recordings (MSE). */
|
|
25
30
|
codecs?: string;
|
|
26
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Recording state of a camera tile: `off` = recording switched off, `stalled` = recording hangs (watchdog, outranks
|
|
34
|
+
* `offline`: during the restart after a stall ffmpeg is briefly down), `offline` = ffmpeg not running (camera
|
|
35
|
+
* unreachable), `ok` = recording.
|
|
36
|
+
*/
|
|
37
|
+
type SentinelRecordingState = 'off' | 'stalled' | 'offline' | 'ok';
|
|
38
|
+
declare function sentinelRecordingState(cam: Pick<SentinelCamera, 'recording' | 'online' | 'stalled'>): SentinelRecordingState;
|
|
27
39
|
/** `api/stats`. */
|
|
28
40
|
interface SentinelStats {
|
|
29
41
|
cameras: number;
|
|
42
|
+
/** cameras recording right now (plugin ≥ 2026-10-05; before: cameras with recording switched on) */
|
|
30
43
|
recording: number;
|
|
31
44
|
eventsToday: number;
|
|
32
45
|
segments: number;
|
|
@@ -316,4 +329,4 @@ declare function exchangeSentinelToken(origin: string, username: string, passwor
|
|
|
316
329
|
/** AbortSignal that fires after `ms` (undefined on engines without AbortSignal.timeout — Safari < 16). */
|
|
317
330
|
declare function timeoutSignal(ms: number): AbortSignal | undefined;
|
|
318
331
|
|
|
319
|
-
export {
|
|
332
|
+
export { sentinelClipIndexFor as A, sentinelClipRuns as B, sentinelDayEnd as C, sentinelDayOf as D, sentinelDuration as E, sentinelEntryUrl as F, sentinelEventHidden as G, sentinelEventPlayTs as H, sentinelEventSpan as I, sentinelHumanBytes as J, sentinelLoginBase as K, sentinelMergeDays as L, sentinelPublicBase as M, sentinelRecordingState as N, sentinelStorageForecast as O, sentinelTimelineLink as P, sentinelUrl as Q, sentinelWallMarks as R, SENTINEL_CLASS_PRIORITY as S, sentinelWallSeconds as T, timeoutSignal as U, SENTINEL_DAY_MS as a, SENTINEL_ENDPOINT_PATH as b, SENTINEL_EVENT_CLASSES as c, SENTINEL_MIN_SPAN_MS as d, type SentinelBox as e, type SentinelCamera as f, SentinelClient as g, type SentinelClip as h, type SentinelClipsResponse as i, type SentinelEvent as j, type SentinelEventBox as k, type SentinelEventClass as l, SentinelHttpError as m, type SentinelRecentEvent as n, type SentinelRecordingState as o, type SentinelRun as p, type SentinelSetup as q, type SentinelStats as r, type SentinelStorageForecast as s, type SentinelStorageStatus as t, exchangeSentinelToken as u, parseSentinelSetup as v, sentinelAddDays as w, sentinelAtTime as x, sentinelClassOf as y, sentinelClassesOf as z };
|
package/dist/player/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { P as PipResult, a as PlayerController, b as PlayerLabel, c as PlayerOptions, d as PlayerRefs, e as PlayerState } from '../controller-
|
|
2
|
-
import { g as SentinelClient } from '../client-
|
|
1
|
+
export { P as PipResult, a as PlayerController, b as PlayerLabel, c as PlayerOptions, d as PlayerRefs, e as PlayerState } from '../controller-DE4xqYEU.js';
|
|
2
|
+
import { g as SentinelClient } from '../client-C-tpCEsf.js';
|
|
3
3
|
|
|
4
4
|
/** Recorded playback runs ~17 s behind real time (fragment flush + relay); a forward jump closer to "now" than this has no
|
|
5
5
|
* recording to land on yet. */
|
package/dist/player/index.js
CHANGED
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { g as SentinelClient, l as SentinelEventClass, n as SentinelRecentEvent, f as SentinelCamera, j as SentinelEvent,
|
|
4
|
-
import { e as PlayerState } from '../controller-
|
|
3
|
+
import { g as SentinelClient, l as SentinelEventClass, n as SentinelRecentEvent, f as SentinelCamera, j as SentinelEvent, r as SentinelStats, h as SentinelClip } from '../client-C-tpCEsf.js';
|
|
4
|
+
import { e as PlayerState } from '../controller-DE4xqYEU.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Minimal translation core with the same dictionary semantics as HAPulse:
|
package/dist/ui/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PlayerController,
|
|
3
3
|
rlog
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-RJXSSHIR.js";
|
|
5
5
|
import {
|
|
6
6
|
SENTINEL_CLASS_PRIORITY,
|
|
7
7
|
SENTINEL_DAY_MS,
|
|
8
8
|
SENTINEL_EVENT_CLASSES,
|
|
9
9
|
fmtDay,
|
|
10
|
+
fmtDayPrefix,
|
|
10
11
|
fmtMonthYear,
|
|
11
12
|
fmtTime,
|
|
12
13
|
fmtTimeSec,
|
|
@@ -25,11 +26,12 @@ import {
|
|
|
25
26
|
sentinelEventSpan,
|
|
26
27
|
sentinelHumanBytes,
|
|
27
28
|
sentinelMergeDays,
|
|
29
|
+
sentinelRecordingState,
|
|
28
30
|
sentinelStorageForecast,
|
|
29
31
|
sentinelWallMarks,
|
|
30
32
|
sentinelWallSeconds,
|
|
31
33
|
weekdayShorts
|
|
32
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-CNXMCQJ3.js";
|
|
33
35
|
|
|
34
36
|
// src/ui/context.tsx
|
|
35
37
|
import { createContext, useContext } from "react";
|
|
@@ -462,35 +464,46 @@ function EventBadges({ ev, size, t }) {
|
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
// src/ui/components/EventsStrip.tsx
|
|
465
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
467
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
466
468
|
function EventsStrip({ events }) {
|
|
467
469
|
const { client, t, locale, nav } = useSentinelUi();
|
|
468
470
|
if (!events.length) return null;
|
|
471
|
+
const now = Date.now();
|
|
469
472
|
return /* @__PURE__ */ jsxs("section", { className: "nvr-section", children: [
|
|
470
473
|
/* @__PURE__ */ jsx3("h2", { className: "nvr-section__label", children: t("nvr.events.title") }),
|
|
471
|
-
/* @__PURE__ */ jsx3("ul", { className: "nvr-strip", children: events.map((e) =>
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
474
|
+
/* @__PURE__ */ jsx3("ul", { className: "nvr-strip", children: events.map((e) => {
|
|
475
|
+
const day = fmtDayPrefix(e.ts, locale, now);
|
|
476
|
+
const time = fmtTime(e.ts, locale);
|
|
477
|
+
return /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsxs(
|
|
478
|
+
"button",
|
|
479
|
+
{
|
|
480
|
+
type: "button",
|
|
481
|
+
className: "nvr-strip__item",
|
|
482
|
+
onClick: () => nav.openCamera(e.camera, sentinelEventPlayTs(e), e.ts),
|
|
483
|
+
"aria-label": `${eventLabel(t, e)} \xB7 ${e.cameraName} \xB7 ${day ? `${day} ${time}` : time}`,
|
|
484
|
+
title: e.cameraName,
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ jsxs("span", { className: "nvr-strip__img", children: [
|
|
487
|
+
/* @__PURE__ */ jsx3("img", { src: client.eventThumbUrl(e.camera, e.ts), alt: "", loading: "lazy" }),
|
|
488
|
+
/* @__PURE__ */ jsx3("span", { className: "nvr-strip__badges", children: /* @__PURE__ */ jsx3(EventBadges, { ev: e, t }) })
|
|
489
|
+
] }),
|
|
490
|
+
/* @__PURE__ */ jsxs("span", { className: "nvr-strip__time nvr-data", children: [
|
|
491
|
+
day && /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
492
|
+
/* @__PURE__ */ jsx3("span", { className: "nvr-strip__day", children: day }),
|
|
493
|
+
" "
|
|
494
|
+
] }),
|
|
495
|
+
/* @__PURE__ */ jsx3("span", { className: "nvr-strip__clock", children: time })
|
|
496
|
+
] })
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
) }, `${e.camera}-${e.ts}`);
|
|
500
|
+
}) })
|
|
488
501
|
] });
|
|
489
502
|
}
|
|
490
503
|
|
|
491
504
|
// src/ui/components/CameraGrid.tsx
|
|
492
505
|
import { useEffect, useState } from "react";
|
|
493
|
-
import { Camera, WifiOff } from "lucide-react";
|
|
506
|
+
import { Camera, VideoOff, WifiOff } from "lucide-react";
|
|
494
507
|
|
|
495
508
|
// src/ui/snapshot-cache.ts
|
|
496
509
|
var last = /* @__PURE__ */ new Map();
|
|
@@ -519,6 +532,7 @@ function CameraTile({ cam, tick, n }) {
|
|
|
519
532
|
}, [n]);
|
|
520
533
|
const src = failed === 0 ? client.snapshotUrl(cam.id, tick, tileSnapshotWidth()) : failed === 1 && cam.latestThumbId ? client.segmentThumbUrl(cam.latestThumbId) : null;
|
|
521
534
|
const open = () => nav.openCamera(cam.id);
|
|
535
|
+
const rec = sentinelRecordingState(cam);
|
|
522
536
|
const meta = [
|
|
523
537
|
t("nvr.cameras.eventsToday", { count: cam.eventsToday }),
|
|
524
538
|
cam.lastEventTs ? fmtRelative(cam.lastEventTs, t) : null
|
|
@@ -526,7 +540,7 @@ function CameraTile({ cam, tick, n }) {
|
|
|
526
540
|
return /* @__PURE__ */ jsxs2(
|
|
527
541
|
"div",
|
|
528
542
|
{
|
|
529
|
-
className:
|
|
543
|
+
className: `nvr-card nvr-camtile${rec === "offline" || rec === "stalled" ? " nvr-camtile--badged" : ""}`,
|
|
530
544
|
role: "button",
|
|
531
545
|
tabIndex: 0,
|
|
532
546
|
onClick: open,
|
|
@@ -551,12 +565,17 @@ function CameraTile({ cam, tick, n }) {
|
|
|
551
565
|
) : /* @__PURE__ */ jsx4("div", { className: "nvr-camtile__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(Camera, { size: 32, strokeWidth: 1.5 }) }),
|
|
552
566
|
/* @__PURE__ */ jsxs2("span", { className: "nvr-camtile__name", children: [
|
|
553
567
|
cam.name,
|
|
554
|
-
cam.recording && /* @__PURE__ */ jsx4("i", { className: `nvr-camtile__dot${
|
|
568
|
+
cam.recording && /* @__PURE__ */ jsx4("i", { className: `nvr-camtile__dot${rec === "ok" ? "" : " nvr-camtile__dot--off"}`, "aria-hidden": "true" })
|
|
555
569
|
] }),
|
|
556
|
-
|
|
570
|
+
rec === "offline" && /* @__PURE__ */ jsxs2("span", { className: "nvr-camtile__offline", children: [
|
|
557
571
|
/* @__PURE__ */ jsx4(WifiOff, { size: 12, strokeWidth: 2.25 }),
|
|
558
572
|
t("nvr.cameras.offline")
|
|
559
573
|
] }),
|
|
574
|
+
rec === "stalled" && // ffmpeg runs (or restarts) but writes nothing — the server's watchdog restarts it
|
|
575
|
+
/* @__PURE__ */ jsxs2("span", { className: "nvr-camtile__offline", title: t("nvr.cameras.stalledHint"), children: [
|
|
576
|
+
/* @__PURE__ */ jsx4(VideoOff, { size: 12, strokeWidth: 2.25 }),
|
|
577
|
+
t("nvr.cameras.stalled")
|
|
578
|
+
] }),
|
|
560
579
|
/* @__PURE__ */ jsx4("span", { className: "nvr-camtile__meta nvr-data", children: meta })
|
|
561
580
|
]
|
|
562
581
|
}
|
|
@@ -605,8 +624,8 @@ function outsideAppHref(url, env = {
|
|
|
605
624
|
}
|
|
606
625
|
|
|
607
626
|
// src/ui/components/EventList.tsx
|
|
608
|
-
import { Fragment as
|
|
609
|
-
import { Fragment as
|
|
627
|
+
import { Fragment as Fragment3 } from "react";
|
|
628
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
610
629
|
function EventList({
|
|
611
630
|
camId,
|
|
612
631
|
events,
|
|
@@ -621,7 +640,7 @@ function EventList({
|
|
|
621
640
|
const d = new Date(ev.timestamp).toDateString();
|
|
622
641
|
const head = d !== lastDay;
|
|
623
642
|
lastDay = d;
|
|
624
|
-
return /* @__PURE__ */ jsxs3(
|
|
643
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
625
644
|
head && /* @__PURE__ */ jsx5("div", { className: "nvr-evlist__day nvr-data", children: fmtDay(ev.timestamp, locale) }),
|
|
626
645
|
/* @__PURE__ */ jsxs3("button", { type: "button", className: "nvr-evrow", onClick: () => onPick(ev), children: [
|
|
627
646
|
/* @__PURE__ */ jsx5("img", { className: "nvr-evrow__img", src: client.eventThumbUrl(camId, ev.timestamp), alt: "", loading: "lazy" }),
|
|
@@ -646,7 +665,7 @@ function EventSpanNote({ ev, t }) {
|
|
|
646
665
|
return sp.open ? /* @__PURE__ */ jsxs3("span", { className: "nvr-evrow__open", children: [
|
|
647
666
|
" \xB7 ",
|
|
648
667
|
t("nvr.events.running")
|
|
649
|
-
] }) : /* @__PURE__ */ jsxs3(
|
|
668
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
650
669
|
" \xB7 ",
|
|
651
670
|
sentinelDuration(sp.end - sp.start)
|
|
652
671
|
] });
|
|
@@ -655,7 +674,7 @@ function EventSpanNote({ ev, t }) {
|
|
|
655
674
|
// src/ui/components/DatePickerPanel.tsx
|
|
656
675
|
import { useState as useState2 } from "react";
|
|
657
676
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
658
|
-
import { Fragment as
|
|
677
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
659
678
|
function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
660
679
|
const { t, locale } = useSentinelUi();
|
|
661
680
|
const base = new Date(dayStart);
|
|
@@ -686,7 +705,7 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
686
705
|
setView(new Date(n.getFullYear(), n.getMonth(), 1));
|
|
687
706
|
setSel(new Date(n.getFullYear(), n.getMonth(), n.getDate()));
|
|
688
707
|
};
|
|
689
|
-
const grid = /* @__PURE__ */ jsxs4(
|
|
708
|
+
const grid = /* @__PURE__ */ jsxs4(Fragment5, { children: [
|
|
690
709
|
/* @__PURE__ */ jsxs4("div", { className: "nvr-dt__head", children: [
|
|
691
710
|
/* @__PURE__ */ jsx6(
|
|
692
711
|
"button",
|
|
@@ -794,8 +813,13 @@ function CardTitle({
|
|
|
794
813
|
}
|
|
795
814
|
function Hero({ cameras, stats }) {
|
|
796
815
|
const { t, locale } = useSentinelUi();
|
|
797
|
-
const
|
|
816
|
+
const stalled = cameras.filter((c) => sentinelRecordingState(c) === "stalled").length;
|
|
817
|
+
const online = cameras.filter((c) => c.online || sentinelRecordingState(c) === "stalled").length;
|
|
798
818
|
const offline = Math.max(0, stats.cameras - online);
|
|
819
|
+
const problems = [
|
|
820
|
+
offline > 0 ? t("nvr.hero.offline", { count: offline }) : null,
|
|
821
|
+
stalled > 0 ? t("nvr.hero.stalled", { count: stalled }) : null
|
|
822
|
+
].filter(Boolean);
|
|
799
823
|
const fc = sentinelStorageForecast(stats);
|
|
800
824
|
const bytes = sentinelHumanBytes(stats.bytes, locale);
|
|
801
825
|
const span = fc.spanDays ? fmtDays(fc.spanDays, t).split(" ") : ["\u2013"];
|
|
@@ -808,9 +832,9 @@ function Hero({ cameras, stats }) {
|
|
|
808
832
|
/* @__PURE__ */ jsx7("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
809
833
|
t("nvr.hero.storageProblem")
|
|
810
834
|
] })
|
|
811
|
-
) : /* @__PURE__ */ jsxs5("span", { className: `nvr-pill ${
|
|
835
|
+
) : /* @__PURE__ */ jsxs5("span", { className: `nvr-pill ${problems.length ? "nvr-pill--danger" : "nvr-pill--positive"}`, children: [
|
|
812
836
|
/* @__PURE__ */ jsx7("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
813
|
-
|
|
837
|
+
problems.length ? problems.join(" \xB7 ") : t("nvr.hero.allOnline")
|
|
814
838
|
] })
|
|
815
839
|
] }),
|
|
816
840
|
/* @__PURE__ */ jsxs5("div", { className: "nvr-hero__primary", children: [
|
|
@@ -1034,7 +1058,7 @@ function groupCountLabel(n) {
|
|
|
1034
1058
|
}
|
|
1035
1059
|
|
|
1036
1060
|
// src/ui/components/VerticalTimeline.tsx
|
|
1037
|
-
import { Fragment as
|
|
1061
|
+
import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1038
1062
|
function VerticalTimeline(p) {
|
|
1039
1063
|
const { client, t, locale } = useSentinelUi();
|
|
1040
1064
|
const hhmm = (ts) => fmtTime(ts, locale), hhmmss = (ts) => fmtTimeSec(ts, locale), dayLbl = (ts) => fmtDay(ts, locale);
|
|
@@ -1424,7 +1448,7 @@ function VerticalTimeline(p) {
|
|
|
1424
1448
|
title: hhmmss(sentinelEventPlayTs(ev))
|
|
1425
1449
|
}
|
|
1426
1450
|
),
|
|
1427
|
-
thumb && /* @__PURE__ */ jsxs6(
|
|
1451
|
+
thumb && /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
1428
1452
|
/* @__PURE__ */ jsxs6("div", { className: "vlink", style: { top: y }, children: [
|
|
1429
1453
|
/* @__PURE__ */ jsx8("span", { className: "vlink-badges", children: /* @__PURE__ */ jsx8(EventBadges, { ev, t }) }),
|
|
1430
1454
|
/* @__PURE__ */ jsx8("i", {})
|
|
@@ -1436,7 +1460,7 @@ function VerticalTimeline(p) {
|
|
|
1436
1460
|
] })
|
|
1437
1461
|
] }, ev.id);
|
|
1438
1462
|
}),
|
|
1439
|
-
inWin(now) && /* @__PURE__ */ jsxs6(
|
|
1463
|
+
inWin(now) && /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
1440
1464
|
/* @__PURE__ */ jsx8("div", { className: "vlive-line", style: { top: yFor(now) } }),
|
|
1441
1465
|
/* @__PURE__ */ jsx8("button", { className: "vlive-chip", style: { top: yFor(now) }, onClick: p.onGoLive, children: t("nvr.live") })
|
|
1442
1466
|
] })
|