@norskvideo/ctl-sdk 0.1.10 → 0.1.11
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.
|
@@ -13,6 +13,11 @@ export declare function hideReasonLabel(reason: HideReason): string;
|
|
|
13
13
|
* (`location.origin`) yields a plausible-but-unreachable URL that 404s in the
|
|
14
14
|
* container; refuse it (`null`) rather than emit that. Absolute inputs pass
|
|
15
15
|
* through untouched, so an operator-typed full URL is honoured as-is.
|
|
16
|
+
*
|
|
17
|
+
* `file://` is a first-class scheme here: overlay pages are shipped into the
|
|
18
|
+
* media container's shared `/data/.norsk` mount and handed to `input.browser`
|
|
19
|
+
* as `file:///data/.norsk/overlays/x.html` — a fixed container path, so no auth
|
|
20
|
+
* proxy, no network, and instance-independent.
|
|
16
21
|
*/
|
|
17
22
|
export declare function resolveGraphicUrl(url: string, base: string | undefined): string | null;
|
|
18
23
|
/**
|
|
@@ -37,18 +37,22 @@ export function hideReasonLabel(reason) {
|
|
|
37
37
|
* (`location.origin`) yields a plausible-but-unreachable URL that 404s in the
|
|
38
38
|
* container; refuse it (`null`) rather than emit that. Absolute inputs pass
|
|
39
39
|
* through untouched, so an operator-typed full URL is honoured as-is.
|
|
40
|
+
*
|
|
41
|
+
* `file://` is a first-class scheme here: overlay pages are shipped into the
|
|
42
|
+
* media container's shared `/data/.norsk` mount and handed to `input.browser`
|
|
43
|
+
* as `file:///data/.norsk/overlays/x.html` — a fixed container path, so no auth
|
|
44
|
+
* proxy, no network, and instance-independent.
|
|
40
45
|
*/
|
|
41
46
|
export function resolveGraphicUrl(url, base) {
|
|
42
|
-
if (/^https
|
|
47
|
+
if (/^(https?|file):\/\//i.test(url))
|
|
43
48
|
return url;
|
|
44
49
|
if (!base)
|
|
45
50
|
return null;
|
|
46
51
|
try {
|
|
47
52
|
const resolved = new URL(url, base);
|
|
48
|
-
// A relative path against a bare/relative base can still land on
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
return /^https?:$/i.test(resolved.protocol) ? resolved.toString() : null;
|
|
53
|
+
// A relative path against a bare/relative base can still land on an
|
|
54
|
+
// unreachable scheme — only http(s) and file: are safe to hand the engine.
|
|
55
|
+
return /^(https?|file):$/i.test(resolved.protocol) ? resolved.toString() : null;
|
|
52
56
|
}
|
|
53
57
|
catch {
|
|
54
58
|
return null;
|