@thestatic-tv/dcl-sdk 2.10.1 → 2.11.0
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 +28 -2
- package/dist/index.d.mts +94 -3
- package/dist/index.d.ts +94 -3
- package/dist/index.js +379 -24
- package/dist/index.mjs +379 -24
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1061,6 +1061,216 @@ var FramesModule = class {
|
|
|
1061
1061
|
}
|
|
1062
1062
|
};
|
|
1063
1063
|
|
|
1064
|
+
// src/modules/stream-link.ts
|
|
1065
|
+
var LOCKED_LINE = "LOCKED: TheStatic.tv citizens";
|
|
1066
|
+
var UNAVAILABLE_LINE = "Stream link unavailable";
|
|
1067
|
+
var REASK_BEFORE_MS = 10 * 60 * 1e3;
|
|
1068
|
+
var REASK_CHECK_MS = 15 * 1e3;
|
|
1069
|
+
var REASK_RETRY_MS = 60 * 1e3;
|
|
1070
|
+
var CHANNEL_MAX = 100;
|
|
1071
|
+
function channelOf(value) {
|
|
1072
|
+
return typeof value === "string" && value !== "" && value.length <= CHANNEL_MAX ? value : null;
|
|
1073
|
+
}
|
|
1074
|
+
var StreamLinkModule = class {
|
|
1075
|
+
constructor(deps) {
|
|
1076
|
+
this.inFlight = /* @__PURE__ */ new Map();
|
|
1077
|
+
this.current = null;
|
|
1078
|
+
this.gen = 0;
|
|
1079
|
+
this.timerId = null;
|
|
1080
|
+
this.deps = deps;
|
|
1081
|
+
}
|
|
1082
|
+
now() {
|
|
1083
|
+
return this.deps.now ? this.deps.now() : Date.now();
|
|
1084
|
+
}
|
|
1085
|
+
log(msg, ...args) {
|
|
1086
|
+
this.deps.log?.(msg, ...args);
|
|
1087
|
+
}
|
|
1088
|
+
/** The channel of the locked play going on, or null */
|
|
1089
|
+
get playing() {
|
|
1090
|
+
return this.current ? this.current.channel : null;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Ask the door for a channel's link, signed as the visitor. One request in flight per channel: an ask while one is
|
|
1094
|
+
* out gets the same answer. A blocked visitor gets 'blocked' and nothing is sent.
|
|
1095
|
+
*/
|
|
1096
|
+
ask(channel) {
|
|
1097
|
+
if (this.deps.blocked()) return Promise.resolve({ ok: false, reason: "blocked" });
|
|
1098
|
+
const pending = this.inFlight.get(channel);
|
|
1099
|
+
if (pending) return pending;
|
|
1100
|
+
const request2 = this.request(channel).finally(() => {
|
|
1101
|
+
this.inFlight.delete(channel);
|
|
1102
|
+
});
|
|
1103
|
+
this.inFlight.set(channel, request2);
|
|
1104
|
+
return request2;
|
|
1105
|
+
}
|
|
1106
|
+
async request(channel) {
|
|
1107
|
+
const url = this.deps.doorUrl();
|
|
1108
|
+
if (!url) {
|
|
1109
|
+
this.log("Stream link: no scene id - cannot ask");
|
|
1110
|
+
return { ok: false, reason: "unavailable" };
|
|
1111
|
+
}
|
|
1112
|
+
try {
|
|
1113
|
+
const res = await this.deps.post(url, JSON.stringify({ channel }));
|
|
1114
|
+
let data = {};
|
|
1115
|
+
try {
|
|
1116
|
+
data = await res.json();
|
|
1117
|
+
} catch {
|
|
1118
|
+
}
|
|
1119
|
+
if (res.ok) {
|
|
1120
|
+
const link = data && typeof data.url === "string" ? data.url : "";
|
|
1121
|
+
const expiresAt = data && typeof data.expiresAt === "number" && Number.isFinite(data.expiresAt) ? data.expiresAt : null;
|
|
1122
|
+
if (!link.startsWith("https://")) {
|
|
1123
|
+
this.log("Stream link: an answer with no https url", res.status);
|
|
1124
|
+
return { ok: false, reason: "unavailable", status: res.status };
|
|
1125
|
+
}
|
|
1126
|
+
return { ok: true, url: link, expiresAt };
|
|
1127
|
+
}
|
|
1128
|
+
if (res.status === 403) {
|
|
1129
|
+
return { ok: false, reason: data?.reason === "guest" ? "guest" : "not-admitted", status: 403 };
|
|
1130
|
+
}
|
|
1131
|
+
this.log("Stream link: the door answered", res.status, data?.error);
|
|
1132
|
+
return { ok: false, reason: "unavailable", status: res.status };
|
|
1133
|
+
} catch (err) {
|
|
1134
|
+
this.log("Stream link: request failed", err);
|
|
1135
|
+
return { ok: false, reason: "unavailable" };
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Play a locked channel: ask for its link and hand it to deliver, then keep it fresh while this play goes on. Ends
|
|
1140
|
+
* any locked play before it. A blocked visitor asks nothing; an invalid channel plays nothing.
|
|
1141
|
+
*/
|
|
1142
|
+
play(channel, handlers) {
|
|
1143
|
+
this.cancel();
|
|
1144
|
+
const slug = channelOf(channel);
|
|
1145
|
+
if (!slug) {
|
|
1146
|
+
this.log("Stream link: a locked play names no channel - nothing plays");
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
if (this.deps.blocked()) return;
|
|
1150
|
+
const gen = ++this.gen;
|
|
1151
|
+
this.current = { gen, channel: slug, handlers, url: null, nextAskAt: null, lastAskAt: this.now(), asking: true };
|
|
1152
|
+
this.ask(slug).then((answer) => this.first(gen, answer)).catch(() => {
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
/** The first answer for play gen: the link plays, or the notice says why not */
|
|
1156
|
+
first(gen, answer) {
|
|
1157
|
+
const play = this.current;
|
|
1158
|
+
if (!play || play.gen !== gen) return;
|
|
1159
|
+
play.asking = false;
|
|
1160
|
+
if (answer.ok && !this.deps.blocked()) {
|
|
1161
|
+
this.deliver(play, answer.url, answer.expiresAt);
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
this.end();
|
|
1165
|
+
if (!answer.ok && answer.reason !== "blocked") this.fail(play, answer.reason);
|
|
1166
|
+
}
|
|
1167
|
+
/** A re-ask's answer: a new link plays in place of the old; a refusal stops the play; a failure tries again later */
|
|
1168
|
+
again(gen, answer) {
|
|
1169
|
+
const play = this.current;
|
|
1170
|
+
if (!play || play.gen !== gen) return;
|
|
1171
|
+
play.asking = false;
|
|
1172
|
+
if (this.deps.blocked()) {
|
|
1173
|
+
this.cancel();
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (answer.ok) {
|
|
1177
|
+
this.deliver(play, answer.url, answer.expiresAt);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
if (answer.reason === "guest" || answer.reason === "not-admitted") {
|
|
1181
|
+
this.log("Stream link: the re-ask was refused - stopping", play.channel);
|
|
1182
|
+
this.end();
|
|
1183
|
+
this.fail(play, answer.reason);
|
|
1184
|
+
try {
|
|
1185
|
+
play.handlers.stop?.();
|
|
1186
|
+
} catch (err) {
|
|
1187
|
+
this.log("Stream link: stop failed", err);
|
|
1188
|
+
}
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
play.nextAskAt = this.now() + REASK_RETRY_MS;
|
|
1192
|
+
}
|
|
1193
|
+
deliver(play, url, expiresAt) {
|
|
1194
|
+
const switched = url !== play.url;
|
|
1195
|
+
play.url = url;
|
|
1196
|
+
if (expiresAt === null) {
|
|
1197
|
+
play.nextAskAt = null;
|
|
1198
|
+
this.stopTimer();
|
|
1199
|
+
} else {
|
|
1200
|
+
play.nextAskAt = Math.max(play.lastAskAt + REASK_RETRY_MS, expiresAt * 1e3 - REASK_BEFORE_MS);
|
|
1201
|
+
this.startTimer();
|
|
1202
|
+
}
|
|
1203
|
+
if (!switched) return;
|
|
1204
|
+
try {
|
|
1205
|
+
play.handlers.deliver(url);
|
|
1206
|
+
} catch (err) {
|
|
1207
|
+
this.log("Stream link: deliver failed", err);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
fail(play, reason) {
|
|
1211
|
+
const line = reason === "guest" || reason === "not-admitted" ? LOCKED_LINE : UNAVAILABLE_LINE;
|
|
1212
|
+
this.deps.notify(line);
|
|
1213
|
+
try {
|
|
1214
|
+
play.handlers.failed?.(line);
|
|
1215
|
+
} catch (err) {
|
|
1216
|
+
this.log("Stream link: failed handler threw", err);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
/** Something played: a url other than this play's own link ends the locked play (the play changed) */
|
|
1220
|
+
playChanged(url) {
|
|
1221
|
+
if (this.current && url !== this.current.url) this.cancel();
|
|
1222
|
+
}
|
|
1223
|
+
/** Ends the locked play, if any: no re-ask, and an answer still on its way is dropped */
|
|
1224
|
+
cancel() {
|
|
1225
|
+
if (!this.current) return;
|
|
1226
|
+
this.log("Stream link: locked play ended", this.current.channel);
|
|
1227
|
+
this.end();
|
|
1228
|
+
}
|
|
1229
|
+
end() {
|
|
1230
|
+
this.current = null;
|
|
1231
|
+
this.stopTimer();
|
|
1232
|
+
}
|
|
1233
|
+
startTimer() {
|
|
1234
|
+
if (this.timerId !== null) return;
|
|
1235
|
+
this.timerId = this.deps.setInterval(() => this.tick(), REASK_CHECK_MS);
|
|
1236
|
+
}
|
|
1237
|
+
stopTimer() {
|
|
1238
|
+
if (this.timerId === null) return;
|
|
1239
|
+
this.deps.clearInterval(this.timerId);
|
|
1240
|
+
this.timerId = null;
|
|
1241
|
+
}
|
|
1242
|
+
/** Every REASK_CHECK_MS while a locked play has a link that expires: a blocked visitor's play ends; a due re-ask goes out */
|
|
1243
|
+
tick() {
|
|
1244
|
+
const play = this.current;
|
|
1245
|
+
if (!play) {
|
|
1246
|
+
this.stopTimer();
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
if (this.deps.blocked()) {
|
|
1250
|
+
this.cancel();
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
if (play.asking || play.nextAskAt === null || this.now() < play.nextAskAt) return;
|
|
1254
|
+
play.asking = true;
|
|
1255
|
+
play.lastAskAt = this.now();
|
|
1256
|
+
this.log("Stream link: asking again before the link expires", play.channel);
|
|
1257
|
+
const gen = play.gen;
|
|
1258
|
+
this.ask(play.channel).then((answer) => this.again(gen, answer)).catch(() => {
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
// src/utils/signed-request.ts
|
|
1264
|
+
import { signedFetch as signedFetch2 } from "~system/SignedFetch";
|
|
1265
|
+
async function signedRequest(url, init = {}) {
|
|
1266
|
+
const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
|
|
1267
|
+
return {
|
|
1268
|
+
ok: res.ok,
|
|
1269
|
+
status: res.status,
|
|
1270
|
+
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1064
1274
|
// src/ui/guide-ui.tsx
|
|
1065
1275
|
import ReactEcs2, { UiEntity as UiEntity2, Input as Input2, Label as Label2 } from "@dcl/sdk/react-ecs";
|
|
1066
1276
|
import { Color4 as Color43 } from "@dcl/sdk/math";
|
|
@@ -1306,6 +1516,10 @@ function truncateText(text, maxLength) {
|
|
|
1306
1516
|
}
|
|
1307
1517
|
|
|
1308
1518
|
// src/ui/guide-ui.tsx
|
|
1519
|
+
function withLock(mapped, v, fallback) {
|
|
1520
|
+
if (v.locked !== true) return mapped;
|
|
1521
|
+
return { ...mapped, src: "", locked: true, channel: v.slug || v.channelId || fallback };
|
|
1522
|
+
}
|
|
1309
1523
|
var GuideUIModule = class {
|
|
1310
1524
|
constructor(client, config = {}) {
|
|
1311
1525
|
// Visibility state
|
|
@@ -1470,7 +1684,7 @@ var GuideUIModule = class {
|
|
|
1470
1684
|
for (const [slug, video] of Object.entries(data.videoMap)) {
|
|
1471
1685
|
const v = video;
|
|
1472
1686
|
const src = v.src || v.liveStreamUrl || "";
|
|
1473
|
-
const mapped = {
|
|
1687
|
+
const mapped = withLock({
|
|
1474
1688
|
id: v.id || slug,
|
|
1475
1689
|
name: v.name || v.title || "Unknown",
|
|
1476
1690
|
src,
|
|
@@ -1483,7 +1697,7 @@ var GuideUIModule = class {
|
|
|
1483
1697
|
requiresAuth: v.requiresAuth,
|
|
1484
1698
|
// An 18+ channel or one of its VODs (thestatic.tv's flag since 2026-10-15): it stays listed and asks first
|
|
1485
1699
|
isNsfw: v.isNsfw === true
|
|
1486
|
-
};
|
|
1700
|
+
}, v, slug);
|
|
1487
1701
|
videos.push(mapped);
|
|
1488
1702
|
if (mapped.isLive) {
|
|
1489
1703
|
liveVideos.push(mapped);
|
|
@@ -1496,7 +1710,7 @@ var GuideUIModule = class {
|
|
|
1496
1710
|
if (pl.name === "NODES") continue;
|
|
1497
1711
|
playlists.push({
|
|
1498
1712
|
name: pl.name,
|
|
1499
|
-
videos: (pl.videos || []).map((v) => ({
|
|
1713
|
+
videos: (pl.videos || []).map((v) => withLock({
|
|
1500
1714
|
id: v.id,
|
|
1501
1715
|
name: v.name || v.title || "Unknown",
|
|
1502
1716
|
src: v.src || v.liveStreamUrl || "",
|
|
@@ -1506,7 +1720,7 @@ var GuideUIModule = class {
|
|
|
1506
1720
|
duration: v.duration,
|
|
1507
1721
|
requiresAuth: v.requiresAuth,
|
|
1508
1722
|
isNsfw: v.isNsfw === true
|
|
1509
|
-
}))
|
|
1723
|
+
}, v, v.id))
|
|
1510
1724
|
});
|
|
1511
1725
|
}
|
|
1512
1726
|
}
|
|
@@ -1931,6 +2145,14 @@ var GuideUIModule = class {
|
|
|
1931
2145
|
ReactEcs2.createElement(Label2, { value: "LIVE", fontSize: this.s(10), color: THEME.colors.white })
|
|
1932
2146
|
]
|
|
1933
2147
|
})
|
|
2148
|
+
] : [],
|
|
2149
|
+
// A locked channel (2026-11-20): its badge, the words a refused pick shows - one line, 12px in the 260px card
|
|
2150
|
+
...video.locked === true ? [
|
|
2151
|
+
ReactEcs2.createElement(UiEntity2, {
|
|
2152
|
+
key: "locked",
|
|
2153
|
+
uiTransform: { height: this.s(16), marginTop: 4 },
|
|
2154
|
+
uiText: { value: LOCKED_LINE, fontSize: this.s(12), color: THEME.colors.yellow }
|
|
2155
|
+
})
|
|
1934
2156
|
] : []
|
|
1935
2157
|
]
|
|
1936
2158
|
}),
|
|
@@ -2097,7 +2319,7 @@ var GuideUIModule = class {
|
|
|
2097
2319
|
// src/ui/chat-ui.tsx
|
|
2098
2320
|
import ReactEcs3, { UiEntity as UiEntity3, Label as Label3, Input as Input3, Button as Button2 } from "@dcl/sdk/react-ecs";
|
|
2099
2321
|
import { Color4 as Color44 } from "@dcl/sdk/math";
|
|
2100
|
-
import { signedFetch as
|
|
2322
|
+
import { signedFetch as signedFetch3 } from "~system/SignedFetch";
|
|
2101
2323
|
import { getPlayer } from "@dcl/sdk/players";
|
|
2102
2324
|
import { openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
|
|
2103
2325
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
@@ -2284,7 +2506,7 @@ var ChatUIModule = class {
|
|
|
2284
2506
|
this.isSigningIn = true;
|
|
2285
2507
|
try {
|
|
2286
2508
|
const baseUrl = this.getBaseUrl();
|
|
2287
|
-
const response = await
|
|
2509
|
+
const response = await signedFetch3({
|
|
2288
2510
|
url: `${baseUrl}/api/auth/dcl`,
|
|
2289
2511
|
init: {
|
|
2290
2512
|
method: "POST",
|
|
@@ -2386,7 +2608,7 @@ var ChatUIModule = class {
|
|
|
2386
2608
|
this.inputText = "";
|
|
2387
2609
|
try {
|
|
2388
2610
|
const baseUrl = this.getBaseUrl();
|
|
2389
|
-
const response = await
|
|
2611
|
+
const response = await signedFetch3({
|
|
2390
2612
|
url: `${baseUrl}/api/chat/send`,
|
|
2391
2613
|
init: {
|
|
2392
2614
|
method: "POST",
|
|
@@ -2936,7 +3158,6 @@ import ReactEcs6, { UiEntity as UiEntity6, Button as Button4, Label as Label6, I
|
|
|
2936
3158
|
import { Color4 as Color46 } from "@dcl/sdk/math";
|
|
2937
3159
|
import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
|
|
2938
3160
|
import { openExternalUrl as openExternalUrl5 } from "~system/RestrictedActions";
|
|
2939
|
-
import { signedFetch as signedFetch3 } from "~system/SignedFetch";
|
|
2940
3161
|
|
|
2941
3162
|
// src/ui/ui-renderer.tsx
|
|
2942
3163
|
import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
|
|
@@ -3455,6 +3676,7 @@ var ModerationModule = class {
|
|
|
3455
3676
|
};
|
|
3456
3677
|
|
|
3457
3678
|
// src/ui/admin-panel-ui.tsx
|
|
3679
|
+
var VIDEO_PLAY_TYPES = /* @__PURE__ */ new Set(["videoPlay", "videoSetUrl", "videoPlaySlot"]);
|
|
3458
3680
|
var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
|
|
3459
3681
|
function figuresOf(value) {
|
|
3460
3682
|
const figures = value?.figures;
|
|
@@ -3554,6 +3776,11 @@ var AdminPanelUIModule = class {
|
|
|
3554
3776
|
this.broadcastStatus = "";
|
|
3555
3777
|
/** The url the screen last played - the scene's current one from the video state at load, or the last play here - which PLAYBACK Play sends */
|
|
3556
3778
|
this.currentVideoUrl = null;
|
|
3779
|
+
/**
|
|
3780
|
+
* The locked channel the screen last played (2026-11-20), in place of a url: PLAYBACK Play queues it again as
|
|
3781
|
+
* `{ channel, locked: true }` - a locked channel's link is this visitor's own and never goes into the queue
|
|
3782
|
+
*/
|
|
3783
|
+
this.currentLockedChannel = null;
|
|
3557
3784
|
// Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
|
|
3558
3785
|
// status line, and the once-a-load gates for the declaration's upload and the saved state's read
|
|
3559
3786
|
this.controls = [];
|
|
@@ -3681,9 +3908,9 @@ var AdminPanelUIModule = class {
|
|
|
3681
3908
|
)), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
|
|
3682
3909
|
Label6,
|
|
3683
3910
|
{
|
|
3684
|
-
value: this.streamData.hlsUrl || "Not available",
|
|
3911
|
+
value: this.streamData.locked === true ? LOCKED_LINE : this.streamData.hlsUrl || "Not available",
|
|
3685
3912
|
fontSize: t.label,
|
|
3686
|
-
color: this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
3913
|
+
color: this.streamData.locked === true ? C2.yellow : this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
3687
3914
|
uiTransform: { margin: { left: 6 } }
|
|
3688
3915
|
}
|
|
3689
3916
|
)), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ ReactEcs6.createElement(
|
|
@@ -3706,7 +3933,7 @@ var AdminPanelUIModule = class {
|
|
|
3706
3933
|
color: C2.text,
|
|
3707
3934
|
onMouseDown: () => this.stopStream()
|
|
3708
3935
|
}
|
|
3709
|
-
), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ ReactEcs6.createElement(
|
|
3936
|
+
), this.streamData.isLive && (this.streamData.hlsUrl || this.streamData.locked === true) && /* @__PURE__ */ ReactEcs6.createElement(
|
|
3710
3937
|
Button4,
|
|
3711
3938
|
{
|
|
3712
3939
|
uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
@@ -3714,7 +3941,7 @@ var AdminPanelUIModule = class {
|
|
|
3714
3941
|
value: "Play on Screen",
|
|
3715
3942
|
fontSize: t.buttonSmall,
|
|
3716
3943
|
color: C2.text,
|
|
3717
|
-
onMouseDown: () => this.playStreamOnScreen(
|
|
3944
|
+
onMouseDown: () => this.playStreamOnScreen()
|
|
3718
3945
|
}
|
|
3719
3946
|
)), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(
|
|
3720
3947
|
Button4,
|
|
@@ -3807,7 +4034,7 @@ var AdminPanelUIModule = class {
|
|
|
3807
4034
|
{
|
|
3808
4035
|
value: this.videoStatus,
|
|
3809
4036
|
fontSize: t.status,
|
|
3810
|
-
color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
4037
|
+
color: this.videoStatus.startsWith("Not sent") || this.videoStatus === LOCKED_LINE || this.videoStatus === UNAVAILABLE_LINE ? C2.red : C2.green,
|
|
3811
4038
|
uiTransform: { height: this.s(18), margin: { bottom: 6 } }
|
|
3812
4039
|
}
|
|
3813
4040
|
), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
|
|
@@ -4350,8 +4577,37 @@ var AdminPanelUIModule = class {
|
|
|
4350
4577
|
playUrl(url) {
|
|
4351
4578
|
if (this.moderation.blocked) return;
|
|
4352
4579
|
this.currentVideoUrl = url;
|
|
4580
|
+
this.currentLockedChannel = null;
|
|
4353
4581
|
this.config.onVideoPlay?.(url);
|
|
4354
4582
|
}
|
|
4583
|
+
/**
|
|
4584
|
+
* A locked channel's play (thestatic.tv's stream lock, 2026-11-20): a queued video command carrying
|
|
4585
|
+
* `{ channel, locked: true }`, the owner's Play on Screen for a locked stream, a locked slot. This copy asks
|
|
4586
|
+
* thestatic.tv's door for the link, signed as this visitor (the client's stream link: one request in flight per
|
|
4587
|
+
* channel, the re-ask before it expires), and plays it through onVideoPlay only when admitted. A refusal plays
|
|
4588
|
+
* nothing; the notice and this tab's video line say LOCKED: TheStatic.tv citizens. A blocked visitor asks nothing.
|
|
4589
|
+
* The link itself is never kept for PLAYBACK Play or sent to the queue - the channel is.
|
|
4590
|
+
*/
|
|
4591
|
+
playLocked(channel) {
|
|
4592
|
+
if (this.moderation.blocked) return;
|
|
4593
|
+
const slug = channelOf(channel);
|
|
4594
|
+
if (!slug) {
|
|
4595
|
+
this.log("A locked play names no channel - nothing plays");
|
|
4596
|
+
return;
|
|
4597
|
+
}
|
|
4598
|
+
this.currentLockedChannel = slug;
|
|
4599
|
+
this.currentVideoUrl = null;
|
|
4600
|
+
this.client._playLockedChannel?.(slug, {
|
|
4601
|
+
deliver: (url) => {
|
|
4602
|
+
if (this.moderation.blocked) return;
|
|
4603
|
+
this.config.onVideoPlay?.(url);
|
|
4604
|
+
},
|
|
4605
|
+
stop: () => this.config.onVideoStop?.(),
|
|
4606
|
+
failed: (line) => {
|
|
4607
|
+
this.videoStatus = line;
|
|
4608
|
+
}
|
|
4609
|
+
});
|
|
4610
|
+
}
|
|
4355
4611
|
/**
|
|
4356
4612
|
* Toggle the admin panel open/closed
|
|
4357
4613
|
*/
|
|
@@ -4562,15 +4818,12 @@ var AdminPanelUIModule = class {
|
|
|
4562
4818
|
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
4563
4819
|
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
4564
4820
|
* came from the scene deployed at this scene's registered location. A wallet named in a query or
|
|
4565
|
-
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
4821
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites. The
|
|
4822
|
+
* request itself lives in utils/signed-request.ts since 2026-11-20 (it was here), so the locked
|
|
4823
|
+
* channel's door - which a Standard scene asks too, with no panel - goes through the same one.
|
|
4566
4824
|
*/
|
|
4567
4825
|
async signedRequest(url, init = {}) {
|
|
4568
|
-
|
|
4569
|
-
return {
|
|
4570
|
-
ok: res.ok,
|
|
4571
|
-
status: res.status,
|
|
4572
|
-
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
4573
|
-
};
|
|
4826
|
+
return signedRequest(url, init);
|
|
4574
4827
|
}
|
|
4575
4828
|
/**
|
|
4576
4829
|
* Every visitor's copy reads the scene's queue (a public GET, every 5 s). Since 2026-11-18 the poll sends the server's
|
|
@@ -4623,12 +4876,18 @@ var AdminPanelUIModule = class {
|
|
|
4623
4876
|
} else if (cmd.type === "privateMode" && this.venue) {
|
|
4624
4877
|
this.log("Received privateMode - re-reading my standing");
|
|
4625
4878
|
this.moderation.handleCommand(cmd.type, cmd.payload);
|
|
4879
|
+
} else if (VIDEO_PLAY_TYPES.has(cmd.type) && cmd.payload?.locked === true) {
|
|
4880
|
+
this.log("Received locked play:", cmd.type, cmd.payload.channel);
|
|
4881
|
+
this.playLocked(cmd.payload.channel);
|
|
4626
4882
|
} else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
|
|
4627
4883
|
this.log("Received video play:", cmd.type, cmd.payload.url);
|
|
4628
4884
|
this.playUrl(cmd.payload.url);
|
|
4629
4885
|
} else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
|
|
4630
4886
|
this.log("Received video stop/clear:", cmd.type);
|
|
4631
|
-
if (cmd.type === "videoClear")
|
|
4887
|
+
if (cmd.type === "videoClear") {
|
|
4888
|
+
this.currentVideoUrl = null;
|
|
4889
|
+
this.currentLockedChannel = null;
|
|
4890
|
+
}
|
|
4632
4891
|
this.config.onVideoStop?.();
|
|
4633
4892
|
} else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
|
|
4634
4893
|
const slotId = cmd.payload.slot;
|
|
@@ -4692,6 +4951,11 @@ var AdminPanelUIModule = class {
|
|
|
4692
4951
|
videoSlots: data.videoSlots || {}
|
|
4693
4952
|
};
|
|
4694
4953
|
if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
|
|
4954
|
+
const lockedCurrent = data.currentVideo?.locked === true ? channelOf(data.currentVideo.channel) : null;
|
|
4955
|
+
if (lockedCurrent) {
|
|
4956
|
+
this.currentLockedChannel = lockedCurrent;
|
|
4957
|
+
this.currentVideoUrl = null;
|
|
4958
|
+
}
|
|
4695
4959
|
this.videoStateFetched = true;
|
|
4696
4960
|
this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
|
|
4697
4961
|
}
|
|
@@ -4704,6 +4968,11 @@ var AdminPanelUIModule = class {
|
|
|
4704
4968
|
*/
|
|
4705
4969
|
playSlot(slotId) {
|
|
4706
4970
|
const slot = this.videoState?.videoSlots?.[slotId];
|
|
4971
|
+
if (slot?.locked === true) {
|
|
4972
|
+
this.log("Playing locked slot:", slotId);
|
|
4973
|
+
this.playLocked(slot.slug ?? slot.channel);
|
|
4974
|
+
return;
|
|
4975
|
+
}
|
|
4707
4976
|
if (slot?.url) {
|
|
4708
4977
|
this.log("Playing slot:", slotId, slot.url);
|
|
4709
4978
|
this.playUrl(slot.url);
|
|
@@ -4719,7 +4988,10 @@ var AdminPanelUIModule = class {
|
|
|
4719
4988
|
if (!this.videoState?.defaultSlot) return;
|
|
4720
4989
|
const defaultSlot = this.videoState.defaultSlot;
|
|
4721
4990
|
const slot = this.videoState.videoSlots?.[defaultSlot];
|
|
4722
|
-
if (slot?.
|
|
4991
|
+
if (slot?.locked === true) {
|
|
4992
|
+
this.log("Auto-playing locked default slot:", defaultSlot);
|
|
4993
|
+
this.playLocked(slot.slug ?? slot.channel);
|
|
4994
|
+
} else if (slot?.url) {
|
|
4723
4995
|
this.log("Auto-playing default slot:", defaultSlot);
|
|
4724
4996
|
this.playUrl(slot.url);
|
|
4725
4997
|
}
|
|
@@ -5199,8 +5471,25 @@ var AdminPanelUIModule = class {
|
|
|
5199
5471
|
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5200
5472
|
});
|
|
5201
5473
|
}
|
|
5202
|
-
/**
|
|
5203
|
-
|
|
5474
|
+
/**
|
|
5475
|
+
* Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it). A
|
|
5476
|
+
* locked stream (2026-11-20: the /stream answer says locked, with its slug and no hlsUrl) plays here through the
|
|
5477
|
+
* link asked for signed as the owner, and queues `videoSetUrl { channel, locked: true }` - never a url, so every
|
|
5478
|
+
* visitor's copy asks for its own link and only the admitted play it.
|
|
5479
|
+
*/
|
|
5480
|
+
playStreamOnScreen() {
|
|
5481
|
+
const data = this.streamData;
|
|
5482
|
+
if (!data) return;
|
|
5483
|
+
if (data.locked === true) {
|
|
5484
|
+
const channel = channelOf(data.slug ?? data.channelId);
|
|
5485
|
+
if (!channel) return;
|
|
5486
|
+
this.playLocked(channel);
|
|
5487
|
+
this.sendSceneCommand("videoSetUrl", { channel, locked: true }, this.videoLine).catch(() => {
|
|
5488
|
+
});
|
|
5489
|
+
return;
|
|
5490
|
+
}
|
|
5491
|
+
const url = data.hlsUrl;
|
|
5492
|
+
if (!url) return;
|
|
5204
5493
|
this.playUrl(url);
|
|
5205
5494
|
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5206
5495
|
});
|
|
@@ -5218,6 +5507,13 @@ var AdminPanelUIModule = class {
|
|
|
5218
5507
|
*/
|
|
5219
5508
|
playbackPlay() {
|
|
5220
5509
|
this.config.onCommand?.("videoPlay", { playing: true });
|
|
5510
|
+
const locked = this.currentLockedChannel;
|
|
5511
|
+
if (locked) {
|
|
5512
|
+
this.playLocked(locked);
|
|
5513
|
+
this.sendSceneCommand("videoPlay", { channel: locked, locked: true }, this.videoLine).catch(() => {
|
|
5514
|
+
});
|
|
5515
|
+
return;
|
|
5516
|
+
}
|
|
5221
5517
|
const url = this.currentVideoUrl;
|
|
5222
5518
|
if (!url) {
|
|
5223
5519
|
this.videoStatus = "Not sent: no video";
|
|
@@ -5241,6 +5537,7 @@ var AdminPanelUIModule = class {
|
|
|
5241
5537
|
resetDefault() {
|
|
5242
5538
|
this.config.onCommand?.("videoClear", {});
|
|
5243
5539
|
this.currentVideoUrl = null;
|
|
5540
|
+
this.currentLockedChannel = null;
|
|
5244
5541
|
this.config.onVideoStop?.();
|
|
5245
5542
|
this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
|
|
5246
5543
|
});
|
|
@@ -5442,6 +5739,18 @@ var StaticTVClient = class {
|
|
|
5442
5739
|
this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
|
|
5443
5740
|
this.frames = new FramesModule(this);
|
|
5444
5741
|
if (config.frames) this.frames.register(config.frames);
|
|
5742
|
+
this.streamLink = new StreamLinkModule({
|
|
5743
|
+
doorUrl: () => {
|
|
5744
|
+
const sceneId = this.getSceneId();
|
|
5745
|
+
return sceneId ? `${this.apiUrl}/scene/${encodeURIComponent(sceneId)}/stream/play` : null;
|
|
5746
|
+
},
|
|
5747
|
+
post: (url, body) => signedRequest(url, { method: "POST", headers: { "Content-Type": "application/json" }, body }),
|
|
5748
|
+
blocked: () => this.isVisitorBlocked,
|
|
5749
|
+
notify: (line) => this.showNotification(line),
|
|
5750
|
+
setInterval: dclSetInterval,
|
|
5751
|
+
clearInterval: dclClearInterval,
|
|
5752
|
+
log: (msg, ...args) => this.log(msg, ...args)
|
|
5753
|
+
});
|
|
5445
5754
|
if (!config.apiKey) {
|
|
5446
5755
|
this._disabled = true;
|
|
5447
5756
|
this._keyType = null;
|
|
@@ -5633,6 +5942,7 @@ var StaticTVClient = class {
|
|
|
5633
5942
|
*/
|
|
5634
5943
|
playVideo(url) {
|
|
5635
5944
|
if (this.isVisitorBlocked) return;
|
|
5945
|
+
this.streamLink.playChanged(url);
|
|
5636
5946
|
const screen = this.config.videoScreen;
|
|
5637
5947
|
if (screen !== void 0) {
|
|
5638
5948
|
this.log(`Playing video: ${url}`);
|
|
@@ -5657,6 +5967,7 @@ var StaticTVClient = class {
|
|
|
5657
5967
|
*/
|
|
5658
5968
|
stopVideo() {
|
|
5659
5969
|
const screen = this.config.videoScreen;
|
|
5970
|
+
this.streamLink.cancel();
|
|
5660
5971
|
this._pendingVideoData = null;
|
|
5661
5972
|
this._streamVerified = false;
|
|
5662
5973
|
this._clearVerificationTimeout();
|
|
@@ -5815,10 +6126,48 @@ var StaticTVClient = class {
|
|
|
5815
6126
|
_handleGuideVideoSelect(video) {
|
|
5816
6127
|
if (!video.src) return;
|
|
5817
6128
|
if (this.isVisitorBlocked) return;
|
|
6129
|
+
this.streamLink.cancel();
|
|
6130
|
+
this._playGuideEntry(video);
|
|
6131
|
+
}
|
|
6132
|
+
/**
|
|
6133
|
+
* A guide entry with its url, onto the SDK's player and/or onVideoPlay, with the stream verification - an unlocked
|
|
6134
|
+
* pick's, and a locked one's once its link is in hand (2026-11-20; until then this was _handleGuideVideoSelect's body)
|
|
6135
|
+
* @internal
|
|
6136
|
+
*/
|
|
6137
|
+
_playGuideEntry(video) {
|
|
5818
6138
|
this._pendingVideoData = video;
|
|
5819
6139
|
const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
|
|
5820
6140
|
this._playVideoWithVerification(video, isLiveStream);
|
|
5821
6141
|
}
|
|
6142
|
+
/**
|
|
6143
|
+
* A locked channel's guide entry picked (thestatic.tv's stream lock, 2026-11-20). It carries no url: the SDK asks
|
|
6144
|
+
* thestatic.tv's door for the link, signed as this visitor, and only with a link in hand does the entry go on - to
|
|
6145
|
+
* the SDK's player and onVideoPlay as an unlocked pick does, and to the scene's own guideUI.onVideoSelect - with the
|
|
6146
|
+
* link as its src. Scenes' own handlers play `video.src` (TheStatic.tv HQ's, the templates'), so handing them the
|
|
6147
|
+
* entry before the answer would play an empty src, and on a refusal play what should not play: a refusal hands
|
|
6148
|
+
* nobody anything and shows LOCKED: TheStatic.tv citizens. Each fresh link before the old one expires goes the same
|
|
6149
|
+
* way (the re-ask); a re-ask refused stops the video. A blocked visitor asks nothing.
|
|
6150
|
+
* @internal
|
|
6151
|
+
*/
|
|
6152
|
+
_selectLockedGuideEntry(video) {
|
|
6153
|
+
if (this.isVisitorBlocked) return;
|
|
6154
|
+
this.streamLink.play(video.channel, {
|
|
6155
|
+
deliver: (url) => {
|
|
6156
|
+
const entry = { ...video, src: url };
|
|
6157
|
+
if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) this._playGuideEntry(entry);
|
|
6158
|
+
if (this.config.guideUI?.onVideoSelect) this.config.guideUI.onVideoSelect(entry);
|
|
6159
|
+
},
|
|
6160
|
+
stop: () => this.stopVideo()
|
|
6161
|
+
});
|
|
6162
|
+
}
|
|
6163
|
+
/**
|
|
6164
|
+
* A locked channel's play from the Admin Panel - a queued video command carrying `{ channel, locked: true }`, the
|
|
6165
|
+
* owner's Play on Screen, a locked slot (2026-11-20): the same ask and re-ask as a guide pick, the panel's own hands.
|
|
6166
|
+
* @internal
|
|
6167
|
+
*/
|
|
6168
|
+
_playLockedChannel(channel, handlers) {
|
|
6169
|
+
this.streamLink.play(channel, handlers);
|
|
6170
|
+
}
|
|
5822
6171
|
/**
|
|
5823
6172
|
* Play video with stream verification for live content
|
|
5824
6173
|
* Works with both videoScreen (SDK-managed) and onVideoPlay (user-managed) modes.
|
|
@@ -5941,6 +6290,7 @@ var StaticTVClient = class {
|
|
|
5941
6290
|
this.guideUI?.hide();
|
|
5942
6291
|
this.chatUI?.hide();
|
|
5943
6292
|
this.heartbeat?.stopWatching();
|
|
6293
|
+
this.streamLink.cancel();
|
|
5944
6294
|
this._pendingVideoData = null;
|
|
5945
6295
|
this._clearVerificationTimeout();
|
|
5946
6296
|
if (screen !== void 0 && VideoPlayer.has(screen)) {
|
|
@@ -5982,6 +6332,10 @@ var StaticTVClient = class {
|
|
|
5982
6332
|
const guideConfig = {
|
|
5983
6333
|
...this.config.guideUI,
|
|
5984
6334
|
onVideoSelect: (video) => {
|
|
6335
|
+
if (video.locked === true) {
|
|
6336
|
+
this._selectLockedGuideEntry(video);
|
|
6337
|
+
return;
|
|
6338
|
+
}
|
|
5985
6339
|
if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) {
|
|
5986
6340
|
this._handleGuideVideoSelect(video);
|
|
5987
6341
|
}
|
|
@@ -6297,6 +6651,7 @@ var StaticTVClient = class {
|
|
|
6297
6651
|
this.log("StaticTVClient destroyed (was disabled)");
|
|
6298
6652
|
return;
|
|
6299
6653
|
}
|
|
6654
|
+
this.streamLink.cancel();
|
|
6300
6655
|
if (this.heartbeat) {
|
|
6301
6656
|
this.heartbeat.stopWatching();
|
|
6302
6657
|
}
|
package/package.json
CHANGED