@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.js
CHANGED
|
@@ -1112,6 +1112,216 @@ var FramesModule = class {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
};
|
|
1114
1114
|
|
|
1115
|
+
// src/modules/stream-link.ts
|
|
1116
|
+
var LOCKED_LINE = "LOCKED: TheStatic.tv citizens";
|
|
1117
|
+
var UNAVAILABLE_LINE = "Stream link unavailable";
|
|
1118
|
+
var REASK_BEFORE_MS = 10 * 60 * 1e3;
|
|
1119
|
+
var REASK_CHECK_MS = 15 * 1e3;
|
|
1120
|
+
var REASK_RETRY_MS = 60 * 1e3;
|
|
1121
|
+
var CHANNEL_MAX = 100;
|
|
1122
|
+
function channelOf(value) {
|
|
1123
|
+
return typeof value === "string" && value !== "" && value.length <= CHANNEL_MAX ? value : null;
|
|
1124
|
+
}
|
|
1125
|
+
var StreamLinkModule = class {
|
|
1126
|
+
constructor(deps) {
|
|
1127
|
+
this.inFlight = /* @__PURE__ */ new Map();
|
|
1128
|
+
this.current = null;
|
|
1129
|
+
this.gen = 0;
|
|
1130
|
+
this.timerId = null;
|
|
1131
|
+
this.deps = deps;
|
|
1132
|
+
}
|
|
1133
|
+
now() {
|
|
1134
|
+
return this.deps.now ? this.deps.now() : Date.now();
|
|
1135
|
+
}
|
|
1136
|
+
log(msg, ...args) {
|
|
1137
|
+
this.deps.log?.(msg, ...args);
|
|
1138
|
+
}
|
|
1139
|
+
/** The channel of the locked play going on, or null */
|
|
1140
|
+
get playing() {
|
|
1141
|
+
return this.current ? this.current.channel : null;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Ask the door for a channel's link, signed as the visitor. One request in flight per channel: an ask while one is
|
|
1145
|
+
* out gets the same answer. A blocked visitor gets 'blocked' and nothing is sent.
|
|
1146
|
+
*/
|
|
1147
|
+
ask(channel) {
|
|
1148
|
+
if (this.deps.blocked()) return Promise.resolve({ ok: false, reason: "blocked" });
|
|
1149
|
+
const pending = this.inFlight.get(channel);
|
|
1150
|
+
if (pending) return pending;
|
|
1151
|
+
const request2 = this.request(channel).finally(() => {
|
|
1152
|
+
this.inFlight.delete(channel);
|
|
1153
|
+
});
|
|
1154
|
+
this.inFlight.set(channel, request2);
|
|
1155
|
+
return request2;
|
|
1156
|
+
}
|
|
1157
|
+
async request(channel) {
|
|
1158
|
+
const url = this.deps.doorUrl();
|
|
1159
|
+
if (!url) {
|
|
1160
|
+
this.log("Stream link: no scene id - cannot ask");
|
|
1161
|
+
return { ok: false, reason: "unavailable" };
|
|
1162
|
+
}
|
|
1163
|
+
try {
|
|
1164
|
+
const res = await this.deps.post(url, JSON.stringify({ channel }));
|
|
1165
|
+
let data = {};
|
|
1166
|
+
try {
|
|
1167
|
+
data = await res.json();
|
|
1168
|
+
} catch {
|
|
1169
|
+
}
|
|
1170
|
+
if (res.ok) {
|
|
1171
|
+
const link = data && typeof data.url === "string" ? data.url : "";
|
|
1172
|
+
const expiresAt = data && typeof data.expiresAt === "number" && Number.isFinite(data.expiresAt) ? data.expiresAt : null;
|
|
1173
|
+
if (!link.startsWith("https://")) {
|
|
1174
|
+
this.log("Stream link: an answer with no https url", res.status);
|
|
1175
|
+
return { ok: false, reason: "unavailable", status: res.status };
|
|
1176
|
+
}
|
|
1177
|
+
return { ok: true, url: link, expiresAt };
|
|
1178
|
+
}
|
|
1179
|
+
if (res.status === 403) {
|
|
1180
|
+
return { ok: false, reason: data?.reason === "guest" ? "guest" : "not-admitted", status: 403 };
|
|
1181
|
+
}
|
|
1182
|
+
this.log("Stream link: the door answered", res.status, data?.error);
|
|
1183
|
+
return { ok: false, reason: "unavailable", status: res.status };
|
|
1184
|
+
} catch (err) {
|
|
1185
|
+
this.log("Stream link: request failed", err);
|
|
1186
|
+
return { ok: false, reason: "unavailable" };
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Play a locked channel: ask for its link and hand it to deliver, then keep it fresh while this play goes on. Ends
|
|
1191
|
+
* any locked play before it. A blocked visitor asks nothing; an invalid channel plays nothing.
|
|
1192
|
+
*/
|
|
1193
|
+
play(channel, handlers) {
|
|
1194
|
+
this.cancel();
|
|
1195
|
+
const slug = channelOf(channel);
|
|
1196
|
+
if (!slug) {
|
|
1197
|
+
this.log("Stream link: a locked play names no channel - nothing plays");
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
if (this.deps.blocked()) return;
|
|
1201
|
+
const gen = ++this.gen;
|
|
1202
|
+
this.current = { gen, channel: slug, handlers, url: null, nextAskAt: null, lastAskAt: this.now(), asking: true };
|
|
1203
|
+
this.ask(slug).then((answer) => this.first(gen, answer)).catch(() => {
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
/** The first answer for play gen: the link plays, or the notice says why not */
|
|
1207
|
+
first(gen, answer) {
|
|
1208
|
+
const play = this.current;
|
|
1209
|
+
if (!play || play.gen !== gen) return;
|
|
1210
|
+
play.asking = false;
|
|
1211
|
+
if (answer.ok && !this.deps.blocked()) {
|
|
1212
|
+
this.deliver(play, answer.url, answer.expiresAt);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
this.end();
|
|
1216
|
+
if (!answer.ok && answer.reason !== "blocked") this.fail(play, answer.reason);
|
|
1217
|
+
}
|
|
1218
|
+
/** A re-ask's answer: a new link plays in place of the old; a refusal stops the play; a failure tries again later */
|
|
1219
|
+
again(gen, answer) {
|
|
1220
|
+
const play = this.current;
|
|
1221
|
+
if (!play || play.gen !== gen) return;
|
|
1222
|
+
play.asking = false;
|
|
1223
|
+
if (this.deps.blocked()) {
|
|
1224
|
+
this.cancel();
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
if (answer.ok) {
|
|
1228
|
+
this.deliver(play, answer.url, answer.expiresAt);
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
if (answer.reason === "guest" || answer.reason === "not-admitted") {
|
|
1232
|
+
this.log("Stream link: the re-ask was refused - stopping", play.channel);
|
|
1233
|
+
this.end();
|
|
1234
|
+
this.fail(play, answer.reason);
|
|
1235
|
+
try {
|
|
1236
|
+
play.handlers.stop?.();
|
|
1237
|
+
} catch (err) {
|
|
1238
|
+
this.log("Stream link: stop failed", err);
|
|
1239
|
+
}
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
play.nextAskAt = this.now() + REASK_RETRY_MS;
|
|
1243
|
+
}
|
|
1244
|
+
deliver(play, url, expiresAt) {
|
|
1245
|
+
const switched = url !== play.url;
|
|
1246
|
+
play.url = url;
|
|
1247
|
+
if (expiresAt === null) {
|
|
1248
|
+
play.nextAskAt = null;
|
|
1249
|
+
this.stopTimer();
|
|
1250
|
+
} else {
|
|
1251
|
+
play.nextAskAt = Math.max(play.lastAskAt + REASK_RETRY_MS, expiresAt * 1e3 - REASK_BEFORE_MS);
|
|
1252
|
+
this.startTimer();
|
|
1253
|
+
}
|
|
1254
|
+
if (!switched) return;
|
|
1255
|
+
try {
|
|
1256
|
+
play.handlers.deliver(url);
|
|
1257
|
+
} catch (err) {
|
|
1258
|
+
this.log("Stream link: deliver failed", err);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
fail(play, reason) {
|
|
1262
|
+
const line = reason === "guest" || reason === "not-admitted" ? LOCKED_LINE : UNAVAILABLE_LINE;
|
|
1263
|
+
this.deps.notify(line);
|
|
1264
|
+
try {
|
|
1265
|
+
play.handlers.failed?.(line);
|
|
1266
|
+
} catch (err) {
|
|
1267
|
+
this.log("Stream link: failed handler threw", err);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
/** Something played: a url other than this play's own link ends the locked play (the play changed) */
|
|
1271
|
+
playChanged(url) {
|
|
1272
|
+
if (this.current && url !== this.current.url) this.cancel();
|
|
1273
|
+
}
|
|
1274
|
+
/** Ends the locked play, if any: no re-ask, and an answer still on its way is dropped */
|
|
1275
|
+
cancel() {
|
|
1276
|
+
if (!this.current) return;
|
|
1277
|
+
this.log("Stream link: locked play ended", this.current.channel);
|
|
1278
|
+
this.end();
|
|
1279
|
+
}
|
|
1280
|
+
end() {
|
|
1281
|
+
this.current = null;
|
|
1282
|
+
this.stopTimer();
|
|
1283
|
+
}
|
|
1284
|
+
startTimer() {
|
|
1285
|
+
if (this.timerId !== null) return;
|
|
1286
|
+
this.timerId = this.deps.setInterval(() => this.tick(), REASK_CHECK_MS);
|
|
1287
|
+
}
|
|
1288
|
+
stopTimer() {
|
|
1289
|
+
if (this.timerId === null) return;
|
|
1290
|
+
this.deps.clearInterval(this.timerId);
|
|
1291
|
+
this.timerId = null;
|
|
1292
|
+
}
|
|
1293
|
+
/** 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 */
|
|
1294
|
+
tick() {
|
|
1295
|
+
const play = this.current;
|
|
1296
|
+
if (!play) {
|
|
1297
|
+
this.stopTimer();
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
if (this.deps.blocked()) {
|
|
1301
|
+
this.cancel();
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
if (play.asking || play.nextAskAt === null || this.now() < play.nextAskAt) return;
|
|
1305
|
+
play.asking = true;
|
|
1306
|
+
play.lastAskAt = this.now();
|
|
1307
|
+
this.log("Stream link: asking again before the link expires", play.channel);
|
|
1308
|
+
const gen = play.gen;
|
|
1309
|
+
this.ask(play.channel).then((answer) => this.again(gen, answer)).catch(() => {
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
// src/utils/signed-request.ts
|
|
1315
|
+
var import_SignedFetch2 = require("~system/SignedFetch");
|
|
1316
|
+
async function signedRequest(url, init = {}) {
|
|
1317
|
+
const res = await (0, import_SignedFetch2.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
|
|
1318
|
+
return {
|
|
1319
|
+
ok: res.ok,
|
|
1320
|
+
status: res.status,
|
|
1321
|
+
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1115
1325
|
// src/ui/guide-ui.tsx
|
|
1116
1326
|
var import_react_ecs2 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
1117
1327
|
var import_math3 = require("@dcl/sdk/math");
|
|
@@ -1357,6 +1567,10 @@ function truncateText(text, maxLength) {
|
|
|
1357
1567
|
}
|
|
1358
1568
|
|
|
1359
1569
|
// src/ui/guide-ui.tsx
|
|
1570
|
+
function withLock(mapped, v, fallback) {
|
|
1571
|
+
if (v.locked !== true) return mapped;
|
|
1572
|
+
return { ...mapped, src: "", locked: true, channel: v.slug || v.channelId || fallback };
|
|
1573
|
+
}
|
|
1360
1574
|
var GuideUIModule = class {
|
|
1361
1575
|
constructor(client, config = {}) {
|
|
1362
1576
|
// Visibility state
|
|
@@ -1521,7 +1735,7 @@ var GuideUIModule = class {
|
|
|
1521
1735
|
for (const [slug, video] of Object.entries(data.videoMap)) {
|
|
1522
1736
|
const v = video;
|
|
1523
1737
|
const src = v.src || v.liveStreamUrl || "";
|
|
1524
|
-
const mapped = {
|
|
1738
|
+
const mapped = withLock({
|
|
1525
1739
|
id: v.id || slug,
|
|
1526
1740
|
name: v.name || v.title || "Unknown",
|
|
1527
1741
|
src,
|
|
@@ -1534,7 +1748,7 @@ var GuideUIModule = class {
|
|
|
1534
1748
|
requiresAuth: v.requiresAuth,
|
|
1535
1749
|
// An 18+ channel or one of its VODs (thestatic.tv's flag since 2026-10-15): it stays listed and asks first
|
|
1536
1750
|
isNsfw: v.isNsfw === true
|
|
1537
|
-
};
|
|
1751
|
+
}, v, slug);
|
|
1538
1752
|
videos.push(mapped);
|
|
1539
1753
|
if (mapped.isLive) {
|
|
1540
1754
|
liveVideos.push(mapped);
|
|
@@ -1547,7 +1761,7 @@ var GuideUIModule = class {
|
|
|
1547
1761
|
if (pl.name === "NODES") continue;
|
|
1548
1762
|
playlists.push({
|
|
1549
1763
|
name: pl.name,
|
|
1550
|
-
videos: (pl.videos || []).map((v) => ({
|
|
1764
|
+
videos: (pl.videos || []).map((v) => withLock({
|
|
1551
1765
|
id: v.id,
|
|
1552
1766
|
name: v.name || v.title || "Unknown",
|
|
1553
1767
|
src: v.src || v.liveStreamUrl || "",
|
|
@@ -1557,7 +1771,7 @@ var GuideUIModule = class {
|
|
|
1557
1771
|
duration: v.duration,
|
|
1558
1772
|
requiresAuth: v.requiresAuth,
|
|
1559
1773
|
isNsfw: v.isNsfw === true
|
|
1560
|
-
}))
|
|
1774
|
+
}, v, v.id))
|
|
1561
1775
|
});
|
|
1562
1776
|
}
|
|
1563
1777
|
}
|
|
@@ -1982,6 +2196,14 @@ var GuideUIModule = class {
|
|
|
1982
2196
|
import_react_ecs2.default.createElement(import_react_ecs2.Label, { value: "LIVE", fontSize: this.s(10), color: THEME.colors.white })
|
|
1983
2197
|
]
|
|
1984
2198
|
})
|
|
2199
|
+
] : [],
|
|
2200
|
+
// A locked channel (2026-11-20): its badge, the words a refused pick shows - one line, 12px in the 260px card
|
|
2201
|
+
...video.locked === true ? [
|
|
2202
|
+
import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
|
|
2203
|
+
key: "locked",
|
|
2204
|
+
uiTransform: { height: this.s(16), marginTop: 4 },
|
|
2205
|
+
uiText: { value: LOCKED_LINE, fontSize: this.s(12), color: THEME.colors.yellow }
|
|
2206
|
+
})
|
|
1985
2207
|
] : []
|
|
1986
2208
|
]
|
|
1987
2209
|
}),
|
|
@@ -2148,7 +2370,7 @@ var GuideUIModule = class {
|
|
|
2148
2370
|
// src/ui/chat-ui.tsx
|
|
2149
2371
|
var import_react_ecs3 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
2150
2372
|
var import_math4 = require("@dcl/sdk/math");
|
|
2151
|
-
var
|
|
2373
|
+
var import_SignedFetch3 = require("~system/SignedFetch");
|
|
2152
2374
|
var import_players = require("@dcl/sdk/players");
|
|
2153
2375
|
var import_RestrictedActions3 = require("~system/RestrictedActions");
|
|
2154
2376
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
@@ -2335,7 +2557,7 @@ var ChatUIModule = class {
|
|
|
2335
2557
|
this.isSigningIn = true;
|
|
2336
2558
|
try {
|
|
2337
2559
|
const baseUrl = this.getBaseUrl();
|
|
2338
|
-
const response = await (0,
|
|
2560
|
+
const response = await (0, import_SignedFetch3.signedFetch)({
|
|
2339
2561
|
url: `${baseUrl}/api/auth/dcl`,
|
|
2340
2562
|
init: {
|
|
2341
2563
|
method: "POST",
|
|
@@ -2437,7 +2659,7 @@ var ChatUIModule = class {
|
|
|
2437
2659
|
this.inputText = "";
|
|
2438
2660
|
try {
|
|
2439
2661
|
const baseUrl = this.getBaseUrl();
|
|
2440
|
-
const response = await (0,
|
|
2662
|
+
const response = await (0, import_SignedFetch3.signedFetch)({
|
|
2441
2663
|
url: `${baseUrl}/api/chat/send`,
|
|
2442
2664
|
init: {
|
|
2443
2665
|
method: "POST",
|
|
@@ -2987,7 +3209,6 @@ var import_react_ecs6 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
|
2987
3209
|
var import_math7 = require("@dcl/sdk/math");
|
|
2988
3210
|
var import_players2 = require("@dcl/sdk/players");
|
|
2989
3211
|
var import_RestrictedActions6 = require("~system/RestrictedActions");
|
|
2990
|
-
var import_SignedFetch3 = require("~system/SignedFetch");
|
|
2991
3212
|
|
|
2992
3213
|
// src/ui/ui-renderer.tsx
|
|
2993
3214
|
var import_react_ecs4 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
@@ -3506,6 +3727,7 @@ var ModerationModule = class {
|
|
|
3506
3727
|
};
|
|
3507
3728
|
|
|
3508
3729
|
// src/ui/admin-panel-ui.tsx
|
|
3730
|
+
var VIDEO_PLAY_TYPES = /* @__PURE__ */ new Set(["videoPlay", "videoSetUrl", "videoPlaySlot"]);
|
|
3509
3731
|
var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
|
|
3510
3732
|
function figuresOf(value) {
|
|
3511
3733
|
const figures = value?.figures;
|
|
@@ -3605,6 +3827,11 @@ var AdminPanelUIModule = class {
|
|
|
3605
3827
|
this.broadcastStatus = "";
|
|
3606
3828
|
/** 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 */
|
|
3607
3829
|
this.currentVideoUrl = null;
|
|
3830
|
+
/**
|
|
3831
|
+
* The locked channel the screen last played (2026-11-20), in place of a url: PLAYBACK Play queues it again as
|
|
3832
|
+
* `{ channel, locked: true }` - a locked channel's link is this visitor's own and never goes into the queue
|
|
3833
|
+
*/
|
|
3834
|
+
this.currentLockedChannel = null;
|
|
3608
3835
|
// Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
|
|
3609
3836
|
// status line, and the once-a-load gates for the declaration's upload and the saved state's read
|
|
3610
3837
|
this.controls = [];
|
|
@@ -3732,9 +3959,9 @@ var AdminPanelUIModule = class {
|
|
|
3732
3959
|
)), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3733
3960
|
import_react_ecs6.Label,
|
|
3734
3961
|
{
|
|
3735
|
-
value: this.streamData.hlsUrl || "Not available",
|
|
3962
|
+
value: this.streamData.locked === true ? LOCKED_LINE : this.streamData.hlsUrl || "Not available",
|
|
3736
3963
|
fontSize: t.label,
|
|
3737
|
-
color: this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
3964
|
+
color: this.streamData.locked === true ? C2.yellow : this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
3738
3965
|
uiTransform: { margin: { left: 6 } }
|
|
3739
3966
|
}
|
|
3740
3967
|
)), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
@@ -3757,7 +3984,7 @@ var AdminPanelUIModule = class {
|
|
|
3757
3984
|
color: C2.text,
|
|
3758
3985
|
onMouseDown: () => this.stopStream()
|
|
3759
3986
|
}
|
|
3760
|
-
), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3987
|
+
), this.streamData.isLive && (this.streamData.hlsUrl || this.streamData.locked === true) && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3761
3988
|
import_react_ecs6.Button,
|
|
3762
3989
|
{
|
|
3763
3990
|
uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
@@ -3765,7 +3992,7 @@ var AdminPanelUIModule = class {
|
|
|
3765
3992
|
value: "Play on Screen",
|
|
3766
3993
|
fontSize: t.buttonSmall,
|
|
3767
3994
|
color: C2.text,
|
|
3768
|
-
onMouseDown: () => this.playStreamOnScreen(
|
|
3995
|
+
onMouseDown: () => this.playStreamOnScreen()
|
|
3769
3996
|
}
|
|
3770
3997
|
)), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3771
3998
|
import_react_ecs6.Button,
|
|
@@ -3858,7 +4085,7 @@ var AdminPanelUIModule = class {
|
|
|
3858
4085
|
{
|
|
3859
4086
|
value: this.videoStatus,
|
|
3860
4087
|
fontSize: t.status,
|
|
3861
|
-
color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
4088
|
+
color: this.videoStatus.startsWith("Not sent") || this.videoStatus === LOCKED_LINE || this.videoStatus === UNAVAILABLE_LINE ? C2.red : C2.green,
|
|
3862
4089
|
uiTransform: { height: this.s(18), margin: { bottom: 6 } }
|
|
3863
4090
|
}
|
|
3864
4091
|
), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
@@ -4401,8 +4628,37 @@ var AdminPanelUIModule = class {
|
|
|
4401
4628
|
playUrl(url) {
|
|
4402
4629
|
if (this.moderation.blocked) return;
|
|
4403
4630
|
this.currentVideoUrl = url;
|
|
4631
|
+
this.currentLockedChannel = null;
|
|
4404
4632
|
this.config.onVideoPlay?.(url);
|
|
4405
4633
|
}
|
|
4634
|
+
/**
|
|
4635
|
+
* A locked channel's play (thestatic.tv's stream lock, 2026-11-20): a queued video command carrying
|
|
4636
|
+
* `{ channel, locked: true }`, the owner's Play on Screen for a locked stream, a locked slot. This copy asks
|
|
4637
|
+
* thestatic.tv's door for the link, signed as this visitor (the client's stream link: one request in flight per
|
|
4638
|
+
* channel, the re-ask before it expires), and plays it through onVideoPlay only when admitted. A refusal plays
|
|
4639
|
+
* nothing; the notice and this tab's video line say LOCKED: TheStatic.tv citizens. A blocked visitor asks nothing.
|
|
4640
|
+
* The link itself is never kept for PLAYBACK Play or sent to the queue - the channel is.
|
|
4641
|
+
*/
|
|
4642
|
+
playLocked(channel) {
|
|
4643
|
+
if (this.moderation.blocked) return;
|
|
4644
|
+
const slug = channelOf(channel);
|
|
4645
|
+
if (!slug) {
|
|
4646
|
+
this.log("A locked play names no channel - nothing plays");
|
|
4647
|
+
return;
|
|
4648
|
+
}
|
|
4649
|
+
this.currentLockedChannel = slug;
|
|
4650
|
+
this.currentVideoUrl = null;
|
|
4651
|
+
this.client._playLockedChannel?.(slug, {
|
|
4652
|
+
deliver: (url) => {
|
|
4653
|
+
if (this.moderation.blocked) return;
|
|
4654
|
+
this.config.onVideoPlay?.(url);
|
|
4655
|
+
},
|
|
4656
|
+
stop: () => this.config.onVideoStop?.(),
|
|
4657
|
+
failed: (line) => {
|
|
4658
|
+
this.videoStatus = line;
|
|
4659
|
+
}
|
|
4660
|
+
});
|
|
4661
|
+
}
|
|
4406
4662
|
/**
|
|
4407
4663
|
* Toggle the admin panel open/closed
|
|
4408
4664
|
*/
|
|
@@ -4613,15 +4869,12 @@ var AdminPanelUIModule = class {
|
|
|
4613
4869
|
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
4614
4870
|
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
4615
4871
|
* came from the scene deployed at this scene's registered location. A wallet named in a query or
|
|
4616
|
-
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
4872
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites. The
|
|
4873
|
+
* request itself lives in utils/signed-request.ts since 2026-11-20 (it was here), so the locked
|
|
4874
|
+
* channel's door - which a Standard scene asks too, with no panel - goes through the same one.
|
|
4617
4875
|
*/
|
|
4618
4876
|
async signedRequest(url, init = {}) {
|
|
4619
|
-
|
|
4620
|
-
return {
|
|
4621
|
-
ok: res.ok,
|
|
4622
|
-
status: res.status,
|
|
4623
|
-
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
4624
|
-
};
|
|
4877
|
+
return signedRequest(url, init);
|
|
4625
4878
|
}
|
|
4626
4879
|
/**
|
|
4627
4880
|
* 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
|
|
@@ -4674,12 +4927,18 @@ var AdminPanelUIModule = class {
|
|
|
4674
4927
|
} else if (cmd.type === "privateMode" && this.venue) {
|
|
4675
4928
|
this.log("Received privateMode - re-reading my standing");
|
|
4676
4929
|
this.moderation.handleCommand(cmd.type, cmd.payload);
|
|
4930
|
+
} else if (VIDEO_PLAY_TYPES.has(cmd.type) && cmd.payload?.locked === true) {
|
|
4931
|
+
this.log("Received locked play:", cmd.type, cmd.payload.channel);
|
|
4932
|
+
this.playLocked(cmd.payload.channel);
|
|
4677
4933
|
} else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
|
|
4678
4934
|
this.log("Received video play:", cmd.type, cmd.payload.url);
|
|
4679
4935
|
this.playUrl(cmd.payload.url);
|
|
4680
4936
|
} else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
|
|
4681
4937
|
this.log("Received video stop/clear:", cmd.type);
|
|
4682
|
-
if (cmd.type === "videoClear")
|
|
4938
|
+
if (cmd.type === "videoClear") {
|
|
4939
|
+
this.currentVideoUrl = null;
|
|
4940
|
+
this.currentLockedChannel = null;
|
|
4941
|
+
}
|
|
4683
4942
|
this.config.onVideoStop?.();
|
|
4684
4943
|
} else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
|
|
4685
4944
|
const slotId = cmd.payload.slot;
|
|
@@ -4743,6 +5002,11 @@ var AdminPanelUIModule = class {
|
|
|
4743
5002
|
videoSlots: data.videoSlots || {}
|
|
4744
5003
|
};
|
|
4745
5004
|
if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
|
|
5005
|
+
const lockedCurrent = data.currentVideo?.locked === true ? channelOf(data.currentVideo.channel) : null;
|
|
5006
|
+
if (lockedCurrent) {
|
|
5007
|
+
this.currentLockedChannel = lockedCurrent;
|
|
5008
|
+
this.currentVideoUrl = null;
|
|
5009
|
+
}
|
|
4746
5010
|
this.videoStateFetched = true;
|
|
4747
5011
|
this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
|
|
4748
5012
|
}
|
|
@@ -4755,6 +5019,11 @@ var AdminPanelUIModule = class {
|
|
|
4755
5019
|
*/
|
|
4756
5020
|
playSlot(slotId) {
|
|
4757
5021
|
const slot = this.videoState?.videoSlots?.[slotId];
|
|
5022
|
+
if (slot?.locked === true) {
|
|
5023
|
+
this.log("Playing locked slot:", slotId);
|
|
5024
|
+
this.playLocked(slot.slug ?? slot.channel);
|
|
5025
|
+
return;
|
|
5026
|
+
}
|
|
4758
5027
|
if (slot?.url) {
|
|
4759
5028
|
this.log("Playing slot:", slotId, slot.url);
|
|
4760
5029
|
this.playUrl(slot.url);
|
|
@@ -4770,7 +5039,10 @@ var AdminPanelUIModule = class {
|
|
|
4770
5039
|
if (!this.videoState?.defaultSlot) return;
|
|
4771
5040
|
const defaultSlot = this.videoState.defaultSlot;
|
|
4772
5041
|
const slot = this.videoState.videoSlots?.[defaultSlot];
|
|
4773
|
-
if (slot?.
|
|
5042
|
+
if (slot?.locked === true) {
|
|
5043
|
+
this.log("Auto-playing locked default slot:", defaultSlot);
|
|
5044
|
+
this.playLocked(slot.slug ?? slot.channel);
|
|
5045
|
+
} else if (slot?.url) {
|
|
4774
5046
|
this.log("Auto-playing default slot:", defaultSlot);
|
|
4775
5047
|
this.playUrl(slot.url);
|
|
4776
5048
|
}
|
|
@@ -5250,8 +5522,25 @@ var AdminPanelUIModule = class {
|
|
|
5250
5522
|
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5251
5523
|
});
|
|
5252
5524
|
}
|
|
5253
|
-
/**
|
|
5254
|
-
|
|
5525
|
+
/**
|
|
5526
|
+
* 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
|
|
5527
|
+
* locked stream (2026-11-20: the /stream answer says locked, with its slug and no hlsUrl) plays here through the
|
|
5528
|
+
* link asked for signed as the owner, and queues `videoSetUrl { channel, locked: true }` - never a url, so every
|
|
5529
|
+
* visitor's copy asks for its own link and only the admitted play it.
|
|
5530
|
+
*/
|
|
5531
|
+
playStreamOnScreen() {
|
|
5532
|
+
const data = this.streamData;
|
|
5533
|
+
if (!data) return;
|
|
5534
|
+
if (data.locked === true) {
|
|
5535
|
+
const channel = channelOf(data.slug ?? data.channelId);
|
|
5536
|
+
if (!channel) return;
|
|
5537
|
+
this.playLocked(channel);
|
|
5538
|
+
this.sendSceneCommand("videoSetUrl", { channel, locked: true }, this.videoLine).catch(() => {
|
|
5539
|
+
});
|
|
5540
|
+
return;
|
|
5541
|
+
}
|
|
5542
|
+
const url = data.hlsUrl;
|
|
5543
|
+
if (!url) return;
|
|
5255
5544
|
this.playUrl(url);
|
|
5256
5545
|
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5257
5546
|
});
|
|
@@ -5269,6 +5558,13 @@ var AdminPanelUIModule = class {
|
|
|
5269
5558
|
*/
|
|
5270
5559
|
playbackPlay() {
|
|
5271
5560
|
this.config.onCommand?.("videoPlay", { playing: true });
|
|
5561
|
+
const locked = this.currentLockedChannel;
|
|
5562
|
+
if (locked) {
|
|
5563
|
+
this.playLocked(locked);
|
|
5564
|
+
this.sendSceneCommand("videoPlay", { channel: locked, locked: true }, this.videoLine).catch(() => {
|
|
5565
|
+
});
|
|
5566
|
+
return;
|
|
5567
|
+
}
|
|
5272
5568
|
const url = this.currentVideoUrl;
|
|
5273
5569
|
if (!url) {
|
|
5274
5570
|
this.videoStatus = "Not sent: no video";
|
|
@@ -5292,6 +5588,7 @@ var AdminPanelUIModule = class {
|
|
|
5292
5588
|
resetDefault() {
|
|
5293
5589
|
this.config.onCommand?.("videoClear", {});
|
|
5294
5590
|
this.currentVideoUrl = null;
|
|
5591
|
+
this.currentLockedChannel = null;
|
|
5295
5592
|
this.config.onVideoStop?.();
|
|
5296
5593
|
this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
|
|
5297
5594
|
});
|
|
@@ -5493,6 +5790,18 @@ var StaticTVClient = class {
|
|
|
5493
5790
|
this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
|
|
5494
5791
|
this.frames = new FramesModule(this);
|
|
5495
5792
|
if (config.frames) this.frames.register(config.frames);
|
|
5793
|
+
this.streamLink = new StreamLinkModule({
|
|
5794
|
+
doorUrl: () => {
|
|
5795
|
+
const sceneId = this.getSceneId();
|
|
5796
|
+
return sceneId ? `${this.apiUrl}/scene/${encodeURIComponent(sceneId)}/stream/play` : null;
|
|
5797
|
+
},
|
|
5798
|
+
post: (url, body) => signedRequest(url, { method: "POST", headers: { "Content-Type": "application/json" }, body }),
|
|
5799
|
+
blocked: () => this.isVisitorBlocked,
|
|
5800
|
+
notify: (line) => this.showNotification(line),
|
|
5801
|
+
setInterval: dclSetInterval,
|
|
5802
|
+
clearInterval: dclClearInterval,
|
|
5803
|
+
log: (msg, ...args) => this.log(msg, ...args)
|
|
5804
|
+
});
|
|
5496
5805
|
if (!config.apiKey) {
|
|
5497
5806
|
this._disabled = true;
|
|
5498
5807
|
this._keyType = null;
|
|
@@ -5684,6 +5993,7 @@ var StaticTVClient = class {
|
|
|
5684
5993
|
*/
|
|
5685
5994
|
playVideo(url) {
|
|
5686
5995
|
if (this.isVisitorBlocked) return;
|
|
5996
|
+
this.streamLink.playChanged(url);
|
|
5687
5997
|
const screen = this.config.videoScreen;
|
|
5688
5998
|
if (screen !== void 0) {
|
|
5689
5999
|
this.log(`Playing video: ${url}`);
|
|
@@ -5708,6 +6018,7 @@ var StaticTVClient = class {
|
|
|
5708
6018
|
*/
|
|
5709
6019
|
stopVideo() {
|
|
5710
6020
|
const screen = this.config.videoScreen;
|
|
6021
|
+
this.streamLink.cancel();
|
|
5711
6022
|
this._pendingVideoData = null;
|
|
5712
6023
|
this._streamVerified = false;
|
|
5713
6024
|
this._clearVerificationTimeout();
|
|
@@ -5866,10 +6177,48 @@ var StaticTVClient = class {
|
|
|
5866
6177
|
_handleGuideVideoSelect(video) {
|
|
5867
6178
|
if (!video.src) return;
|
|
5868
6179
|
if (this.isVisitorBlocked) return;
|
|
6180
|
+
this.streamLink.cancel();
|
|
6181
|
+
this._playGuideEntry(video);
|
|
6182
|
+
}
|
|
6183
|
+
/**
|
|
6184
|
+
* A guide entry with its url, onto the SDK's player and/or onVideoPlay, with the stream verification - an unlocked
|
|
6185
|
+
* pick's, and a locked one's once its link is in hand (2026-11-20; until then this was _handleGuideVideoSelect's body)
|
|
6186
|
+
* @internal
|
|
6187
|
+
*/
|
|
6188
|
+
_playGuideEntry(video) {
|
|
5869
6189
|
this._pendingVideoData = video;
|
|
5870
6190
|
const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
|
|
5871
6191
|
this._playVideoWithVerification(video, isLiveStream);
|
|
5872
6192
|
}
|
|
6193
|
+
/**
|
|
6194
|
+
* A locked channel's guide entry picked (thestatic.tv's stream lock, 2026-11-20). It carries no url: the SDK asks
|
|
6195
|
+
* thestatic.tv's door for the link, signed as this visitor, and only with a link in hand does the entry go on - to
|
|
6196
|
+
* the SDK's player and onVideoPlay as an unlocked pick does, and to the scene's own guideUI.onVideoSelect - with the
|
|
6197
|
+
* link as its src. Scenes' own handlers play `video.src` (TheStatic.tv HQ's, the templates'), so handing them the
|
|
6198
|
+
* entry before the answer would play an empty src, and on a refusal play what should not play: a refusal hands
|
|
6199
|
+
* nobody anything and shows LOCKED: TheStatic.tv citizens. Each fresh link before the old one expires goes the same
|
|
6200
|
+
* way (the re-ask); a re-ask refused stops the video. A blocked visitor asks nothing.
|
|
6201
|
+
* @internal
|
|
6202
|
+
*/
|
|
6203
|
+
_selectLockedGuideEntry(video) {
|
|
6204
|
+
if (this.isVisitorBlocked) return;
|
|
6205
|
+
this.streamLink.play(video.channel, {
|
|
6206
|
+
deliver: (url) => {
|
|
6207
|
+
const entry = { ...video, src: url };
|
|
6208
|
+
if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) this._playGuideEntry(entry);
|
|
6209
|
+
if (this.config.guideUI?.onVideoSelect) this.config.guideUI.onVideoSelect(entry);
|
|
6210
|
+
},
|
|
6211
|
+
stop: () => this.stopVideo()
|
|
6212
|
+
});
|
|
6213
|
+
}
|
|
6214
|
+
/**
|
|
6215
|
+
* A locked channel's play from the Admin Panel - a queued video command carrying `{ channel, locked: true }`, the
|
|
6216
|
+
* 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.
|
|
6217
|
+
* @internal
|
|
6218
|
+
*/
|
|
6219
|
+
_playLockedChannel(channel, handlers) {
|
|
6220
|
+
this.streamLink.play(channel, handlers);
|
|
6221
|
+
}
|
|
5873
6222
|
/**
|
|
5874
6223
|
* Play video with stream verification for live content
|
|
5875
6224
|
* Works with both videoScreen (SDK-managed) and onVideoPlay (user-managed) modes.
|
|
@@ -5992,6 +6341,7 @@ var StaticTVClient = class {
|
|
|
5992
6341
|
this.guideUI?.hide();
|
|
5993
6342
|
this.chatUI?.hide();
|
|
5994
6343
|
this.heartbeat?.stopWatching();
|
|
6344
|
+
this.streamLink.cancel();
|
|
5995
6345
|
this._pendingVideoData = null;
|
|
5996
6346
|
this._clearVerificationTimeout();
|
|
5997
6347
|
if (screen !== void 0 && import_ecs5.VideoPlayer.has(screen)) {
|
|
@@ -6033,6 +6383,10 @@ var StaticTVClient = class {
|
|
|
6033
6383
|
const guideConfig = {
|
|
6034
6384
|
...this.config.guideUI,
|
|
6035
6385
|
onVideoSelect: (video) => {
|
|
6386
|
+
if (video.locked === true) {
|
|
6387
|
+
this._selectLockedGuideEntry(video);
|
|
6388
|
+
return;
|
|
6389
|
+
}
|
|
6036
6390
|
if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) {
|
|
6037
6391
|
this._handleGuideVideoSelect(video);
|
|
6038
6392
|
}
|
|
@@ -6348,6 +6702,7 @@ var StaticTVClient = class {
|
|
|
6348
6702
|
this.log("StaticTVClient destroyed (was disabled)");
|
|
6349
6703
|
return;
|
|
6350
6704
|
}
|
|
6705
|
+
this.streamLink.cancel();
|
|
6351
6706
|
if (this.heartbeat) {
|
|
6352
6707
|
this.heartbeat.stopWatching();
|
|
6353
6708
|
}
|