@7365admin1/layer-common 4.15.3-staging.327 → 4.15.3-staging.328
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/components/CameraWallTile.vue +13 -4
- package/package.json +1 -1
- package/utils/camera-wall.ts +30 -0
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
>
|
|
27
27
|
<iframe
|
|
28
28
|
ref="frameEl"
|
|
29
|
-
:key="
|
|
30
|
-
:src="
|
|
29
|
+
:key="liveSrc"
|
|
30
|
+
:src="liveSrc"
|
|
31
31
|
class="vms-tile__frame"
|
|
32
32
|
:title="`Live view of ${camera.name || 'camera'}`"
|
|
33
33
|
allowfullscreen
|
|
@@ -154,6 +154,7 @@ import {
|
|
|
154
154
|
clampPan,
|
|
155
155
|
clampZoom,
|
|
156
156
|
healthView,
|
|
157
|
+
liveSource,
|
|
157
158
|
LIVE_CONNECT_TIMEOUT_MS,
|
|
158
159
|
LIVE_FRAME_TIMEOUT_MS,
|
|
159
160
|
playerOrigin,
|
|
@@ -222,6 +223,14 @@ const view = computed(() =>
|
|
|
222
223
|
tileView(props.camera, { online: props.online, player: player.value })
|
|
223
224
|
);
|
|
224
225
|
|
|
226
|
+
/**
|
|
227
|
+
* The address this tile is showing — the server's signed one when there is one,
|
|
228
|
+
* the stored one otherwise. Taken verbatim: `src`, the remount key, the origin
|
|
229
|
+
* a player message must come from and the reload watch all read THIS, so they
|
|
230
|
+
* cannot drift apart and start disagreeing about which address is on screen.
|
|
231
|
+
*/
|
|
232
|
+
const liveSrc = computed(() => liveSource(props.camera));
|
|
233
|
+
|
|
225
234
|
/* ------------------------------------------------------------------ health */
|
|
226
235
|
|
|
227
236
|
const recorder = computed(() => healthView(props.health, props.now || Date.now()));
|
|
@@ -389,7 +398,7 @@ function onPlayerError() {
|
|
|
389
398
|
* understand must never be able to turn a badge green.
|
|
390
399
|
*/
|
|
391
400
|
function onPlayerMessage(event: MessageEvent) {
|
|
392
|
-
const origin = playerOrigin(
|
|
401
|
+
const origin = playerOrigin(liveSrc.value);
|
|
393
402
|
if (!origin || event.origin !== origin) return;
|
|
394
403
|
if (frameEl.value && event.source !== frameEl.value.contentWindow) return;
|
|
395
404
|
|
|
@@ -441,7 +450,7 @@ function restartFrameClock() {
|
|
|
441
450
|
* evidence, is the same mistake as declaring it live on a timer.
|
|
442
451
|
*/
|
|
443
452
|
watch(
|
|
444
|
-
() =>
|
|
453
|
+
() => liveSrc.value,
|
|
445
454
|
(host) => {
|
|
446
455
|
clearTimer();
|
|
447
456
|
clearFrameTimer();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.15.3-staging.
|
|
5
|
+
"version": "4.15.3-staging.328",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/camera-wall.ts
CHANGED
|
@@ -59,6 +59,20 @@ export type TWallCamera = {
|
|
|
59
59
|
* renderable live-video page — it is the picture, not a fragment to resolve.
|
|
60
60
|
*/
|
|
61
61
|
host?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The SIGNED live address, when the server has one for this camera.
|
|
64
|
+
*
|
|
65
|
+
* The relay's live routes are being closed behind a signature the server
|
|
66
|
+
* mints per request (`exp` + `sig`, covering the channel). That signature
|
|
67
|
+
* cannot live on `host`: `host` is the stored record, copied into patrol
|
|
68
|
+
* routes and re-read by the server's own `isRelayPlayerUrl`, which rejects an
|
|
69
|
+
* address carrying a query. So the server hands the signed address over
|
|
70
|
+
* beside it, and leaves `host` exactly as it always was.
|
|
71
|
+
*
|
|
72
|
+
* Absent for a camera whose relay is not configured — and then the wall falls
|
|
73
|
+
* back to `host` and behaves precisely as it does today.
|
|
74
|
+
*/
|
|
75
|
+
liveUrl?: string | null;
|
|
62
76
|
type?: string;
|
|
63
77
|
status?: string;
|
|
64
78
|
capabilities?: Record<string, TWallCapability>;
|
|
@@ -714,6 +728,22 @@ export function playerSignal(data: unknown): TPlayerSignal {
|
|
|
714
728
|
* that is not a URL at all. Kept here so the rule is tested rather than
|
|
715
729
|
* inlined in a component.
|
|
716
730
|
*/
|
|
731
|
+
/**
|
|
732
|
+
* The address the player is actually pointed at.
|
|
733
|
+
*
|
|
734
|
+
* `liveUrl` is the server's signed address and wins whenever it is there;
|
|
735
|
+
* `host` is the unsigned stored one and is what every camera used before
|
|
736
|
+
* signing existed. Never rebuilt, never re-encoded, never stripped of its
|
|
737
|
+
* query — a signature dropped here is a camera that goes black the day the
|
|
738
|
+
* relay starts enforcing, with nothing on screen to say why.
|
|
739
|
+
*/
|
|
740
|
+
export function liveSource(
|
|
741
|
+
camera: Pick<TWallCamera, "host" | "liveUrl"> | null | undefined
|
|
742
|
+
): string {
|
|
743
|
+
const signed = typeof camera?.liveUrl === "string" ? camera.liveUrl.trim() : "";
|
|
744
|
+
return signed || camera?.host || "";
|
|
745
|
+
}
|
|
746
|
+
|
|
717
747
|
export function playerOrigin(host: string | null | undefined): string {
|
|
718
748
|
if (!host) return "";
|
|
719
749
|
try {
|