@thestatic-tv/dcl-sdk 2.10.1 → 2.11.1
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 +401 -27
- package/dist/index.mjs +401 -27
- 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"));
|
|
@@ -3187,6 +3408,25 @@ function BlockedNotice(props) {
|
|
|
3187
3408
|
);
|
|
3188
3409
|
}
|
|
3189
3410
|
|
|
3411
|
+
// src/ui/trial-text.ts
|
|
3412
|
+
function trialHours(trialSparks) {
|
|
3413
|
+
if (typeof trialSparks !== "number" || !Number.isFinite(trialSparks) || trialSparks <= 0) return null;
|
|
3414
|
+
return Math.round(trialSparks / 60 * 10) / 10;
|
|
3415
|
+
}
|
|
3416
|
+
var hoursWord = (h) => h === 1 ? "hour" : "hours";
|
|
3417
|
+
function trialButtonText(trialSparks) {
|
|
3418
|
+
const h = trialHours(trialSparks);
|
|
3419
|
+
return h === null ? "Start Free Trial" : `Start Free ${h}-Hour Trial`;
|
|
3420
|
+
}
|
|
3421
|
+
function trialNoteText(trialSparks) {
|
|
3422
|
+
const h = trialHours(trialSparks);
|
|
3423
|
+
return h === null ? "One-time streaming trial" : `One-time trial \u2022 ${h} ${hoursWord(h)} of streaming`;
|
|
3424
|
+
}
|
|
3425
|
+
function trialActivatedText(hoursGranted) {
|
|
3426
|
+
const h = typeof hoursGranted === "number" && Number.isFinite(hoursGranted) && hoursGranted > 0 ? hoursGranted : null;
|
|
3427
|
+
return h === null ? "Streaming trial activated!" : `${h}-hour streaming trial activated!`;
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3190
3430
|
// src/utils/player-wait.ts
|
|
3191
3431
|
var PLAYER_WAIT_STEP_MS = 1e3;
|
|
3192
3432
|
var PLAYER_WAIT_MAX_MS = 30 * 1e3;
|
|
@@ -3506,6 +3746,7 @@ var ModerationModule = class {
|
|
|
3506
3746
|
};
|
|
3507
3747
|
|
|
3508
3748
|
// src/ui/admin-panel-ui.tsx
|
|
3749
|
+
var VIDEO_PLAY_TYPES = /* @__PURE__ */ new Set(["videoPlay", "videoSetUrl", "videoPlaySlot"]);
|
|
3509
3750
|
var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
|
|
3510
3751
|
function figuresOf(value) {
|
|
3511
3752
|
const figures = value?.figures;
|
|
@@ -3605,6 +3846,11 @@ var AdminPanelUIModule = class {
|
|
|
3605
3846
|
this.broadcastStatus = "";
|
|
3606
3847
|
/** 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
3848
|
this.currentVideoUrl = null;
|
|
3849
|
+
/**
|
|
3850
|
+
* The locked channel the screen last played (2026-11-20), in place of a url: PLAYBACK Play queues it again as
|
|
3851
|
+
* `{ channel, locked: true }` - a locked channel's link is this visitor's own and never goes into the queue
|
|
3852
|
+
*/
|
|
3853
|
+
this.currentLockedChannel = null;
|
|
3608
3854
|
// Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
|
|
3609
3855
|
// status line, and the once-a-load gates for the declaration's upload and the saved state's read
|
|
3610
3856
|
this.controls = [];
|
|
@@ -3683,12 +3929,12 @@ var AdminPanelUIModule = class {
|
|
|
3683
3929
|
{
|
|
3684
3930
|
uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
3685
3931
|
uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
|
|
3686
|
-
value: this.trialClaiming ? "Claiming..." :
|
|
3932
|
+
value: this.trialClaiming ? "Claiming..." : trialButtonText(this.streamData?.trialSparks),
|
|
3687
3933
|
fontSize: t.button,
|
|
3688
3934
|
color: C2.text,
|
|
3689
3935
|
onMouseDown: () => this.claimTrial()
|
|
3690
3936
|
}
|
|
3691
|
-
), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value:
|
|
3937
|
+
), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: trialNoteText(this.streamData?.trialSparks), fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3692
3938
|
import_react_ecs6.Button,
|
|
3693
3939
|
{
|
|
3694
3940
|
uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
@@ -3732,9 +3978,9 @@ var AdminPanelUIModule = class {
|
|
|
3732
3978
|
)), /* @__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
3979
|
import_react_ecs6.Label,
|
|
3734
3980
|
{
|
|
3735
|
-
value: this.streamData.hlsUrl || "Not available",
|
|
3981
|
+
value: this.streamData.locked === true ? LOCKED_LINE : this.streamData.hlsUrl || "Not available",
|
|
3736
3982
|
fontSize: t.label,
|
|
3737
|
-
color: this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
3983
|
+
color: this.streamData.locked === true ? C2.yellow : this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
3738
3984
|
uiTransform: { margin: { left: 6 } }
|
|
3739
3985
|
}
|
|
3740
3986
|
)), /* @__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 +4003,7 @@ var AdminPanelUIModule = class {
|
|
|
3757
4003
|
color: C2.text,
|
|
3758
4004
|
onMouseDown: () => this.stopStream()
|
|
3759
4005
|
}
|
|
3760
|
-
), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4006
|
+
), this.streamData.isLive && (this.streamData.hlsUrl || this.streamData.locked === true) && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3761
4007
|
import_react_ecs6.Button,
|
|
3762
4008
|
{
|
|
3763
4009
|
uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
@@ -3765,7 +4011,7 @@ var AdminPanelUIModule = class {
|
|
|
3765
4011
|
value: "Play on Screen",
|
|
3766
4012
|
fontSize: t.buttonSmall,
|
|
3767
4013
|
color: C2.text,
|
|
3768
|
-
onMouseDown: () => this.playStreamOnScreen(
|
|
4014
|
+
onMouseDown: () => this.playStreamOnScreen()
|
|
3769
4015
|
}
|
|
3770
4016
|
)), /* @__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
4017
|
import_react_ecs6.Button,
|
|
@@ -3858,7 +4104,7 @@ var AdminPanelUIModule = class {
|
|
|
3858
4104
|
{
|
|
3859
4105
|
value: this.videoStatus,
|
|
3860
4106
|
fontSize: t.status,
|
|
3861
|
-
color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
4107
|
+
color: this.videoStatus.startsWith("Not sent") || this.videoStatus === LOCKED_LINE || this.videoStatus === UNAVAILABLE_LINE ? C2.red : C2.green,
|
|
3862
4108
|
uiTransform: { height: this.s(18), margin: { bottom: 6 } }
|
|
3863
4109
|
}
|
|
3864
4110
|
), /* @__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 +4647,37 @@ var AdminPanelUIModule = class {
|
|
|
4401
4647
|
playUrl(url) {
|
|
4402
4648
|
if (this.moderation.blocked) return;
|
|
4403
4649
|
this.currentVideoUrl = url;
|
|
4650
|
+
this.currentLockedChannel = null;
|
|
4404
4651
|
this.config.onVideoPlay?.(url);
|
|
4405
4652
|
}
|
|
4653
|
+
/**
|
|
4654
|
+
* A locked channel's play (thestatic.tv's stream lock, 2026-11-20): a queued video command carrying
|
|
4655
|
+
* `{ channel, locked: true }`, the owner's Play on Screen for a locked stream, a locked slot. This copy asks
|
|
4656
|
+
* thestatic.tv's door for the link, signed as this visitor (the client's stream link: one request in flight per
|
|
4657
|
+
* channel, the re-ask before it expires), and plays it through onVideoPlay only when admitted. A refusal plays
|
|
4658
|
+
* nothing; the notice and this tab's video line say LOCKED: TheStatic.tv citizens. A blocked visitor asks nothing.
|
|
4659
|
+
* The link itself is never kept for PLAYBACK Play or sent to the queue - the channel is.
|
|
4660
|
+
*/
|
|
4661
|
+
playLocked(channel) {
|
|
4662
|
+
if (this.moderation.blocked) return;
|
|
4663
|
+
const slug = channelOf(channel);
|
|
4664
|
+
if (!slug) {
|
|
4665
|
+
this.log("A locked play names no channel - nothing plays");
|
|
4666
|
+
return;
|
|
4667
|
+
}
|
|
4668
|
+
this.currentLockedChannel = slug;
|
|
4669
|
+
this.currentVideoUrl = null;
|
|
4670
|
+
this.client._playLockedChannel?.(slug, {
|
|
4671
|
+
deliver: (url) => {
|
|
4672
|
+
if (this.moderation.blocked) return;
|
|
4673
|
+
this.config.onVideoPlay?.(url);
|
|
4674
|
+
},
|
|
4675
|
+
stop: () => this.config.onVideoStop?.(),
|
|
4676
|
+
failed: (line) => {
|
|
4677
|
+
this.videoStatus = line;
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
}
|
|
4406
4681
|
/**
|
|
4407
4682
|
* Toggle the admin panel open/closed
|
|
4408
4683
|
*/
|
|
@@ -4613,15 +4888,12 @@ var AdminPanelUIModule = class {
|
|
|
4613
4888
|
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
4614
4889
|
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
4615
4890
|
* 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.
|
|
4891
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites. The
|
|
4892
|
+
* request itself lives in utils/signed-request.ts since 2026-11-20 (it was here), so the locked
|
|
4893
|
+
* channel's door - which a Standard scene asks too, with no panel - goes through the same one.
|
|
4617
4894
|
*/
|
|
4618
4895
|
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
|
-
};
|
|
4896
|
+
return signedRequest(url, init);
|
|
4625
4897
|
}
|
|
4626
4898
|
/**
|
|
4627
4899
|
* 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 +4946,18 @@ var AdminPanelUIModule = class {
|
|
|
4674
4946
|
} else if (cmd.type === "privateMode" && this.venue) {
|
|
4675
4947
|
this.log("Received privateMode - re-reading my standing");
|
|
4676
4948
|
this.moderation.handleCommand(cmd.type, cmd.payload);
|
|
4949
|
+
} else if (VIDEO_PLAY_TYPES.has(cmd.type) && cmd.payload?.locked === true) {
|
|
4950
|
+
this.log("Received locked play:", cmd.type, cmd.payload.channel);
|
|
4951
|
+
this.playLocked(cmd.payload.channel);
|
|
4677
4952
|
} else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
|
|
4678
4953
|
this.log("Received video play:", cmd.type, cmd.payload.url);
|
|
4679
4954
|
this.playUrl(cmd.payload.url);
|
|
4680
4955
|
} else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
|
|
4681
4956
|
this.log("Received video stop/clear:", cmd.type);
|
|
4682
|
-
if (cmd.type === "videoClear")
|
|
4957
|
+
if (cmd.type === "videoClear") {
|
|
4958
|
+
this.currentVideoUrl = null;
|
|
4959
|
+
this.currentLockedChannel = null;
|
|
4960
|
+
}
|
|
4683
4961
|
this.config.onVideoStop?.();
|
|
4684
4962
|
} else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
|
|
4685
4963
|
const slotId = cmd.payload.slot;
|
|
@@ -4743,6 +5021,11 @@ var AdminPanelUIModule = class {
|
|
|
4743
5021
|
videoSlots: data.videoSlots || {}
|
|
4744
5022
|
};
|
|
4745
5023
|
if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
|
|
5024
|
+
const lockedCurrent = data.currentVideo?.locked === true ? channelOf(data.currentVideo.channel) : null;
|
|
5025
|
+
if (lockedCurrent) {
|
|
5026
|
+
this.currentLockedChannel = lockedCurrent;
|
|
5027
|
+
this.currentVideoUrl = null;
|
|
5028
|
+
}
|
|
4746
5029
|
this.videoStateFetched = true;
|
|
4747
5030
|
this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
|
|
4748
5031
|
}
|
|
@@ -4755,6 +5038,11 @@ var AdminPanelUIModule = class {
|
|
|
4755
5038
|
*/
|
|
4756
5039
|
playSlot(slotId) {
|
|
4757
5040
|
const slot = this.videoState?.videoSlots?.[slotId];
|
|
5041
|
+
if (slot?.locked === true) {
|
|
5042
|
+
this.log("Playing locked slot:", slotId);
|
|
5043
|
+
this.playLocked(slot.slug ?? slot.channel);
|
|
5044
|
+
return;
|
|
5045
|
+
}
|
|
4758
5046
|
if (slot?.url) {
|
|
4759
5047
|
this.log("Playing slot:", slotId, slot.url);
|
|
4760
5048
|
this.playUrl(slot.url);
|
|
@@ -4770,7 +5058,10 @@ var AdminPanelUIModule = class {
|
|
|
4770
5058
|
if (!this.videoState?.defaultSlot) return;
|
|
4771
5059
|
const defaultSlot = this.videoState.defaultSlot;
|
|
4772
5060
|
const slot = this.videoState.videoSlots?.[defaultSlot];
|
|
4773
|
-
if (slot?.
|
|
5061
|
+
if (slot?.locked === true) {
|
|
5062
|
+
this.log("Auto-playing locked default slot:", defaultSlot);
|
|
5063
|
+
this.playLocked(slot.slug ?? slot.channel);
|
|
5064
|
+
} else if (slot?.url) {
|
|
4774
5065
|
this.log("Auto-playing default slot:", defaultSlot);
|
|
4775
5066
|
this.playUrl(slot.url);
|
|
4776
5067
|
}
|
|
@@ -4824,7 +5115,7 @@ var AdminPanelUIModule = class {
|
|
|
4824
5115
|
this.log("Trial claimed:", data.channel);
|
|
4825
5116
|
this.streamFetched = false;
|
|
4826
5117
|
await this.fetchStreamData();
|
|
4827
|
-
this.config.onBroadcast?.(
|
|
5118
|
+
this.config.onBroadcast?.(trialActivatedText(data.trial?.hoursGranted));
|
|
4828
5119
|
} else {
|
|
4829
5120
|
this.trialClaimError = data.error || "Failed to claim trial";
|
|
4830
5121
|
this.log("Trial claim failed:", data.error);
|
|
@@ -5250,8 +5541,25 @@ var AdminPanelUIModule = class {
|
|
|
5250
5541
|
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5251
5542
|
});
|
|
5252
5543
|
}
|
|
5253
|
-
/**
|
|
5254
|
-
|
|
5544
|
+
/**
|
|
5545
|
+
* 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
|
|
5546
|
+
* locked stream (2026-11-20: the /stream answer says locked, with its slug and no hlsUrl) plays here through the
|
|
5547
|
+
* link asked for signed as the owner, and queues `videoSetUrl { channel, locked: true }` - never a url, so every
|
|
5548
|
+
* visitor's copy asks for its own link and only the admitted play it.
|
|
5549
|
+
*/
|
|
5550
|
+
playStreamOnScreen() {
|
|
5551
|
+
const data = this.streamData;
|
|
5552
|
+
if (!data) return;
|
|
5553
|
+
if (data.locked === true) {
|
|
5554
|
+
const channel = channelOf(data.slug ?? data.channelId);
|
|
5555
|
+
if (!channel) return;
|
|
5556
|
+
this.playLocked(channel);
|
|
5557
|
+
this.sendSceneCommand("videoSetUrl", { channel, locked: true }, this.videoLine).catch(() => {
|
|
5558
|
+
});
|
|
5559
|
+
return;
|
|
5560
|
+
}
|
|
5561
|
+
const url = data.hlsUrl;
|
|
5562
|
+
if (!url) return;
|
|
5255
5563
|
this.playUrl(url);
|
|
5256
5564
|
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5257
5565
|
});
|
|
@@ -5269,6 +5577,13 @@ var AdminPanelUIModule = class {
|
|
|
5269
5577
|
*/
|
|
5270
5578
|
playbackPlay() {
|
|
5271
5579
|
this.config.onCommand?.("videoPlay", { playing: true });
|
|
5580
|
+
const locked = this.currentLockedChannel;
|
|
5581
|
+
if (locked) {
|
|
5582
|
+
this.playLocked(locked);
|
|
5583
|
+
this.sendSceneCommand("videoPlay", { channel: locked, locked: true }, this.videoLine).catch(() => {
|
|
5584
|
+
});
|
|
5585
|
+
return;
|
|
5586
|
+
}
|
|
5272
5587
|
const url = this.currentVideoUrl;
|
|
5273
5588
|
if (!url) {
|
|
5274
5589
|
this.videoStatus = "Not sent: no video";
|
|
@@ -5292,6 +5607,7 @@ var AdminPanelUIModule = class {
|
|
|
5292
5607
|
resetDefault() {
|
|
5293
5608
|
this.config.onCommand?.("videoClear", {});
|
|
5294
5609
|
this.currentVideoUrl = null;
|
|
5610
|
+
this.currentLockedChannel = null;
|
|
5295
5611
|
this.config.onVideoStop?.();
|
|
5296
5612
|
this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
|
|
5297
5613
|
});
|
|
@@ -5493,6 +5809,18 @@ var StaticTVClient = class {
|
|
|
5493
5809
|
this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
|
|
5494
5810
|
this.frames = new FramesModule(this);
|
|
5495
5811
|
if (config.frames) this.frames.register(config.frames);
|
|
5812
|
+
this.streamLink = new StreamLinkModule({
|
|
5813
|
+
doorUrl: () => {
|
|
5814
|
+
const sceneId = this.getSceneId();
|
|
5815
|
+
return sceneId ? `${this.apiUrl}/scene/${encodeURIComponent(sceneId)}/stream/play` : null;
|
|
5816
|
+
},
|
|
5817
|
+
post: (url, body) => signedRequest(url, { method: "POST", headers: { "Content-Type": "application/json" }, body }),
|
|
5818
|
+
blocked: () => this.isVisitorBlocked,
|
|
5819
|
+
notify: (line) => this.showNotification(line),
|
|
5820
|
+
setInterval: dclSetInterval,
|
|
5821
|
+
clearInterval: dclClearInterval,
|
|
5822
|
+
log: (msg, ...args) => this.log(msg, ...args)
|
|
5823
|
+
});
|
|
5496
5824
|
if (!config.apiKey) {
|
|
5497
5825
|
this._disabled = true;
|
|
5498
5826
|
this._keyType = null;
|
|
@@ -5684,6 +6012,7 @@ var StaticTVClient = class {
|
|
|
5684
6012
|
*/
|
|
5685
6013
|
playVideo(url) {
|
|
5686
6014
|
if (this.isVisitorBlocked) return;
|
|
6015
|
+
this.streamLink.playChanged(url);
|
|
5687
6016
|
const screen = this.config.videoScreen;
|
|
5688
6017
|
if (screen !== void 0) {
|
|
5689
6018
|
this.log(`Playing video: ${url}`);
|
|
@@ -5708,6 +6037,7 @@ var StaticTVClient = class {
|
|
|
5708
6037
|
*/
|
|
5709
6038
|
stopVideo() {
|
|
5710
6039
|
const screen = this.config.videoScreen;
|
|
6040
|
+
this.streamLink.cancel();
|
|
5711
6041
|
this._pendingVideoData = null;
|
|
5712
6042
|
this._streamVerified = false;
|
|
5713
6043
|
this._clearVerificationTimeout();
|
|
@@ -5866,10 +6196,48 @@ var StaticTVClient = class {
|
|
|
5866
6196
|
_handleGuideVideoSelect(video) {
|
|
5867
6197
|
if (!video.src) return;
|
|
5868
6198
|
if (this.isVisitorBlocked) return;
|
|
6199
|
+
this.streamLink.cancel();
|
|
6200
|
+
this._playGuideEntry(video);
|
|
6201
|
+
}
|
|
6202
|
+
/**
|
|
6203
|
+
* A guide entry with its url, onto the SDK's player and/or onVideoPlay, with the stream verification - an unlocked
|
|
6204
|
+
* pick's, and a locked one's once its link is in hand (2026-11-20; until then this was _handleGuideVideoSelect's body)
|
|
6205
|
+
* @internal
|
|
6206
|
+
*/
|
|
6207
|
+
_playGuideEntry(video) {
|
|
5869
6208
|
this._pendingVideoData = video;
|
|
5870
6209
|
const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
|
|
5871
6210
|
this._playVideoWithVerification(video, isLiveStream);
|
|
5872
6211
|
}
|
|
6212
|
+
/**
|
|
6213
|
+
* A locked channel's guide entry picked (thestatic.tv's stream lock, 2026-11-20). It carries no url: the SDK asks
|
|
6214
|
+
* thestatic.tv's door for the link, signed as this visitor, and only with a link in hand does the entry go on - to
|
|
6215
|
+
* the SDK's player and onVideoPlay as an unlocked pick does, and to the scene's own guideUI.onVideoSelect - with the
|
|
6216
|
+
* link as its src. Scenes' own handlers play `video.src` (TheStatic.tv HQ's, the templates'), so handing them the
|
|
6217
|
+
* entry before the answer would play an empty src, and on a refusal play what should not play: a refusal hands
|
|
6218
|
+
* nobody anything and shows LOCKED: TheStatic.tv citizens. Each fresh link before the old one expires goes the same
|
|
6219
|
+
* way (the re-ask); a re-ask refused stops the video. A blocked visitor asks nothing.
|
|
6220
|
+
* @internal
|
|
6221
|
+
*/
|
|
6222
|
+
_selectLockedGuideEntry(video) {
|
|
6223
|
+
if (this.isVisitorBlocked) return;
|
|
6224
|
+
this.streamLink.play(video.channel, {
|
|
6225
|
+
deliver: (url) => {
|
|
6226
|
+
const entry = { ...video, src: url };
|
|
6227
|
+
if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) this._playGuideEntry(entry);
|
|
6228
|
+
if (this.config.guideUI?.onVideoSelect) this.config.guideUI.onVideoSelect(entry);
|
|
6229
|
+
},
|
|
6230
|
+
stop: () => this.stopVideo()
|
|
6231
|
+
});
|
|
6232
|
+
}
|
|
6233
|
+
/**
|
|
6234
|
+
* A locked channel's play from the Admin Panel - a queued video command carrying `{ channel, locked: true }`, the
|
|
6235
|
+
* 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.
|
|
6236
|
+
* @internal
|
|
6237
|
+
*/
|
|
6238
|
+
_playLockedChannel(channel, handlers) {
|
|
6239
|
+
this.streamLink.play(channel, handlers);
|
|
6240
|
+
}
|
|
5873
6241
|
/**
|
|
5874
6242
|
* Play video with stream verification for live content
|
|
5875
6243
|
* Works with both videoScreen (SDK-managed) and onVideoPlay (user-managed) modes.
|
|
@@ -5992,6 +6360,7 @@ var StaticTVClient = class {
|
|
|
5992
6360
|
this.guideUI?.hide();
|
|
5993
6361
|
this.chatUI?.hide();
|
|
5994
6362
|
this.heartbeat?.stopWatching();
|
|
6363
|
+
this.streamLink.cancel();
|
|
5995
6364
|
this._pendingVideoData = null;
|
|
5996
6365
|
this._clearVerificationTimeout();
|
|
5997
6366
|
if (screen !== void 0 && import_ecs5.VideoPlayer.has(screen)) {
|
|
@@ -6033,6 +6402,10 @@ var StaticTVClient = class {
|
|
|
6033
6402
|
const guideConfig = {
|
|
6034
6403
|
...this.config.guideUI,
|
|
6035
6404
|
onVideoSelect: (video) => {
|
|
6405
|
+
if (video.locked === true) {
|
|
6406
|
+
this._selectLockedGuideEntry(video);
|
|
6407
|
+
return;
|
|
6408
|
+
}
|
|
6036
6409
|
if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) {
|
|
6037
6410
|
this._handleGuideVideoSelect(video);
|
|
6038
6411
|
}
|
|
@@ -6348,6 +6721,7 @@ var StaticTVClient = class {
|
|
|
6348
6721
|
this.log("StaticTVClient destroyed (was disabled)");
|
|
6349
6722
|
return;
|
|
6350
6723
|
}
|
|
6724
|
+
this.streamLink.cancel();
|
|
6351
6725
|
if (this.heartbeat) {
|
|
6352
6726
|
this.heartbeat.stopWatching();
|
|
6353
6727
|
}
|