@thestatic-tv/dcl-sdk 2.9.0 → 2.10.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 +141 -2
- package/dist/index.d.mts +536 -6
- package/dist/index.d.ts +536 -6
- package/dist/index.js +1632 -230
- package/dist/index.mjs +1616 -217
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,16 +32,19 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AdminPanelUIModule: () => AdminPanelUIModule,
|
|
34
34
|
ChatUIModule: () => ChatUIModule,
|
|
35
|
+
FramesModule: () => FramesModule,
|
|
35
36
|
GuideModule: () => GuideModule,
|
|
36
37
|
GuideUIModule: () => GuideUIModule,
|
|
37
38
|
HeartbeatModule: () => HeartbeatModule,
|
|
38
39
|
InteractionsModule: () => InteractionsModule,
|
|
39
40
|
KEY_TYPE_CHANNEL: () => KEY_TYPE_CHANNEL,
|
|
40
41
|
KEY_TYPE_SCENE: () => KEY_TYPE_SCENE,
|
|
42
|
+
ModerationModule: () => ModerationModule,
|
|
41
43
|
NotificationBanner: () => NotificationBanner,
|
|
42
44
|
SessionModule: () => SessionModule,
|
|
43
45
|
StaticTVClient: () => StaticTVClient,
|
|
44
46
|
fetchUserData: () => fetchUserData,
|
|
47
|
+
getParcelRects: () => getParcelRects,
|
|
45
48
|
getPlayerDisplayName: () => getPlayerDisplayName,
|
|
46
49
|
getPlayerPosition: () => getPlayerPosition,
|
|
47
50
|
getPlayerWallet: () => getPlayerWallet,
|
|
@@ -65,7 +68,7 @@ async function request(url, options = {}) {
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
// src/StaticTVClient.ts
|
|
68
|
-
var
|
|
71
|
+
var import_SignedFetch4 = require("~system/SignedFetch");
|
|
69
72
|
|
|
70
73
|
// src/modules/guide.ts
|
|
71
74
|
var GuideModule = class {
|
|
@@ -257,7 +260,83 @@ function dclClearTimeout(timeoutId) {
|
|
|
257
260
|
// src/utils/bounds.ts
|
|
258
261
|
var import_ecs2 = require("@dcl/sdk/ecs");
|
|
259
262
|
var import_Runtime = require("~system/Runtime");
|
|
263
|
+
|
|
264
|
+
// src/utils/walls.ts
|
|
260
265
|
var PARCEL_SIZE = 16;
|
|
266
|
+
var EDGE_STRIP = 1;
|
|
267
|
+
var WALL_TOP_MAX = 32;
|
|
268
|
+
function heightLimit(parcels) {
|
|
269
|
+
return Math.log2(parcels + 1) * 20;
|
|
270
|
+
}
|
|
271
|
+
function wallTop(parcels) {
|
|
272
|
+
return Math.min(WALL_TOP_MAX, heightLimit(parcels) - 4);
|
|
273
|
+
}
|
|
274
|
+
function parcelRects(parcels, base) {
|
|
275
|
+
const parse = (p) => {
|
|
276
|
+
const parts = String(p).split(",");
|
|
277
|
+
if (parts.length !== 2) return null;
|
|
278
|
+
const [x, z] = parts.map((n) => parseInt(n, 10));
|
|
279
|
+
return Number.isFinite(x) && Number.isFinite(z) ? { x, z } : null;
|
|
280
|
+
};
|
|
281
|
+
const coords = parcels.map(parse).filter((c) => c !== null);
|
|
282
|
+
const origin = base && parse(base) || coords[0];
|
|
283
|
+
if (!origin) return [];
|
|
284
|
+
return coords.map((c) => {
|
|
285
|
+
const minX = (c.x - origin.x) * PARCEL_SIZE;
|
|
286
|
+
const minZ = (c.z - origin.z) * PARCEL_SIZE;
|
|
287
|
+
return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function outerSides(rect, rects) {
|
|
291
|
+
const at = (minX, minZ) => rects.some((r) => r.minX === minX && r.minZ === minZ);
|
|
292
|
+
const sides = [];
|
|
293
|
+
if (!at(rect.minX - PARCEL_SIZE, rect.minZ)) sides.push("west");
|
|
294
|
+
if (!at(rect.minX + PARCEL_SIZE, rect.minZ)) sides.push("east");
|
|
295
|
+
if (!at(rect.minX, rect.minZ - PARCEL_SIZE)) sides.push("south");
|
|
296
|
+
if (!at(rect.minX, rect.minZ + PARCEL_SIZE)) sides.push("north");
|
|
297
|
+
return sides;
|
|
298
|
+
}
|
|
299
|
+
function wallBoxes(rects, strip = EDGE_STRIP, top = wallTop(rects.length)) {
|
|
300
|
+
return rects.map((r) => {
|
|
301
|
+
const outer = outerSides(r, rects);
|
|
302
|
+
return {
|
|
303
|
+
minX: r.minX + (outer.includes("west") ? strip : 0),
|
|
304
|
+
maxX: r.maxX - (outer.includes("east") ? strip : 0),
|
|
305
|
+
minZ: r.minZ + (outer.includes("south") ? strip : 0),
|
|
306
|
+
maxZ: r.maxZ - (outer.includes("north") ? strip : 0),
|
|
307
|
+
top
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function inParcels(p, rects) {
|
|
312
|
+
return rects.some((r) => p.x >= r.minX && p.x <= r.maxX && p.z >= r.minZ && p.z <= r.maxZ);
|
|
313
|
+
}
|
|
314
|
+
function insideWalls(p, boxes) {
|
|
315
|
+
return boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ && p.y < b.top);
|
|
316
|
+
}
|
|
317
|
+
var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
318
|
+
function ejectPoint(boxes, rects, from) {
|
|
319
|
+
const IN = 0.5;
|
|
320
|
+
const p = from || { x: 0, y: 0, z: 0 };
|
|
321
|
+
let best = null;
|
|
322
|
+
let bestDistance = Infinity;
|
|
323
|
+
rects.forEach((rect, i) => {
|
|
324
|
+
const b = boxes[i];
|
|
325
|
+
if (!b) return;
|
|
326
|
+
const along = (lo, hi, v) => clamp(v, lo + IN, hi - IN);
|
|
327
|
+
for (const side of outerSides(rect, rects)) {
|
|
328
|
+
const point = side === "west" ? { x: b.minX + IN, z: along(b.minZ, b.maxZ, p.z) } : side === "east" ? { x: b.maxX - IN, z: along(b.minZ, b.maxZ, p.z) } : side === "south" ? { x: along(b.minX, b.maxX, p.x), z: b.minZ + IN } : { x: along(b.minX, b.maxX, p.x), z: b.maxZ - IN };
|
|
329
|
+
const distance = Math.hypot(point.x - p.x, point.z - p.z);
|
|
330
|
+
if (distance < bestDistance) {
|
|
331
|
+
bestDistance = distance;
|
|
332
|
+
best = { x: point.x, y: b.top + 1, z: point.z };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return best;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/utils/bounds.ts
|
|
261
340
|
var cachedBounds = null;
|
|
262
341
|
var cachedParcelRects = [];
|
|
263
342
|
var boundsInitialized = false;
|
|
@@ -300,11 +379,7 @@ async function getSceneBounds() {
|
|
|
300
379
|
boundsError = true;
|
|
301
380
|
return null;
|
|
302
381
|
}
|
|
303
|
-
cachedParcelRects =
|
|
304
|
-
const minX = (c.x - base.x) * PARCEL_SIZE;
|
|
305
|
-
const minZ = (c.z - base.z) * PARCEL_SIZE;
|
|
306
|
-
return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
|
|
307
|
-
});
|
|
382
|
+
cachedParcelRects = parcelRects(parcels, baseParcel);
|
|
308
383
|
const worldMinX = Math.min(...coords.map((c) => c.x));
|
|
309
384
|
const worldMaxX = Math.max(...coords.map((c) => c.x));
|
|
310
385
|
const worldMinZ = Math.min(...coords.map((c) => c.z));
|
|
@@ -340,6 +415,9 @@ function isPlayerInBounds(_bounds) {
|
|
|
340
415
|
return false;
|
|
341
416
|
}
|
|
342
417
|
}
|
|
418
|
+
function getParcelRects() {
|
|
419
|
+
return cachedParcelRects.map((r) => ({ ...r }));
|
|
420
|
+
}
|
|
343
421
|
function getPlayerPosition() {
|
|
344
422
|
try {
|
|
345
423
|
const transform = import_ecs2.Transform.getOrNull(import_ecs2.engine.PlayerEntity);
|
|
@@ -482,7 +560,7 @@ var SessionModule = class {
|
|
|
482
560
|
this._tier = normalizeTier(response.sdkType);
|
|
483
561
|
this.startHeartbeat();
|
|
484
562
|
this.client.log(`Session started: ${this.sessionId}, tier: ${this._tier}`);
|
|
485
|
-
this.client._enableFeaturesForTier(this._tier, this._keyId);
|
|
563
|
+
this.client._enableFeaturesForTier(this._tier, this._keyId, this._tier === "pro" && response.venue === true);
|
|
486
564
|
return this.sessionId;
|
|
487
565
|
}
|
|
488
566
|
this.client._settleFeaturesAsFree();
|
|
@@ -741,10 +819,280 @@ var InteractionsModule = class {
|
|
|
741
819
|
}
|
|
742
820
|
};
|
|
743
821
|
|
|
822
|
+
// src/modules/frames.ts
|
|
823
|
+
var import_SignedFetch = require("~system/SignedFetch");
|
|
824
|
+
var import_RestrictedActions = require("~system/RestrictedActions");
|
|
825
|
+
var FRAMES_MAX = 64;
|
|
826
|
+
var REFRESH_JITTER_MS = 3e3;
|
|
827
|
+
var DEFAULT_VERSION = "default";
|
|
828
|
+
var IMAGE_MAX = 1e3;
|
|
829
|
+
var TEXT_MAX = 120;
|
|
830
|
+
var LINK_MAX = 1e3;
|
|
831
|
+
var VERSION_MAX = 40;
|
|
832
|
+
var HTTPS = /^https:/i;
|
|
833
|
+
function isSceneFrame(value) {
|
|
834
|
+
if (!value || typeof value !== "object") return false;
|
|
835
|
+
const f = value;
|
|
836
|
+
if (typeof f.id !== "string" || typeof f.label !== "string" || typeof f.onContent !== "function") return false;
|
|
837
|
+
const d = f.default;
|
|
838
|
+
if (d === void 0 || d === null) return true;
|
|
839
|
+
if (typeof d !== "object") return false;
|
|
840
|
+
const { image, text, link } = d;
|
|
841
|
+
return typeof image === "string" && (text === void 0 || typeof text === "string") && (link === void 0 || typeof link === "string");
|
|
842
|
+
}
|
|
843
|
+
function defaultContent(frame) {
|
|
844
|
+
const d = frame.default;
|
|
845
|
+
if (!d) return null;
|
|
846
|
+
return { image: d.image, text: d.text || "", link: d.link || "", version: DEFAULT_VERSION };
|
|
847
|
+
}
|
|
848
|
+
function savedContent(value) {
|
|
849
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
850
|
+
const v = value;
|
|
851
|
+
const image = v.image;
|
|
852
|
+
const text = v.text === void 0 || v.text === null ? "" : v.text;
|
|
853
|
+
const link = v.link === void 0 || v.link === null ? "" : v.link;
|
|
854
|
+
const version = v.version;
|
|
855
|
+
if (typeof image !== "string" || image.length > IMAGE_MAX || !HTTPS.test(image)) return null;
|
|
856
|
+
if (typeof text !== "string" || text.length > TEXT_MAX) return null;
|
|
857
|
+
if (typeof link !== "string" || link.length > LINK_MAX || link !== "" && !HTTPS.test(link)) return null;
|
|
858
|
+
if (typeof version !== "string" || version === "" || version.length > VERSION_MAX) return null;
|
|
859
|
+
return { image, text, link, version };
|
|
860
|
+
}
|
|
861
|
+
function sameContent(a, b) {
|
|
862
|
+
return b !== null && a.image === b.image && a.text === b.text && a.link === b.link && a.version === b.version;
|
|
863
|
+
}
|
|
864
|
+
function errorOf(body) {
|
|
865
|
+
try {
|
|
866
|
+
const data = body ? JSON.parse(body) : null;
|
|
867
|
+
return data && typeof data.error === "string" ? data.error : "";
|
|
868
|
+
} catch {
|
|
869
|
+
return "";
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
var FramesModule = class {
|
|
873
|
+
constructor(host) {
|
|
874
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
875
|
+
/** Venue is known: the reads, the upload and the clicks may go */
|
|
876
|
+
this.enabled = false;
|
|
877
|
+
/** This copy's admin check succeeded: the declaration may be uploaded */
|
|
878
|
+
this.adminOk = false;
|
|
879
|
+
this.uploaded = false;
|
|
880
|
+
this.loadReadStarted = false;
|
|
881
|
+
/** The last good read's `frames` object (saved content by frame id), or null until a read succeeds */
|
|
882
|
+
this.answer = null;
|
|
883
|
+
/** Reads are numbered as they start; an answer older than the one shown is dropped */
|
|
884
|
+
this.readSeq = 0;
|
|
885
|
+
this.shownSeq = 0;
|
|
886
|
+
/** A framesRefresh is waiting out its jitter: another inside the wait shares its read */
|
|
887
|
+
this.refreshWaiting = false;
|
|
888
|
+
this.host = host;
|
|
889
|
+
}
|
|
890
|
+
/** The declared frames' ids, in the order they were first registered */
|
|
891
|
+
get ids() {
|
|
892
|
+
return [...this.entries.keys()];
|
|
893
|
+
}
|
|
894
|
+
/** True once Venue is known for this scene */
|
|
895
|
+
get isEnabled() {
|
|
896
|
+
return this.enabled;
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Declare frames: kept until Venue is known; after, a frame registered now gets what the last read gave at once,
|
|
900
|
+
* and the load read and the upload that waited on frames go now (each still once a load)
|
|
901
|
+
*/
|
|
902
|
+
register(frames) {
|
|
903
|
+
if (!Array.isArray(frames)) {
|
|
904
|
+
this.host.log("registerFrames skipped - not a list of frames");
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
for (const frame of frames) {
|
|
908
|
+
if (!isSceneFrame(frame)) {
|
|
909
|
+
this.host.log("Frame skipped - not a SceneFrame:", frame);
|
|
910
|
+
continue;
|
|
911
|
+
}
|
|
912
|
+
if (!this.entries.has(frame.id) && this.entries.size >= FRAMES_MAX) {
|
|
913
|
+
this.host.warn(`Frame ${frame.id} skipped - at most ${FRAMES_MAX} frames a scene`);
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
this.entries.set(frame.id, { frame, shown: null });
|
|
917
|
+
}
|
|
918
|
+
this.host.log("Registered frames:", this.ids);
|
|
919
|
+
if (!this.enabled) return;
|
|
920
|
+
this.apply();
|
|
921
|
+
this.loadRead();
|
|
922
|
+
this.upload().catch(() => {
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
/** Venue is known (the client calls this once the session confirms it): the load read, and the upload if it waited */
|
|
926
|
+
enable() {
|
|
927
|
+
if (this.enabled) return;
|
|
928
|
+
this.enabled = true;
|
|
929
|
+
this.loadRead();
|
|
930
|
+
this.upload().catch(() => {
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
/** This copy's admin check succeeded (the admin panel calls this): the declaration goes up once Venue is known */
|
|
934
|
+
adminCheckSucceeded() {
|
|
935
|
+
this.adminOk = true;
|
|
936
|
+
this.upload().catch(() => {
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* A queued framesRefresh (the scene's page saved or reset a frame): read again after a random wait of up to
|
|
941
|
+
* REFRESH_JITTER_MS. Refreshes that arrive inside the wait share its read.
|
|
942
|
+
*/
|
|
943
|
+
refresh() {
|
|
944
|
+
if (!this.enabled || this.entries.size === 0 || this.refreshWaiting) return;
|
|
945
|
+
this.refreshWaiting = true;
|
|
946
|
+
const wait = Math.floor(Math.random() * REFRESH_JITTER_MS);
|
|
947
|
+
this.host.log(`Frames refresh in ${wait} ms`);
|
|
948
|
+
dclSetTimeout(() => {
|
|
949
|
+
this.refreshWaiting = false;
|
|
950
|
+
this.loadReadStarted = true;
|
|
951
|
+
this.read().catch(() => {
|
|
952
|
+
});
|
|
953
|
+
}, wait);
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* A visitor clicked a frame. The link opens when it is an https: one: the shown content's, else the frame's default's
|
|
957
|
+
* - so a scene without Venue (or before its read lands), which shows its own defaults, has no dead frames. The click is
|
|
958
|
+
* posted signed under the shown version (fire and forget; a failure is logged, never shown) only with Venue and
|
|
959
|
+
* something shown. An id not declared opens nothing and posts nothing.
|
|
960
|
+
*/
|
|
961
|
+
open(id) {
|
|
962
|
+
const entry = typeof id === "string" ? this.entries.get(id) : void 0;
|
|
963
|
+
if (!entry) {
|
|
964
|
+
this.host.log("openFrame: no frame declared with this id:", id);
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
const shown = entry.shown;
|
|
968
|
+
if (this.enabled && shown) this.postClick(entry.frame.id, shown.version).catch(() => {
|
|
969
|
+
});
|
|
970
|
+
else this.host.log("openFrame: no click counted - no Venue, or the frame shows nothing yet:", id);
|
|
971
|
+
const link = shown ? shown.link : entry.frame.default?.link || "";
|
|
972
|
+
if (link !== "" && HTTPS.test(link)) {
|
|
973
|
+
try {
|
|
974
|
+
Promise.resolve((0, import_RestrictedActions.openExternalUrl)({ url: link })).catch((err) => this.host.log("Frame link not opened:", err));
|
|
975
|
+
} catch (err) {
|
|
976
|
+
this.host.log("Frame link not opened:", err);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
/** The routes' base for this scene: the scene id encoded, as any value in a url path is */
|
|
981
|
+
sceneUrl() {
|
|
982
|
+
const sceneId = this.host.getSceneId();
|
|
983
|
+
if (!sceneId) return null;
|
|
984
|
+
return `${this.host.getBaseUrl()}/scene/${encodeURIComponent(sceneId)}`;
|
|
985
|
+
}
|
|
986
|
+
/** The read at load: once, when Venue is known and a frame is declared */
|
|
987
|
+
loadRead() {
|
|
988
|
+
if (this.loadReadStarted || !this.enabled || this.entries.size === 0) return;
|
|
989
|
+
this.loadReadStarted = true;
|
|
990
|
+
this.read().catch(() => {
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
/** Read the saved content and show it; a failed read keeps what was shown */
|
|
994
|
+
async read() {
|
|
995
|
+
const base = this.sceneUrl();
|
|
996
|
+
if (!base) {
|
|
997
|
+
this.host.log("Frames: no scene id - nothing read");
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
const seq = ++this.readSeq;
|
|
1001
|
+
let frames;
|
|
1002
|
+
try {
|
|
1003
|
+
const res = await fetch(`${base}/frames`);
|
|
1004
|
+
if (!res.ok) {
|
|
1005
|
+
this.host.log("Frames read refused:", res.status);
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
const data = await res.json();
|
|
1009
|
+
const raw = data && typeof data === "object" ? data.frames : void 0;
|
|
1010
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
1011
|
+
this.host.log("Frames read: the answer holds no frames");
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
frames = raw;
|
|
1015
|
+
} catch (err) {
|
|
1016
|
+
this.host.log("Frames read error:", err);
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
if (seq < this.shownSeq) return;
|
|
1020
|
+
this.shownSeq = seq;
|
|
1021
|
+
this.answer = frames;
|
|
1022
|
+
this.apply();
|
|
1023
|
+
}
|
|
1024
|
+
/** A frame's content from the last good read: its saved content when usable, else its default, else null */
|
|
1025
|
+
contentFor(frame) {
|
|
1026
|
+
const answer = this.answer;
|
|
1027
|
+
if (answer && Object.prototype.hasOwnProperty.call(answer, frame.id)) {
|
|
1028
|
+
const saved = savedContent(answer[frame.id]);
|
|
1029
|
+
if (saved) return saved;
|
|
1030
|
+
this.host.log("Frames: saved content not usable, ignored:", frame.id);
|
|
1031
|
+
}
|
|
1032
|
+
return defaultContent(frame);
|
|
1033
|
+
}
|
|
1034
|
+
/** Each declared frame's content handed to its onContent when it differs from what the frame shows */
|
|
1035
|
+
apply() {
|
|
1036
|
+
if (!this.enabled || this.answer === null) return;
|
|
1037
|
+
for (const entry of [...this.entries.values()]) {
|
|
1038
|
+
const content = this.contentFor(entry.frame);
|
|
1039
|
+
if (!content || sameContent(content, entry.shown)) continue;
|
|
1040
|
+
try {
|
|
1041
|
+
entry.frame.onContent({ ...content });
|
|
1042
|
+
entry.shown = content;
|
|
1043
|
+
} catch (err) {
|
|
1044
|
+
this.host.error(`Frame ${entry.frame.id}: onContent failed`, err);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
/** The declaration - ids, labels, defaults, never the handlers - once a load, in its own request to the config route */
|
|
1049
|
+
async upload() {
|
|
1050
|
+
if (this.uploaded || !this.enabled || !this.adminOk || this.entries.size === 0) return;
|
|
1051
|
+
const base = this.sceneUrl();
|
|
1052
|
+
if (!base) return;
|
|
1053
|
+
this.uploaded = true;
|
|
1054
|
+
const frames = [...this.entries.values()].map(({ frame }) => {
|
|
1055
|
+
const d = frame.default;
|
|
1056
|
+
return {
|
|
1057
|
+
id: frame.id,
|
|
1058
|
+
label: frame.label,
|
|
1059
|
+
...d ? { default: { image: d.image, text: d.text || "", link: d.link || "" } } : {}
|
|
1060
|
+
};
|
|
1061
|
+
});
|
|
1062
|
+
try {
|
|
1063
|
+
const res = await (0, import_SignedFetch.signedFetch)({
|
|
1064
|
+
url: `${base}/config`,
|
|
1065
|
+
init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frames }) }
|
|
1066
|
+
});
|
|
1067
|
+
if (res.ok) {
|
|
1068
|
+
this.host.log("Frames declared:", frames.map((f) => f.id));
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
this.host.log("Frames declaration refused:", res.status, errorOf(res.body));
|
|
1072
|
+
} catch (err) {
|
|
1073
|
+
this.host.log("Frames declaration error:", err);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
/** The click, signed: thestatic.tv counts it under the frame's shown version (one a wallet a frame a 10 s) */
|
|
1077
|
+
async postClick(id, version) {
|
|
1078
|
+
const base = this.sceneUrl();
|
|
1079
|
+
if (!base) return;
|
|
1080
|
+
try {
|
|
1081
|
+
const res = await (0, import_SignedFetch.signedFetch)({
|
|
1082
|
+
url: `${base}/frames/click`,
|
|
1083
|
+
init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frame: id, version }) }
|
|
1084
|
+
});
|
|
1085
|
+
if (!res.ok) this.host.log("Frame click refused:", id, res.status, errorOf(res.body));
|
|
1086
|
+
} catch (err) {
|
|
1087
|
+
this.host.log("Frame click error:", id, err);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
|
|
744
1092
|
// src/ui/guide-ui.tsx
|
|
745
1093
|
var import_react_ecs2 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
746
1094
|
var import_math3 = require("@dcl/sdk/math");
|
|
747
|
-
var
|
|
1095
|
+
var import_RestrictedActions2 = require("~system/RestrictedActions");
|
|
748
1096
|
|
|
749
1097
|
// src/ui/theme.ts
|
|
750
1098
|
var import_math = require("@dcl/sdk/math");
|
|
@@ -1013,6 +1361,7 @@ var GuideUIModule = class {
|
|
|
1013
1361
|
* Always renders toggle button, plus panel when visible
|
|
1014
1362
|
*/
|
|
1015
1363
|
this.getComponent = () => {
|
|
1364
|
+
if (this.client.isVisitorBlocked) return null;
|
|
1016
1365
|
const windowW = UI_DIMENSIONS.guide.width;
|
|
1017
1366
|
const windowH = UI_DIMENSIONS.guide.height;
|
|
1018
1367
|
return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
|
|
@@ -1234,7 +1583,7 @@ var GuideUIModule = class {
|
|
|
1234
1583
|
handleChannelClick(video) {
|
|
1235
1584
|
const baseUrl = this.getBaseUrl();
|
|
1236
1585
|
const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
|
|
1237
|
-
(0,
|
|
1586
|
+
(0, import_RestrictedActions2.openExternalUrl)({ url: channelUrl });
|
|
1238
1587
|
}
|
|
1239
1588
|
renderLeftPanel() {
|
|
1240
1589
|
const sidebarW = this.s(UI_DIMENSIONS.guide.sidebar.width);
|
|
@@ -1776,12 +2125,13 @@ var GuideUIModule = class {
|
|
|
1776
2125
|
// src/ui/chat-ui.tsx
|
|
1777
2126
|
var import_react_ecs3 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
1778
2127
|
var import_math4 = require("@dcl/sdk/math");
|
|
1779
|
-
var
|
|
2128
|
+
var import_SignedFetch2 = require("~system/SignedFetch");
|
|
1780
2129
|
var import_players = require("@dcl/sdk/players");
|
|
1781
|
-
var
|
|
2130
|
+
var import_RestrictedActions3 = require("~system/RestrictedActions");
|
|
1782
2131
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
1783
2132
|
var POLL_INTERVAL_PASSIVE = 3e4;
|
|
1784
2133
|
var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
|
|
2134
|
+
var HISTORY_ERROR_ID = "sys-history-error";
|
|
1785
2135
|
var ChatUIModule = class {
|
|
1786
2136
|
constructor(client, config = {}) {
|
|
1787
2137
|
// Visibility state
|
|
@@ -1805,6 +2155,8 @@ var ChatUIModule = class {
|
|
|
1805
2155
|
this.systemMessages = [];
|
|
1806
2156
|
this.inputText = "";
|
|
1807
2157
|
this.chatScrollOffset = 0;
|
|
2158
|
+
// The last history read's failure, shown as the messages' last line until a read succeeds (2026-11-17)
|
|
2159
|
+
this.historyError = "";
|
|
1808
2160
|
// UI preferences
|
|
1809
2161
|
this.position = "right";
|
|
1810
2162
|
// Timers
|
|
@@ -1819,6 +2171,7 @@ var ChatUIModule = class {
|
|
|
1819
2171
|
* Always renders toggle button, plus panel when visible
|
|
1820
2172
|
*/
|
|
1821
2173
|
this.getComponent = () => {
|
|
2174
|
+
if (this.client.isVisitorBlocked) return null;
|
|
1822
2175
|
const scaledTheme = scaleChatTheme(DEFAULT_CHAT_THEME, this.client.uiScale);
|
|
1823
2176
|
const positionStyle = this.getPositionStyle();
|
|
1824
2177
|
return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
@@ -1959,7 +2312,7 @@ var ChatUIModule = class {
|
|
|
1959
2312
|
this.isSigningIn = true;
|
|
1960
2313
|
try {
|
|
1961
2314
|
const baseUrl = this.getBaseUrl();
|
|
1962
|
-
const response = await (0,
|
|
2315
|
+
const response = await (0, import_SignedFetch2.signedFetch)({
|
|
1963
2316
|
url: `${baseUrl}/api/auth/dcl`,
|
|
1964
2317
|
init: {
|
|
1965
2318
|
method: "POST",
|
|
@@ -2011,8 +2364,13 @@ var ChatUIModule = class {
|
|
|
2011
2364
|
async fetchMessages() {
|
|
2012
2365
|
try {
|
|
2013
2366
|
const baseUrl = this.getBaseUrl();
|
|
2014
|
-
const response = await fetch(`${baseUrl}/api/chat/history?channelId=${this.currentChannelId}`);
|
|
2367
|
+
const response = await fetch(`${baseUrl}/api/chat/history?channelId=${encodeURIComponent(this.currentChannelId)}`);
|
|
2368
|
+
if (!response.ok) {
|
|
2369
|
+
this.historyError = `CHAT HISTORY UNAVAILABLE (${response.status})`;
|
|
2370
|
+
return;
|
|
2371
|
+
}
|
|
2015
2372
|
const data = await response.json();
|
|
2373
|
+
this.historyError = "";
|
|
2016
2374
|
if (data.messages) {
|
|
2017
2375
|
const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
|
|
2018
2376
|
const recentMsgs = data.messages.filter(
|
|
@@ -2040,6 +2398,7 @@ var ChatUIModule = class {
|
|
|
2040
2398
|
this.realMessages = sortedMsgs;
|
|
2041
2399
|
}
|
|
2042
2400
|
} catch (e) {
|
|
2401
|
+
this.historyError = "CHAT HISTORY UNAVAILABLE";
|
|
2043
2402
|
}
|
|
2044
2403
|
}
|
|
2045
2404
|
async handleSend() {
|
|
@@ -2055,7 +2414,7 @@ var ChatUIModule = class {
|
|
|
2055
2414
|
this.inputText = "";
|
|
2056
2415
|
try {
|
|
2057
2416
|
const baseUrl = this.getBaseUrl();
|
|
2058
|
-
const response = await (0,
|
|
2417
|
+
const response = await (0, import_SignedFetch2.signedFetch)({
|
|
2059
2418
|
url: `${baseUrl}/api/chat/send`,
|
|
2060
2419
|
init: {
|
|
2061
2420
|
method: "POST",
|
|
@@ -2098,6 +2457,7 @@ var ChatUIModule = class {
|
|
|
2098
2457
|
switchChannel(channelId) {
|
|
2099
2458
|
this.currentChannelId = channelId;
|
|
2100
2459
|
this.realMessages = [];
|
|
2460
|
+
this.historyError = "";
|
|
2101
2461
|
this.showChannelDropdown = false;
|
|
2102
2462
|
this.chatScrollOffset = 0;
|
|
2103
2463
|
this.channelPage = 0;
|
|
@@ -2212,6 +2572,16 @@ var ChatUIModule = class {
|
|
|
2212
2572
|
}
|
|
2213
2573
|
renderMessagesArea(theme) {
|
|
2214
2574
|
const allMessages = [...this.systemMessages, ...this.realMessages];
|
|
2575
|
+
if (this.historyError) {
|
|
2576
|
+
allMessages.push({
|
|
2577
|
+
id: HISTORY_ERROR_ID,
|
|
2578
|
+
username: "SYSTEM",
|
|
2579
|
+
text: this.historyError,
|
|
2580
|
+
uid: "system",
|
|
2581
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2582
|
+
isSystem: true
|
|
2583
|
+
});
|
|
2584
|
+
}
|
|
2215
2585
|
const totalMessages = allMessages.length;
|
|
2216
2586
|
const maxOffset = Math.max(0, totalMessages - UI_DIMENSIONS.chat.messagesPerPage);
|
|
2217
2587
|
if (this.chatScrollOffset > maxOffset) this.chatScrollOffset = maxOffset;
|
|
@@ -2298,7 +2668,12 @@ var ChatUIModule = class {
|
|
|
2298
2668
|
return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2299
2669
|
key: msg.id,
|
|
2300
2670
|
uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
|
|
2301
|
-
uiText: {
|
|
2671
|
+
uiText: {
|
|
2672
|
+
value: msg.text,
|
|
2673
|
+
fontSize: theme.systemMessage,
|
|
2674
|
+
color: msg.id === HISTORY_ERROR_ID ? THEME.colors.yellow : THEME.colors.green,
|
|
2675
|
+
textAlign: "middle-left"
|
|
2676
|
+
}
|
|
2302
2677
|
});
|
|
2303
2678
|
}
|
|
2304
2679
|
renderChatMessage(msg, theme) {
|
|
@@ -2413,7 +2788,7 @@ var ChatUIModule = class {
|
|
|
2413
2788
|
uiBackground: { color: THEME.colors.cyan },
|
|
2414
2789
|
color: import_math4.Color4.Black(),
|
|
2415
2790
|
onMouseDown: () => {
|
|
2416
|
-
(0,
|
|
2791
|
+
(0, import_RestrictedActions3.openExternalUrl)({ url: `${baseUrl}/login` });
|
|
2417
2792
|
}
|
|
2418
2793
|
})
|
|
2419
2794
|
]
|
|
@@ -2585,11 +2960,11 @@ var ChatUIModule = class {
|
|
|
2585
2960
|
};
|
|
2586
2961
|
|
|
2587
2962
|
// src/ui/admin-panel-ui.tsx
|
|
2588
|
-
var
|
|
2589
|
-
var
|
|
2963
|
+
var import_react_ecs6 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
2964
|
+
var import_math7 = require("@dcl/sdk/math");
|
|
2590
2965
|
var import_players2 = require("@dcl/sdk/players");
|
|
2591
|
-
var
|
|
2592
|
-
var
|
|
2966
|
+
var import_RestrictedActions6 = require("~system/RestrictedActions");
|
|
2967
|
+
var import_SignedFetch3 = require("~system/SignedFetch");
|
|
2593
2968
|
|
|
2594
2969
|
// src/ui/ui-renderer.tsx
|
|
2595
2970
|
var import_react_ecs4 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
@@ -2697,6 +3072,7 @@ function createStaticUI(client) {
|
|
|
2697
3072
|
initNotificationSystem();
|
|
2698
3073
|
return function StaticUI() {
|
|
2699
3074
|
const currentScale = client.uiScale;
|
|
3075
|
+
const blocked = client.isVisitorBlocked;
|
|
2700
3076
|
const guideComponent = client.guideUI?.getComponent() ?? null;
|
|
2701
3077
|
const chatComponent = client.chatUI?.getComponent() ?? null;
|
|
2702
3078
|
const adminComponent = client.adminPanel?.getComponent() ?? null;
|
|
@@ -2712,7 +3088,7 @@ function createStaticUI(client) {
|
|
|
2712
3088
|
alignItems: "center"
|
|
2713
3089
|
}
|
|
2714
3090
|
},
|
|
2715
|
-
/* @__PURE__ */ import_react_ecs4.default.createElement(NotificationBanner, null),
|
|
3091
|
+
blocked ? null : /* @__PURE__ */ import_react_ecs4.default.createElement(NotificationBanner, null),
|
|
2716
3092
|
guideComponent,
|
|
2717
3093
|
chatComponent,
|
|
2718
3094
|
adminComponent
|
|
@@ -2724,8 +3100,387 @@ function setupStaticUI(client) {
|
|
|
2724
3100
|
import_react_ecs4.ReactEcsRenderer.setUiRenderer(StaticUI);
|
|
2725
3101
|
}
|
|
2726
3102
|
|
|
3103
|
+
// src/ui/blocked-notice.tsx
|
|
3104
|
+
var import_react_ecs5 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
3105
|
+
var import_math5 = require("@dcl/sdk/math");
|
|
3106
|
+
var import_RestrictedActions4 = require("~system/RestrictedActions");
|
|
3107
|
+
var DEFAULT_SITE_URL = "https://thestatic.tv";
|
|
3108
|
+
function blockedNoticeLines(standing, kickLeftMs) {
|
|
3109
|
+
if (standing === "banned") {
|
|
3110
|
+
return ["BANNED FROM THIS SCENE", "The scene's moderators banned", "this wallet."];
|
|
3111
|
+
}
|
|
3112
|
+
if (standing === "kicked") {
|
|
3113
|
+
const minutes = Math.max(1, Math.ceil(kickLeftMs / 6e4));
|
|
3114
|
+
return ["REMOVED FROM THIS SCENE", "A moderator cleared the scene.", `You can come back in ${minutes} min.`];
|
|
3115
|
+
}
|
|
3116
|
+
if (standing === "private") {
|
|
3117
|
+
return ["PRIVATE EVENT", "Open to TheStatic.tv citizens right now."];
|
|
3118
|
+
}
|
|
3119
|
+
return [];
|
|
3120
|
+
}
|
|
3121
|
+
function blockedNoticeAction(standing, siteUrl = DEFAULT_SITE_URL) {
|
|
3122
|
+
if (standing === "private") return { label: "BECOME A CITIZEN", url: `${siteUrl}/login` };
|
|
3123
|
+
return null;
|
|
3124
|
+
}
|
|
3125
|
+
function BlockedNotice(props) {
|
|
3126
|
+
const lines = blockedNoticeLines(props.standing, props.kickLeftMs);
|
|
3127
|
+
if (lines.length === 0) return null;
|
|
3128
|
+
const s = (v) => Math.round(v * props.scale);
|
|
3129
|
+
const [title, ...body] = lines;
|
|
3130
|
+
const action = blockedNoticeAction(props.standing, props.siteUrl || DEFAULT_SITE_URL);
|
|
3131
|
+
return /* @__PURE__ */ import_react_ecs5.default.createElement(
|
|
3132
|
+
import_react_ecs5.UiEntity,
|
|
3133
|
+
{
|
|
3134
|
+
uiTransform: {
|
|
3135
|
+
width: "100%",
|
|
3136
|
+
height: "100%",
|
|
3137
|
+
positionType: "absolute",
|
|
3138
|
+
justifyContent: "center",
|
|
3139
|
+
alignItems: "center"
|
|
3140
|
+
}
|
|
3141
|
+
},
|
|
3142
|
+
/* @__PURE__ */ import_react_ecs5.default.createElement(
|
|
3143
|
+
import_react_ecs5.UiEntity,
|
|
3144
|
+
{
|
|
3145
|
+
uiTransform: { width: s(460), flexDirection: "column", alignItems: "center", padding: s(20) },
|
|
3146
|
+
uiBackground: { color: import_math5.Color4.create(0.05, 0.05, 0.08, 0.95) }
|
|
3147
|
+
},
|
|
3148
|
+
/* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { value: title, fontSize: s(22), color: import_math5.Color4.create(0.9, 0.2, 0.2, 1), uiTransform: { height: s(34) } }),
|
|
3149
|
+
body.map((line, i) => /* @__PURE__ */ import_react_ecs5.default.createElement(import_react_ecs5.Label, { key: `blocked-line-${i}`, value: line, fontSize: s(16), color: import_math5.Color4.White(), uiTransform: { height: s(26) } })),
|
|
3150
|
+
action && /* @__PURE__ */ import_react_ecs5.default.createElement(
|
|
3151
|
+
import_react_ecs5.Button,
|
|
3152
|
+
{
|
|
3153
|
+
uiTransform: { width: s(220), height: s(36), margin: { top: s(12) } },
|
|
3154
|
+
uiBackground: { color: import_math5.Color4.create(0, 0.8, 0.8, 1) },
|
|
3155
|
+
value: action.label,
|
|
3156
|
+
fontSize: s(16),
|
|
3157
|
+
color: import_math5.Color4.Black(),
|
|
3158
|
+
onMouseDown: () => {
|
|
3159
|
+
(0, import_RestrictedActions4.openExternalUrl)({ url: action.url });
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
)
|
|
3163
|
+
)
|
|
3164
|
+
);
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
// src/utils/player-wait.ts
|
|
3168
|
+
var PLAYER_WAIT_STEP_MS = 1e3;
|
|
3169
|
+
var PLAYER_WAIT_MAX_MS = 30 * 1e3;
|
|
3170
|
+
var isGuest = (player) => player.isGuest === true;
|
|
3171
|
+
var PlayerWait = class {
|
|
3172
|
+
constructor(deps) {
|
|
3173
|
+
this.timerId = null;
|
|
3174
|
+
this.reads = 0;
|
|
3175
|
+
/** This wait has checked a guest reading already */
|
|
3176
|
+
this.guestChecked = false;
|
|
3177
|
+
this.deps = deps;
|
|
3178
|
+
}
|
|
3179
|
+
get stepMs() {
|
|
3180
|
+
return this.deps.stepMs ?? PLAYER_WAIT_STEP_MS;
|
|
3181
|
+
}
|
|
3182
|
+
get maxMs() {
|
|
3183
|
+
return this.deps.maxMs ?? PLAYER_WAIT_MAX_MS;
|
|
3184
|
+
}
|
|
3185
|
+
/** True while a wait is reading the player */
|
|
3186
|
+
get waiting() {
|
|
3187
|
+
return this.timerId !== null;
|
|
3188
|
+
}
|
|
3189
|
+
/**
|
|
3190
|
+
* The check with the player now, or - with no player yet - a wait that runs it once one appears. A guest reading is
|
|
3191
|
+
* checked now and the wait goes on for a non-guest one. Resolves when the check is done, or at once when there is
|
|
3192
|
+
* none to run.
|
|
3193
|
+
*/
|
|
3194
|
+
async run() {
|
|
3195
|
+
const player = this.read();
|
|
3196
|
+
if (player && !isGuest(player)) {
|
|
3197
|
+
this.stop();
|
|
3198
|
+
await this.deps.check(player);
|
|
3199
|
+
return;
|
|
3200
|
+
}
|
|
3201
|
+
if (player) {
|
|
3202
|
+
this.start("A guest reading - checked now; waiting for a non-guest one");
|
|
3203
|
+
this.guestChecked = true;
|
|
3204
|
+
await this.deps.check(player);
|
|
3205
|
+
return;
|
|
3206
|
+
}
|
|
3207
|
+
this.start("No player data yet - waiting for one");
|
|
3208
|
+
}
|
|
3209
|
+
/** A wait, unless one is running (one at a time) */
|
|
3210
|
+
start(msg) {
|
|
3211
|
+
if (this.timerId !== null) return;
|
|
3212
|
+
this.reads = 0;
|
|
3213
|
+
this.guestChecked = false;
|
|
3214
|
+
this.deps.log?.(msg);
|
|
3215
|
+
this.timerId = this.deps.setInterval(() => this.tick(), this.stepMs);
|
|
3216
|
+
}
|
|
3217
|
+
tick() {
|
|
3218
|
+
this.reads++;
|
|
3219
|
+
const player = this.read();
|
|
3220
|
+
if (player && !isGuest(player)) {
|
|
3221
|
+
this.stop();
|
|
3222
|
+
this.deps.log?.(`Player resolved after ${this.reads} read(s)`);
|
|
3223
|
+
this.deps.check(player).catch(() => {
|
|
3224
|
+
});
|
|
3225
|
+
return;
|
|
3226
|
+
}
|
|
3227
|
+
if (player && !this.guestChecked) {
|
|
3228
|
+
this.guestChecked = true;
|
|
3229
|
+
this.deps.log?.(`A guest reading after ${this.reads} read(s) - checked now; still waiting for a non-guest one`);
|
|
3230
|
+
this.deps.check(player).catch(() => {
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
if (this.reads * this.stepMs >= this.maxMs) {
|
|
3234
|
+
this.stop();
|
|
3235
|
+
this.deps.log?.(`No non-guest player after ${this.maxMs / 1e3} s - no further check`);
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
stop() {
|
|
3239
|
+
if (this.timerId === null) return;
|
|
3240
|
+
this.deps.clearInterval(this.timerId);
|
|
3241
|
+
this.timerId = null;
|
|
3242
|
+
}
|
|
3243
|
+
read() {
|
|
3244
|
+
try {
|
|
3245
|
+
const player = this.deps.getPlayer();
|
|
3246
|
+
return player && player.userId ? player : null;
|
|
3247
|
+
} catch {
|
|
3248
|
+
return null;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
|
|
3253
|
+
// src/modules/moderation.ts
|
|
3254
|
+
var import_ecs4 = require("@dcl/sdk/ecs");
|
|
3255
|
+
var import_math6 = require("@dcl/sdk/math");
|
|
3256
|
+
var import_RestrictedActions5 = require("~system/RestrictedActions");
|
|
3257
|
+
var KICK_MS = 2 * 60 * 1e3;
|
|
3258
|
+
var REREAD_MS = 60 * 1e3;
|
|
3259
|
+
var READ_GAP_MS = 5e3;
|
|
3260
|
+
var HINT_SPREAD_MS = 3e3;
|
|
3261
|
+
var CITIZEN_WAIT_MS = 1e4;
|
|
3262
|
+
var CHECK_EVERY_S = 1;
|
|
3263
|
+
function namesMe(wallet, mine) {
|
|
3264
|
+
if (typeof wallet !== "string" || wallet === "") return false;
|
|
3265
|
+
if (typeof mine !== "string" || mine === "") return false;
|
|
3266
|
+
return wallet.toLowerCase() === mine.toLowerCase();
|
|
3267
|
+
}
|
|
3268
|
+
var ModerationModule = class {
|
|
3269
|
+
constructor(deps) {
|
|
3270
|
+
this.banned = false;
|
|
3271
|
+
this.kickedUntil = 0;
|
|
3272
|
+
this.canModerate = false;
|
|
3273
|
+
// Private mode (2026-11-19): the last answer's word on this visitor, its isCitizen and when it came, a hint's read
|
|
3274
|
+
// waiting its random spread, and the callers of checkCitizen() waiting on the next read
|
|
3275
|
+
this.privateBlocked = false;
|
|
3276
|
+
this.citizen = false;
|
|
3277
|
+
this.citizenAnsweredAt = null;
|
|
3278
|
+
this.hintDueAt = null;
|
|
3279
|
+
this.readWaiters = [];
|
|
3280
|
+
this.rects = [];
|
|
3281
|
+
this.boxes = [];
|
|
3282
|
+
this.wallEntities = [];
|
|
3283
|
+
this.lastBlocked = false;
|
|
3284
|
+
this.lastStanding = "clear";
|
|
3285
|
+
this.lastReadAt = Number.NEGATIVE_INFINITY;
|
|
3286
|
+
this.readInFlight = false;
|
|
3287
|
+
this.readPending = false;
|
|
3288
|
+
this.wasInScene = null;
|
|
3289
|
+
this.sinceCheck = 0;
|
|
3290
|
+
this.started = false;
|
|
3291
|
+
/** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor inside a wall moved above it */
|
|
3292
|
+
this.system = (dt) => {
|
|
3293
|
+
if (this.hintDueAt !== null && this.now() >= this.hintDueAt) {
|
|
3294
|
+
this.hintDueAt = null;
|
|
3295
|
+
this.requestRead();
|
|
3296
|
+
}
|
|
3297
|
+
if (this.readWaiters.length > 0) {
|
|
3298
|
+
const t = this.now();
|
|
3299
|
+
const expired = this.readWaiters.filter((w) => t >= w.deadline);
|
|
3300
|
+
if (expired.length > 0) {
|
|
3301
|
+
this.readWaiters = this.readWaiters.filter((w) => t < w.deadline);
|
|
3302
|
+
for (const w of expired) w.resolve();
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
this.sinceCheck += dt;
|
|
3306
|
+
if (this.sinceCheck < CHECK_EVERY_S) return;
|
|
3307
|
+
this.sinceCheck = 0;
|
|
3308
|
+
const now = this.now();
|
|
3309
|
+
if (this.kickedUntil > 0 && now >= this.kickedUntil) {
|
|
3310
|
+
this.kickedUntil = 0;
|
|
3311
|
+
this.sync();
|
|
3312
|
+
}
|
|
3313
|
+
const me = getPlayerPosition();
|
|
3314
|
+
const inScene = me !== null && this.rects.length > 0 && inParcels(me, this.rects);
|
|
3315
|
+
if (inScene && this.wasInScene === false) this.readPending = true;
|
|
3316
|
+
if (inScene && now - this.lastReadAt >= REREAD_MS) this.readPending = true;
|
|
3317
|
+
this.wasInScene = inScene;
|
|
3318
|
+
this.tryRead();
|
|
3319
|
+
if (me && this.blocked && insideWalls(me, this.boxes)) {
|
|
3320
|
+
const to = ejectPoint(this.boxes, this.rects, me);
|
|
3321
|
+
if (to) {
|
|
3322
|
+
this.log("Blocked and inside the walls - moving above them", to);
|
|
3323
|
+
Promise.resolve((0, import_RestrictedActions5.movePlayerTo)({ newRelativePosition: import_math6.Vector3.create(to.x, to.y, to.z) })).catch(() => {
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
};
|
|
3328
|
+
this.deps = deps;
|
|
3329
|
+
}
|
|
3330
|
+
now() {
|
|
3331
|
+
return this.deps.now ? this.deps.now() : Date.now();
|
|
3332
|
+
}
|
|
3333
|
+
log(msg, ...args) {
|
|
3334
|
+
this.deps.log?.(msg, ...args);
|
|
3335
|
+
}
|
|
3336
|
+
/** Reads the scene's parcels and starts the checks (once) */
|
|
3337
|
+
async start() {
|
|
3338
|
+
if (this.started) return;
|
|
3339
|
+
this.started = true;
|
|
3340
|
+
import_ecs4.engine.addSystem(this.system);
|
|
3341
|
+
try {
|
|
3342
|
+
await getSceneBounds();
|
|
3343
|
+
this.rects = getParcelRects();
|
|
3344
|
+
this.boxes = wallBoxes(this.rects);
|
|
3345
|
+
} catch {
|
|
3346
|
+
}
|
|
3347
|
+
this.sync();
|
|
3348
|
+
}
|
|
3349
|
+
/** banned, kicked (KICK ALL, until it lapses), private (the scene's private mode) or clear - in that precedence */
|
|
3350
|
+
get standing() {
|
|
3351
|
+
if (this.banned) return "banned";
|
|
3352
|
+
if (this.kickedUntil > 0 && this.now() < this.kickedUntil) return "kicked";
|
|
3353
|
+
if (this.privateBlocked) return "private";
|
|
3354
|
+
return "clear";
|
|
3355
|
+
}
|
|
3356
|
+
/** The last answer's isCitizen (2026-11-19): false before one, and from a server that does not answer it */
|
|
3357
|
+
get isCitizen() {
|
|
3358
|
+
return this.citizen;
|
|
3359
|
+
}
|
|
3360
|
+
/**
|
|
3361
|
+
* Whether this visitor is a TheStatic.tv citizen (2026-11-19): the last answer when it is under READ_GAP_MS old, else
|
|
3362
|
+
* the answer of the next read - started now, or the one in flight - through the same gate as every other read. A
|
|
3363
|
+
* read that fails answers what the last one said (false before any), and so does one that has not settled within
|
|
3364
|
+
* CITIZEN_WAIT_MS (the module's system ends that wait).
|
|
3365
|
+
*/
|
|
3366
|
+
async checkCitizen() {
|
|
3367
|
+
if (this.citizenAnsweredAt !== null && this.now() - this.citizenAnsweredAt < READ_GAP_MS) return this.citizen;
|
|
3368
|
+
await new Promise((resolve) => {
|
|
3369
|
+
this.readWaiters.push({ resolve, deadline: this.now() + CITIZEN_WAIT_MS });
|
|
3370
|
+
if (!this.readInFlight) this.requestRead();
|
|
3371
|
+
});
|
|
3372
|
+
return this.citizen;
|
|
3373
|
+
}
|
|
3374
|
+
get blocked() {
|
|
3375
|
+
return this.standing !== "clear";
|
|
3376
|
+
}
|
|
3377
|
+
/** How long a kick has left, in ms (0 when not kicked) */
|
|
3378
|
+
get kickLeftMs() {
|
|
3379
|
+
return this.standing === "kicked" ? Math.max(0, this.kickedUntil - this.now()) : 0;
|
|
3380
|
+
}
|
|
3381
|
+
/**
|
|
3382
|
+
* admin-check's answer: the ban list's word on this visitor, whether they moderate the scene, and (2026-11-19) the
|
|
3383
|
+
* private mode's word and whether they are a citizen. Only the boolean true counts, so an answer without the new
|
|
3384
|
+
* fields reads as open and not a citizen. One who can moderate is never walled by private mode here, whatever the
|
|
3385
|
+
* answer says (the server admits them; this keeps a wrong answer from locking an admin out).
|
|
3386
|
+
*/
|
|
3387
|
+
applyStanding(answer) {
|
|
3388
|
+
this.banned = answer.isBanned === true;
|
|
3389
|
+
this.canModerate = answer.canModerate === true;
|
|
3390
|
+
this.privateBlocked = answer.privateBlocked === true && !this.canModerate;
|
|
3391
|
+
this.citizen = answer.isCitizen === true;
|
|
3392
|
+
this.citizenAnsweredAt = this.now();
|
|
3393
|
+
this.lastReadAt = Math.max(this.lastReadAt, this.now());
|
|
3394
|
+
this.sync();
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3397
|
+
* A command from the scene's queue (the poll every visitor runs). Returns true for the three this module takes.
|
|
3398
|
+
* kickBanned names a wallet: the named visitor re-reads their standing, every other visitor does nothing.
|
|
3399
|
+
* privateMode (2026-11-19) is a hint for every visitor: its payload is not read - a re-read after a random wait of up
|
|
3400
|
+
* to HINT_SPREAD_MS, joined by any hint that comes while it waits, and still gated by one read in flight and
|
|
3401
|
+
* READ_GAP_MS, so no number of hints makes this copy read faster than that.
|
|
3402
|
+
*/
|
|
3403
|
+
handleCommand(type, payload) {
|
|
3404
|
+
if (type === "privateMode") {
|
|
3405
|
+
if (this.hintDueAt === null) {
|
|
3406
|
+
const r = this.deps.random ? this.deps.random() : Math.random();
|
|
3407
|
+
const wait = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) * HINT_SPREAD_MS : 0;
|
|
3408
|
+
this.hintDueAt = this.now() + wait;
|
|
3409
|
+
this.log(`Private mode changed - reading my standing in ${Math.round(wait)} ms`);
|
|
3410
|
+
}
|
|
3411
|
+
return true;
|
|
3412
|
+
}
|
|
3413
|
+
if (type === "kickBanned") {
|
|
3414
|
+
if (namesMe(payload?.wallet, this.deps.myWallet())) {
|
|
3415
|
+
this.log("A kick names me - reading my standing");
|
|
3416
|
+
this.requestRead();
|
|
3417
|
+
}
|
|
3418
|
+
return true;
|
|
3419
|
+
}
|
|
3420
|
+
if (type === "kickAll") {
|
|
3421
|
+
if (!this.canModerate) {
|
|
3422
|
+
this.kickedUntil = this.now() + KICK_MS;
|
|
3423
|
+
this.sync();
|
|
3424
|
+
}
|
|
3425
|
+
return true;
|
|
3426
|
+
}
|
|
3427
|
+
return false;
|
|
3428
|
+
}
|
|
3429
|
+
/** Ask for a fresh standing read: at once when the gate allows, else as soon as it does */
|
|
3430
|
+
requestRead() {
|
|
3431
|
+
this.readPending = true;
|
|
3432
|
+
this.tryRead();
|
|
3433
|
+
}
|
|
3434
|
+
tryRead() {
|
|
3435
|
+
if (!this.readPending || this.readInFlight) return;
|
|
3436
|
+
const now = this.now();
|
|
3437
|
+
if (now - this.lastReadAt < READ_GAP_MS) return;
|
|
3438
|
+
this.readPending = false;
|
|
3439
|
+
this.readInFlight = true;
|
|
3440
|
+
this.lastReadAt = now;
|
|
3441
|
+
this.deps.reread().catch(() => {
|
|
3442
|
+
}).finally(() => {
|
|
3443
|
+
this.readInFlight = false;
|
|
3444
|
+
const waiters = this.readWaiters;
|
|
3445
|
+
this.readWaiters = [];
|
|
3446
|
+
for (const w of waiters) w.resolve();
|
|
3447
|
+
});
|
|
3448
|
+
}
|
|
3449
|
+
/** The walls follow blocked; the scene hears of a change */
|
|
3450
|
+
sync() {
|
|
3451
|
+
const standing = this.standing;
|
|
3452
|
+
const blocked = standing !== "clear";
|
|
3453
|
+
if (blocked && this.wallEntities.length === 0) this.raiseWalls();
|
|
3454
|
+
if (!blocked && this.wallEntities.length > 0) this.lowerWalls();
|
|
3455
|
+
if (blocked !== this.lastBlocked || standing !== this.lastStanding) {
|
|
3456
|
+
this.lastBlocked = blocked;
|
|
3457
|
+
this.lastStanding = standing;
|
|
3458
|
+
this.log(`Standing: ${standing}`);
|
|
3459
|
+
this.deps.onChange?.(blocked, standing);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
raiseWalls() {
|
|
3463
|
+
for (const b of this.boxes) {
|
|
3464
|
+
const wall = import_ecs4.engine.addEntity();
|
|
3465
|
+
import_ecs4.Transform.create(wall, {
|
|
3466
|
+
position: import_math6.Vector3.create((b.minX + b.maxX) / 2, b.top / 2, (b.minZ + b.maxZ) / 2),
|
|
3467
|
+
scale: import_math6.Vector3.create(b.maxX - b.minX, b.top, b.maxZ - b.minZ)
|
|
3468
|
+
});
|
|
3469
|
+
import_ecs4.MeshCollider.setBox(wall, import_ecs4.ColliderLayer.CL_PHYSICS);
|
|
3470
|
+
this.wallEntities.push(wall);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
lowerWalls() {
|
|
3474
|
+
for (const wall of this.wallEntities) import_ecs4.engine.removeEntity(wall);
|
|
3475
|
+
this.wallEntities = [];
|
|
3476
|
+
}
|
|
3477
|
+
/** The walls this copy has up (one per parcel while blocked) */
|
|
3478
|
+
get wallCount() {
|
|
3479
|
+
return this.wallEntities.length;
|
|
3480
|
+
}
|
|
3481
|
+
};
|
|
3482
|
+
|
|
2727
3483
|
// src/ui/admin-panel-ui.tsx
|
|
2728
|
-
var BAN_KICK_POSITION = import_math5.Vector3.create(16, -50, 16);
|
|
2729
3484
|
var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
|
|
2730
3485
|
function figuresOf(value) {
|
|
2731
3486
|
const figures = value?.figures;
|
|
@@ -2758,22 +3513,23 @@ function channelDeleteLines(look, changed) {
|
|
|
2758
3513
|
lines.push("Stream history is kept");
|
|
2759
3514
|
return lines;
|
|
2760
3515
|
}
|
|
3516
|
+
var SEEN_COMMAND_IDS_MAX = 200;
|
|
2761
3517
|
var C2 = {
|
|
2762
|
-
bg:
|
|
2763
|
-
header:
|
|
2764
|
-
tabActive:
|
|
2765
|
-
tabInactive:
|
|
2766
|
-
section:
|
|
2767
|
-
btn:
|
|
2768
|
-
cyan:
|
|
2769
|
-
magenta:
|
|
2770
|
-
yellow:
|
|
2771
|
-
green:
|
|
2772
|
-
red:
|
|
2773
|
-
purple:
|
|
2774
|
-
orange:
|
|
2775
|
-
text:
|
|
2776
|
-
textDim:
|
|
3518
|
+
bg: import_math7.Color4.create(0.08, 0.08, 0.12, 0.98),
|
|
3519
|
+
header: import_math7.Color4.create(0.9, 0.15, 0.15, 1),
|
|
3520
|
+
tabActive: import_math7.Color4.create(0, 0.7, 0.7, 1),
|
|
3521
|
+
tabInactive: import_math7.Color4.create(0.15, 0.15, 0.2, 1),
|
|
3522
|
+
section: import_math7.Color4.create(0.12, 0.12, 0.18, 1),
|
|
3523
|
+
btn: import_math7.Color4.create(0.2, 0.2, 0.28, 1),
|
|
3524
|
+
cyan: import_math7.Color4.create(0, 0.8, 0.8, 1),
|
|
3525
|
+
magenta: import_math7.Color4.create(0.85, 0.2, 0.55, 1),
|
|
3526
|
+
yellow: import_math7.Color4.create(0.95, 0.75, 0.1, 1),
|
|
3527
|
+
green: import_math7.Color4.create(0.2, 0.75, 0.3, 1),
|
|
3528
|
+
red: import_math7.Color4.create(0.85, 0.2, 0.2, 1),
|
|
3529
|
+
purple: import_math7.Color4.create(0.6, 0.3, 0.85, 1),
|
|
3530
|
+
orange: import_math7.Color4.create(0.95, 0.5, 0.15, 1),
|
|
3531
|
+
text: import_math7.Color4.White(),
|
|
3532
|
+
textDim: import_math7.Color4.create(0.6, 0.6, 0.7, 1)
|
|
2777
3533
|
};
|
|
2778
3534
|
var AdminPanelUIModule = class {
|
|
2779
3535
|
// UI scaling - uses shared client.uiScale
|
|
@@ -2815,34 +3571,90 @@ var AdminPanelUIModule = class {
|
|
|
2815
3571
|
this.broadcastText = "";
|
|
2816
3572
|
this.modStatus = "";
|
|
2817
3573
|
this.modsFetched = false;
|
|
3574
|
+
// What the last kick sent from the Mod tab came to (2026-11-17): KICK ALL and the ban's kick are queued on
|
|
3575
|
+
// thestatic.tv, where every visitor's copy reads them
|
|
3576
|
+
this.kickStatus = "";
|
|
3577
|
+
// The Video and Broadcast buttons go through the same queue since 2026-11-18 (until then they reached the presser's
|
|
3578
|
+
// copy alone): what the last send from each came to, one line a section
|
|
3579
|
+
this.videoStatus = "";
|
|
3580
|
+
this.broadcastStatus = "";
|
|
3581
|
+
/** 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 */
|
|
3582
|
+
this.currentVideoUrl = null;
|
|
3583
|
+
// Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
|
|
3584
|
+
// status line, and the once-a-load gates for the declaration's upload and the saved state's read
|
|
3585
|
+
this.controls = [];
|
|
3586
|
+
this.currentOption = {};
|
|
3587
|
+
this.controlStatus = "";
|
|
3588
|
+
this.controlsUploaded = false;
|
|
3589
|
+
this.stateRead = false;
|
|
3590
|
+
/** init has read the video state: the saved control state may be read now (a persist control registered later reads then) */
|
|
3591
|
+
this.loadReadsDone = false;
|
|
3592
|
+
// The command poll (2026-11-18): the server's cursor, sent back as since once known, and the ids seen - the last
|
|
3593
|
+
// SEEN_COMMAND_IDS_MAX, this copy's own sends among them - so no command runs twice here
|
|
3594
|
+
this.commandCursor = null;
|
|
3595
|
+
this.seenCommandIds = /* @__PURE__ */ new Set();
|
|
3596
|
+
this.seenCommandOrder = [];
|
|
3597
|
+
this.controlLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
|
|
3598
|
+
this.controlStatus = line;
|
|
3599
|
+
} };
|
|
3600
|
+
this.videoLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
|
|
3601
|
+
this.videoStatus = line;
|
|
3602
|
+
} };
|
|
3603
|
+
this.broadcastLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
|
|
3604
|
+
this.broadcastStatus = line;
|
|
3605
|
+
} };
|
|
3606
|
+
// Private mode (2026-11-19, Venue): the switch's state from the last read (null until an answer carries it), and the
|
|
3607
|
+
// MOD tab's line for the switch
|
|
3608
|
+
this.privateModeOn = null;
|
|
3609
|
+
this.privateStatus = "";
|
|
3610
|
+
this.privateLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
|
|
3611
|
+
this.privateStatus = line;
|
|
3612
|
+
} };
|
|
2818
3613
|
// --- UI Components ---
|
|
2819
|
-
this.SectionHead = ({ label, color }) => /* @__PURE__ */
|
|
2820
|
-
|
|
3614
|
+
this.SectionHead = ({ label, color }) => /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3615
|
+
import_react_ecs6.UiEntity,
|
|
2821
3616
|
{
|
|
2822
3617
|
uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.sectionHeadHeight), margin: { bottom: 8 }, padding: { left: 10 }, alignItems: "center" },
|
|
2823
|
-
uiBackground: { color:
|
|
3618
|
+
uiBackground: { color: import_math7.Color4.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
|
|
2824
3619
|
},
|
|
2825
|
-
/* @__PURE__ */
|
|
3620
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: label, fontSize: this.theme.sectionHead, color })
|
|
2826
3621
|
);
|
|
2827
|
-
this.TabBtn = ({ label, tab }) => /* @__PURE__ */
|
|
2828
|
-
|
|
3622
|
+
this.TabBtn = ({ label, tab }) => /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3623
|
+
import_react_ecs6.Button,
|
|
2829
3624
|
{
|
|
2830
3625
|
uiTransform: { flexGrow: 1, height: this.s(UI_DIMENSIONS.admin.tabHeight), justifyContent: "center", alignItems: "center" },
|
|
2831
3626
|
uiBackground: { color: this.activeTab === tab ? C2.tabActive : C2.tabInactive },
|
|
2832
3627
|
value: label,
|
|
2833
3628
|
fontSize: this.theme.tabButton,
|
|
2834
|
-
color: this.activeTab === tab ?
|
|
3629
|
+
color: this.activeTab === tab ? import_math7.Color4.Black() : C2.text,
|
|
2835
3630
|
textAlign: "middle-center",
|
|
2836
3631
|
onMouseDown: () => this.setActiveTab(tab)
|
|
2837
3632
|
}
|
|
2838
3633
|
);
|
|
3634
|
+
/**
|
|
3635
|
+
* The CONTROLS tab (2026-11-18): a section per registered control, a button per option, OFF when the control has one,
|
|
3636
|
+
* the current option highlighted, and one status line for the last press. Listed first in the tab bar, only when
|
|
3637
|
+
* controls are registered, for the same admins the VIDEO tab is.
|
|
3638
|
+
*/
|
|
3639
|
+
this.ControlsTab = () => {
|
|
3640
|
+
const t = this.theme;
|
|
3641
|
+
return /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.controls.map((control) => /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { key: `control-${control.id}`, uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: control.label, color: C2.cyan }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, control.options.map((option) => this.controlButton(control, option.id, option.label)), control.off === true && this.controlButton(control, "off", "OFF")))), this.controlStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3642
|
+
import_react_ecs6.Label,
|
|
3643
|
+
{
|
|
3644
|
+
value: this.controlStatus,
|
|
3645
|
+
fontSize: t.status,
|
|
3646
|
+
color: this.controlStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
3647
|
+
uiTransform: { height: this.s(18) }
|
|
3648
|
+
}
|
|
3649
|
+
));
|
|
3650
|
+
};
|
|
2839
3651
|
this.VideoTab = () => {
|
|
2840
3652
|
if (!this.streamFetched) {
|
|
2841
3653
|
this.fetchStreamData();
|
|
2842
3654
|
}
|
|
2843
3655
|
const t = this.theme;
|
|
2844
|
-
return /* @__PURE__ */
|
|
2845
|
-
|
|
3656
|
+
return /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3657
|
+
import_react_ecs6.Button,
|
|
2846
3658
|
{
|
|
2847
3659
|
uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
2848
3660
|
uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
|
|
@@ -2851,8 +3663,8 @@ var AdminPanelUIModule = class {
|
|
|
2851
3663
|
color: C2.text,
|
|
2852
3664
|
onMouseDown: () => this.claimTrial()
|
|
2853
3665
|
}
|
|
2854
|
-
), this.trialClaimError && /* @__PURE__ */
|
|
2855
|
-
|
|
3666
|
+
), 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: "One-time trial \u2022 4 hours of streaming", 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(
|
|
3667
|
+
import_react_ecs6.Button,
|
|
2856
3668
|
{
|
|
2857
3669
|
uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
2858
3670
|
uiBackground: { color: this.channelCreating ? C2.btn : C2.cyan },
|
|
@@ -2861,47 +3673,47 @@ var AdminPanelUIModule = class {
|
|
|
2861
3673
|
color: C2.text,
|
|
2862
3674
|
onMouseDown: () => this.createChannel()
|
|
2863
3675
|
}
|
|
2864
|
-
), this.channelCreateError && /* @__PURE__ */
|
|
2865
|
-
|
|
3676
|
+
), this.channelCreateError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Relay tier \u2022 $25/mo \u2022 8 hours streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })))), this.streamData?.hasChannel && this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3677
|
+
import_react_ecs6.Label,
|
|
2866
3678
|
{
|
|
2867
3679
|
value: this.streamData.isLive ? `LIVE \u2022 ${this.streamData.currentViewers || 0} viewers` : "OFFLINE",
|
|
2868
3680
|
fontSize: t.label,
|
|
2869
3681
|
color: this.streamData.isLive ? C2.red : C2.textDim
|
|
2870
3682
|
}
|
|
2871
|
-
), /* @__PURE__ */
|
|
2872
|
-
|
|
3683
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3684
|
+
import_react_ecs6.Label,
|
|
2873
3685
|
{
|
|
2874
3686
|
value: `Channel: ${this.streamData.channelName || this.streamData.channelId}`,
|
|
2875
3687
|
fontSize: t.labelSmall,
|
|
2876
3688
|
color: C2.textDim,
|
|
2877
3689
|
uiTransform: { margin: { bottom: 10 } }
|
|
2878
3690
|
}
|
|
2879
|
-
), /* @__PURE__ */
|
|
2880
|
-
|
|
3691
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3692
|
+
import_react_ecs6.Label,
|
|
2881
3693
|
{
|
|
2882
3694
|
value: this.streamData.rtmpUrl || "Loading...",
|
|
2883
3695
|
fontSize: t.label,
|
|
2884
3696
|
color: this.streamData.rtmpUrl ? C2.text : C2.textDim,
|
|
2885
3697
|
uiTransform: { margin: { left: 6 } }
|
|
2886
3698
|
}
|
|
2887
|
-
)), /* @__PURE__ */
|
|
2888
|
-
|
|
3699
|
+
)), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3700
|
+
import_react_ecs6.Label,
|
|
2889
3701
|
{
|
|
2890
3702
|
value: this.streamData.streamKey || "Loading...",
|
|
2891
3703
|
fontSize: t.label,
|
|
2892
3704
|
color: this.streamData.streamKey ? C2.cyan : C2.textDim,
|
|
2893
3705
|
uiTransform: { margin: { left: 6 } }
|
|
2894
3706
|
}
|
|
2895
|
-
)), /* @__PURE__ */
|
|
2896
|
-
|
|
3707
|
+
)), /* @__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(
|
|
3708
|
+
import_react_ecs6.Label,
|
|
2897
3709
|
{
|
|
2898
3710
|
value: this.streamData.hlsUrl || "Not available",
|
|
2899
3711
|
fontSize: t.label,
|
|
2900
3712
|
color: this.streamData.hlsUrl ? C2.green : C2.textDim,
|
|
2901
3713
|
uiTransform: { margin: { left: 6 } }
|
|
2902
3714
|
}
|
|
2903
|
-
)), /* @__PURE__ */
|
|
2904
|
-
|
|
3715
|
+
)), /* @__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(
|
|
3716
|
+
import_react_ecs6.Button,
|
|
2905
3717
|
{
|
|
2906
3718
|
uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2907
3719
|
uiBackground: { color: this.streamControlling ? C2.btn : C2.green },
|
|
@@ -2910,8 +3722,8 @@ var AdminPanelUIModule = class {
|
|
|
2910
3722
|
color: C2.text,
|
|
2911
3723
|
onMouseDown: () => this.startStream()
|
|
2912
3724
|
}
|
|
2913
|
-
), this.streamData.isLive && /* @__PURE__ */
|
|
2914
|
-
|
|
3725
|
+
), this.streamData.isLive && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3726
|
+
import_react_ecs6.Button,
|
|
2915
3727
|
{
|
|
2916
3728
|
uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2917
3729
|
uiBackground: { color: this.streamControlling ? C2.btn : C2.red },
|
|
@@ -2920,18 +3732,18 @@ var AdminPanelUIModule = class {
|
|
|
2920
3732
|
color: C2.text,
|
|
2921
3733
|
onMouseDown: () => this.stopStream()
|
|
2922
3734
|
}
|
|
2923
|
-
), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */
|
|
2924
|
-
|
|
3735
|
+
), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3736
|
+
import_react_ecs6.Button,
|
|
2925
3737
|
{
|
|
2926
3738
|
uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2927
3739
|
uiBackground: { color: C2.cyan },
|
|
2928
3740
|
value: "Play on Screen",
|
|
2929
3741
|
fontSize: t.buttonSmall,
|
|
2930
3742
|
color: C2.text,
|
|
2931
|
-
onMouseDown: () => this.
|
|
3743
|
+
onMouseDown: () => this.playStreamOnScreen(this.streamData.hlsUrl)
|
|
2932
3744
|
}
|
|
2933
|
-
)), /* @__PURE__ */
|
|
2934
|
-
|
|
3745
|
+
)), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3746
|
+
import_react_ecs6.Button,
|
|
2935
3747
|
{
|
|
2936
3748
|
uiTransform: { width: this.s(80), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2937
3749
|
uiBackground: { color: C2.btn },
|
|
@@ -2940,8 +3752,8 @@ var AdminPanelUIModule = class {
|
|
|
2940
3752
|
color: C2.text,
|
|
2941
3753
|
onMouseDown: () => this.refreshStreamStatus()
|
|
2942
3754
|
}
|
|
2943
|
-
), /* @__PURE__ */
|
|
2944
|
-
|
|
3755
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3756
|
+
import_react_ecs6.Button,
|
|
2945
3757
|
{
|
|
2946
3758
|
uiTransform: { width: this.s(95), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2947
3759
|
uiBackground: { color: this.keyRotating ? C2.btn : C2.yellow },
|
|
@@ -2950,8 +3762,8 @@ var AdminPanelUIModule = class {
|
|
|
2950
3762
|
color: C2.text,
|
|
2951
3763
|
onMouseDown: () => this.rotateStreamKey()
|
|
2952
3764
|
}
|
|
2953
|
-
), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */
|
|
2954
|
-
|
|
3765
|
+
), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3766
|
+
import_react_ecs6.Button,
|
|
2955
3767
|
{
|
|
2956
3768
|
uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2957
3769
|
uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
|
|
@@ -2960,8 +3772,8 @@ var AdminPanelUIModule = class {
|
|
|
2960
3772
|
color: C2.text,
|
|
2961
3773
|
onMouseDown: () => this.deleteChannel()
|
|
2962
3774
|
}
|
|
2963
|
-
)), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */
|
|
2964
|
-
|
|
3775
|
+
)), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3776
|
+
import_react_ecs6.Button,
|
|
2965
3777
|
{
|
|
2966
3778
|
uiTransform: { width: this.s(120), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2967
3779
|
uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
|
|
@@ -2970,8 +3782,8 @@ var AdminPanelUIModule = class {
|
|
|
2970
3782
|
color: C2.text,
|
|
2971
3783
|
onMouseDown: () => this.confirmDeleteChannel()
|
|
2972
3784
|
}
|
|
2973
|
-
), /* @__PURE__ */
|
|
2974
|
-
|
|
3785
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3786
|
+
import_react_ecs6.Button,
|
|
2975
3787
|
{
|
|
2976
3788
|
uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
2977
3789
|
uiBackground: { color: C2.btn },
|
|
@@ -2980,11 +3792,11 @@ var AdminPanelUIModule = class {
|
|
|
2980
3792
|
color: C2.text,
|
|
2981
3793
|
onMouseDown: () => this.cancelDeleteChannel()
|
|
2982
3794
|
}
|
|
2983
|
-
))), this.streamControlStatus === "started" && /* @__PURE__ */
|
|
2984
|
-
|
|
3795
|
+
))), this.streamControlStatus === "started" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3796
|
+
import_react_ecs6.Input,
|
|
2985
3797
|
{
|
|
2986
3798
|
uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
|
|
2987
|
-
uiBackground: { color:
|
|
3799
|
+
uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
|
|
2988
3800
|
placeholder: "Video URL...",
|
|
2989
3801
|
placeholderColor: C2.textDim,
|
|
2990
3802
|
color: C2.text,
|
|
@@ -2994,20 +3806,18 @@ var AdminPanelUIModule = class {
|
|
|
2994
3806
|
this.customVideoUrl = val;
|
|
2995
3807
|
}
|
|
2996
3808
|
}
|
|
2997
|
-
), /* @__PURE__ */
|
|
2998
|
-
|
|
3809
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3810
|
+
import_react_ecs6.Button,
|
|
2999
3811
|
{
|
|
3000
3812
|
uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
|
|
3001
3813
|
uiBackground: { color: C2.green },
|
|
3002
3814
|
value: "Play",
|
|
3003
3815
|
fontSize: t.button,
|
|
3004
3816
|
color: C2.text,
|
|
3005
|
-
onMouseDown: () =>
|
|
3006
|
-
if (this.customVideoUrl) this.config.onVideoPlay?.(this.customVideoUrl);
|
|
3007
|
-
}
|
|
3817
|
+
onMouseDown: () => this.playNow()
|
|
3008
3818
|
}
|
|
3009
|
-
), /* @__PURE__ */
|
|
3010
|
-
|
|
3819
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3820
|
+
import_react_ecs6.Button,
|
|
3011
3821
|
{
|
|
3012
3822
|
uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 6 } },
|
|
3013
3823
|
uiBackground: { color: C2.btn },
|
|
@@ -3018,55 +3828,82 @@ var AdminPanelUIModule = class {
|
|
|
3018
3828
|
this.customVideoUrl = "";
|
|
3019
3829
|
}
|
|
3020
3830
|
}
|
|
3021
|
-
)),
|
|
3022
|
-
|
|
3831
|
+
)), this.videoStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3832
|
+
import_react_ecs6.Label,
|
|
3833
|
+
{
|
|
3834
|
+
value: this.videoStatus,
|
|
3835
|
+
fontSize: t.status,
|
|
3836
|
+
color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
3837
|
+
uiTransform: { height: this.s(18), margin: { bottom: 6 } }
|
|
3838
|
+
}
|
|
3839
|
+
), /* @__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(
|
|
3840
|
+
import_react_ecs6.Button,
|
|
3023
3841
|
{
|
|
3024
3842
|
uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
3025
3843
|
uiBackground: { color: C2.green },
|
|
3026
3844
|
value: "Play",
|
|
3027
3845
|
fontSize: t.button,
|
|
3028
3846
|
color: C2.text,
|
|
3029
|
-
onMouseDown: () => this.
|
|
3847
|
+
onMouseDown: () => this.playbackPlay()
|
|
3030
3848
|
}
|
|
3031
|
-
), /* @__PURE__ */
|
|
3032
|
-
|
|
3849
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3850
|
+
import_react_ecs6.Button,
|
|
3033
3851
|
{
|
|
3034
3852
|
uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
3035
3853
|
uiBackground: { color: C2.red },
|
|
3036
3854
|
value: "Stop",
|
|
3037
3855
|
fontSize: t.button,
|
|
3038
3856
|
color: C2.text,
|
|
3039
|
-
onMouseDown: () => this.
|
|
3857
|
+
onMouseDown: () => this.playbackStop()
|
|
3040
3858
|
}
|
|
3041
|
-
), /* @__PURE__ */
|
|
3042
|
-
|
|
3859
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3860
|
+
import_react_ecs6.Button,
|
|
3043
3861
|
{
|
|
3044
3862
|
uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
3045
3863
|
uiBackground: { color: C2.btn },
|
|
3046
3864
|
value: "Reset Default",
|
|
3047
3865
|
fontSize: t.buttonSmall,
|
|
3048
3866
|
color: C2.text,
|
|
3049
|
-
onMouseDown: () => this.
|
|
3867
|
+
onMouseDown: () => this.resetDefault()
|
|
3050
3868
|
}
|
|
3051
|
-
)), /* @__PURE__ */
|
|
3052
|
-
|
|
3869
|
+
)), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, ["slot1", "slot2", "slot3", "slot4", "slot5"].map((slot, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3870
|
+
import_react_ecs6.Button,
|
|
3871
|
+
{
|
|
3872
|
+
key: `play-${slot}`,
|
|
3873
|
+
uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
3874
|
+
uiBackground: { color: C2.cyan },
|
|
3875
|
+
value: `Play ${i + 1}`,
|
|
3876
|
+
fontSize: t.button,
|
|
3877
|
+
color: C2.text,
|
|
3878
|
+
onMouseDown: () => this.pressSlot(slot)
|
|
3879
|
+
}
|
|
3880
|
+
))), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3881
|
+
import_react_ecs6.Button,
|
|
3053
3882
|
{
|
|
3054
3883
|
uiTransform: { height: this.s(24) },
|
|
3055
|
-
uiBackground: { color:
|
|
3884
|
+
uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
|
|
3056
3885
|
value: "Edit slots at thestatic.tv",
|
|
3057
3886
|
fontSize: t.labelSmall,
|
|
3058
3887
|
color: C2.cyan,
|
|
3059
|
-
onMouseDown: () => (0,
|
|
3888
|
+
onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
|
|
3060
3889
|
}
|
|
3061
3890
|
));
|
|
3062
3891
|
};
|
|
3063
3892
|
this.ModTab = () => {
|
|
3064
3893
|
const t = this.theme;
|
|
3065
|
-
return /* @__PURE__ */
|
|
3066
|
-
|
|
3894
|
+
return /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "Error - check input", fontSize: t.status, color: C2.red }), this.kickStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3895
|
+
import_react_ecs6.Label,
|
|
3896
|
+
{
|
|
3897
|
+
value: this.kickStatus,
|
|
3898
|
+
fontSize: t.status,
|
|
3899
|
+
color: this.kickStatus.startsWith("Kick not sent") ? C2.red : C2.green,
|
|
3900
|
+
uiTransform: { height: this.s(18) }
|
|
3901
|
+
}
|
|
3902
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3903
|
+
import_react_ecs6.Input,
|
|
3067
3904
|
{
|
|
3068
3905
|
uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
|
|
3069
|
-
uiBackground: { color:
|
|
3906
|
+
uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
|
|
3070
3907
|
placeholder: "Message to all players...",
|
|
3071
3908
|
placeholderColor: C2.textDim,
|
|
3072
3909
|
color: C2.text,
|
|
@@ -3076,8 +3913,8 @@ var AdminPanelUIModule = class {
|
|
|
3076
3913
|
this.broadcastText = val;
|
|
3077
3914
|
}
|
|
3078
3915
|
}
|
|
3079
|
-
), /* @__PURE__ */
|
|
3080
|
-
|
|
3916
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3917
|
+
import_react_ecs6.Button,
|
|
3081
3918
|
{
|
|
3082
3919
|
uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
|
|
3083
3920
|
uiBackground: { color: C2.orange },
|
|
@@ -3086,27 +3923,51 @@ var AdminPanelUIModule = class {
|
|
|
3086
3923
|
color: C2.text,
|
|
3087
3924
|
onMouseDown: () => this.sendBroadcast()
|
|
3088
3925
|
}
|
|
3089
|
-
)),
|
|
3090
|
-
|
|
3926
|
+
)), this.broadcastStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3927
|
+
import_react_ecs6.Label,
|
|
3928
|
+
{
|
|
3929
|
+
value: this.broadcastStatus,
|
|
3930
|
+
fontSize: t.status,
|
|
3931
|
+
color: this.broadcastStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
3932
|
+
uiTransform: { height: this.s(18), margin: { bottom: 6 } }
|
|
3933
|
+
}
|
|
3934
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3935
|
+
import_react_ecs6.Button,
|
|
3091
3936
|
{
|
|
3092
3937
|
uiTransform: { width: this.s(130), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: 4 },
|
|
3093
3938
|
uiBackground: { color: C2.red },
|
|
3094
3939
|
value: "KICK ALL",
|
|
3095
3940
|
fontSize: t.button,
|
|
3096
3941
|
color: C2.text,
|
|
3097
|
-
onMouseDown: () =>
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3942
|
+
onMouseDown: () => this.kickAll()
|
|
3943
|
+
}
|
|
3944
|
+
)), this.venue && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "PRIVATE MODE", color: C2.yellow }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "While ON, only citizens get in", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { height: this.s(18), margin: { bottom: 4 } } }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, [true, false].map((on) => /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3945
|
+
import_react_ecs6.Button,
|
|
3946
|
+
{
|
|
3947
|
+
key: `private-${on ? "on" : "off"}`,
|
|
3948
|
+
uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
|
|
3949
|
+
uiBackground: { color: this.privateModeOn === on ? C2.yellow : C2.btn },
|
|
3950
|
+
value: on ? "ON" : "OFF",
|
|
3951
|
+
fontSize: t.buttonSmall,
|
|
3952
|
+
color: this.privateModeOn === on ? import_math7.Color4.Black() : C2.text,
|
|
3953
|
+
onMouseDown: () => this.setPrivateMode(on)
|
|
3101
3954
|
}
|
|
3102
|
-
))
|
|
3103
|
-
|
|
3955
|
+
))), this.privateStatus && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3956
|
+
import_react_ecs6.Label,
|
|
3957
|
+
{
|
|
3958
|
+
value: this.privateStatus,
|
|
3959
|
+
fontSize: t.status,
|
|
3960
|
+
color: this.privateStatus.startsWith("Not sent") ? C2.red : C2.green,
|
|
3961
|
+
uiTransform: { height: this.s(18) }
|
|
3962
|
+
}
|
|
3963
|
+
)), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3964
|
+
import_react_ecs6.UiEntity,
|
|
3104
3965
|
{
|
|
3105
3966
|
key: `admin-${i}`,
|
|
3106
3967
|
uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
|
|
3107
3968
|
},
|
|
3108
|
-
/* @__PURE__ */
|
|
3109
|
-
|
|
3969
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3970
|
+
import_react_ecs6.Label,
|
|
3110
3971
|
{
|
|
3111
3972
|
value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
|
|
3112
3973
|
fontSize: t.label,
|
|
@@ -3114,8 +3975,8 @@ var AdminPanelUIModule = class {
|
|
|
3114
3975
|
uiTransform: { width: this.s(130) }
|
|
3115
3976
|
}
|
|
3116
3977
|
),
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
|
|
3978
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3979
|
+
import_react_ecs6.Button,
|
|
3119
3980
|
{
|
|
3120
3981
|
uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
|
|
3121
3982
|
uiBackground: { color: C2.btn },
|
|
@@ -3125,11 +3986,11 @@ var AdminPanelUIModule = class {
|
|
|
3125
3986
|
onMouseDown: () => this.removeSceneAdmin(wallet)
|
|
3126
3987
|
}
|
|
3127
3988
|
)
|
|
3128
|
-
))), /* @__PURE__ */
|
|
3129
|
-
|
|
3989
|
+
))), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3990
|
+
import_react_ecs6.Input,
|
|
3130
3991
|
{
|
|
3131
3992
|
uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
|
|
3132
|
-
uiBackground: { color:
|
|
3993
|
+
uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
|
|
3133
3994
|
placeholder: "0x... add admin",
|
|
3134
3995
|
placeholderColor: C2.textDim,
|
|
3135
3996
|
color: C2.text,
|
|
@@ -3139,8 +4000,8 @@ var AdminPanelUIModule = class {
|
|
|
3139
4000
|
this.newAdminWallet = val;
|
|
3140
4001
|
}
|
|
3141
4002
|
}
|
|
3142
|
-
), /* @__PURE__ */
|
|
3143
|
-
|
|
4003
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4004
|
+
import_react_ecs6.Button,
|
|
3144
4005
|
{
|
|
3145
4006
|
uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
|
|
3146
4007
|
uiBackground: { color: C2.purple },
|
|
@@ -3151,14 +4012,14 @@ var AdminPanelUIModule = class {
|
|
|
3151
4012
|
if (this.newAdminWallet) this.addSceneAdmin(this.newAdminWallet);
|
|
3152
4013
|
}
|
|
3153
4014
|
}
|
|
3154
|
-
)), /* @__PURE__ */
|
|
3155
|
-
|
|
4015
|
+
)), /* @__PURE__ */ import_react_ecs6.default.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4016
|
+
import_react_ecs6.UiEntity,
|
|
3156
4017
|
{
|
|
3157
4018
|
key: `ban-${i}`,
|
|
3158
4019
|
uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
|
|
3159
4020
|
},
|
|
3160
|
-
/* @__PURE__ */
|
|
3161
|
-
|
|
4021
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4022
|
+
import_react_ecs6.Label,
|
|
3162
4023
|
{
|
|
3163
4024
|
value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
|
|
3164
4025
|
fontSize: t.label,
|
|
@@ -3166,8 +4027,8 @@ var AdminPanelUIModule = class {
|
|
|
3166
4027
|
uiTransform: { width: this.s(130) }
|
|
3167
4028
|
}
|
|
3168
4029
|
),
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
|
|
4030
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4031
|
+
import_react_ecs6.Button,
|
|
3171
4032
|
{
|
|
3172
4033
|
uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
|
|
3173
4034
|
uiBackground: { color: C2.green },
|
|
@@ -3177,11 +4038,11 @@ var AdminPanelUIModule = class {
|
|
|
3177
4038
|
onMouseDown: () => this.unbanWallet(wallet)
|
|
3178
4039
|
}
|
|
3179
4040
|
)
|
|
3180
|
-
))), /* @__PURE__ */
|
|
3181
|
-
|
|
4041
|
+
))), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4042
|
+
import_react_ecs6.Input,
|
|
3182
4043
|
{
|
|
3183
4044
|
uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
|
|
3184
|
-
uiBackground: { color:
|
|
4045
|
+
uiBackground: { color: import_math7.Color4.create(0.15, 0.15, 0.2, 1) },
|
|
3185
4046
|
placeholder: "0x... ban wallet",
|
|
3186
4047
|
placeholderColor: C2.textDim,
|
|
3187
4048
|
color: C2.text,
|
|
@@ -3191,8 +4052,8 @@ var AdminPanelUIModule = class {
|
|
|
3191
4052
|
this.newBanWallet = val;
|
|
3192
4053
|
}
|
|
3193
4054
|
}
|
|
3194
|
-
), /* @__PURE__ */
|
|
3195
|
-
|
|
4055
|
+
), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4056
|
+
import_react_ecs6.Button,
|
|
3196
4057
|
{
|
|
3197
4058
|
uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
|
|
3198
4059
|
uiBackground: { color: C2.red },
|
|
@@ -3203,15 +4064,15 @@ var AdminPanelUIModule = class {
|
|
|
3203
4064
|
if (this.newBanWallet) this.banWallet(this.newBanWallet);
|
|
3204
4065
|
}
|
|
3205
4066
|
}
|
|
3206
|
-
)), /* @__PURE__ */
|
|
3207
|
-
|
|
4067
|
+
)), /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4068
|
+
import_react_ecs6.Button,
|
|
3208
4069
|
{
|
|
3209
4070
|
uiTransform: { height: this.s(24) },
|
|
3210
|
-
uiBackground: { color:
|
|
4071
|
+
uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
|
|
3211
4072
|
value: "Manage at thestatic.tv",
|
|
3212
4073
|
fontSize: t.labelSmall,
|
|
3213
4074
|
color: C2.cyan,
|
|
3214
|
-
onMouseDown: () => (0,
|
|
4075
|
+
onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
|
|
3215
4076
|
}
|
|
3216
4077
|
));
|
|
3217
4078
|
};
|
|
@@ -3220,11 +4081,24 @@ var AdminPanelUIModule = class {
|
|
|
3220
4081
|
* Always renders notification (scaled), admin panel only for admins
|
|
3221
4082
|
*/
|
|
3222
4083
|
this.getComponent = () => {
|
|
4084
|
+
if (this.moderation.blocked) {
|
|
4085
|
+
return BlockedNotice({
|
|
4086
|
+
standing: this.moderation.standing,
|
|
4087
|
+
kickLeftMs: this.moderation.kickLeftMs,
|
|
4088
|
+
scale: this.client.uiScale,
|
|
4089
|
+
// thestatic.tv's own origin, for a private event's BECOME A CITIZEN (2026-11-19): the API base less its path, as
|
|
4090
|
+
// the chat's REGISTER IDENTITY derives its /login
|
|
4091
|
+
siteUrl: this.baseUrl.replace("/api/v1/dcl", "")
|
|
4092
|
+
});
|
|
4093
|
+
}
|
|
3223
4094
|
if (!this.isAdmin) {
|
|
3224
4095
|
return this.renderScaledNotification();
|
|
3225
4096
|
}
|
|
3226
4097
|
const t = this.theme;
|
|
3227
4098
|
const tabs = [];
|
|
4099
|
+
if (this.venue && this.controls.length > 0) {
|
|
4100
|
+
tabs.push({ label: "CONTROLS", id: "controls" });
|
|
4101
|
+
}
|
|
3228
4102
|
if (this.config.sceneTabs && this.config.sceneTabs.length > 0) {
|
|
3229
4103
|
this.config.sceneTabs.forEach((tab) => tabs.push({ label: tab.label, id: tab.id }));
|
|
3230
4104
|
}
|
|
@@ -3237,8 +4111,8 @@ var AdminPanelUIModule = class {
|
|
|
3237
4111
|
if (!tabs.find((tab) => tab.id === this.activeTab) && tabs.length > 0) {
|
|
3238
4112
|
this.activeTab = tabs[0].id;
|
|
3239
4113
|
}
|
|
3240
|
-
return /* @__PURE__ */
|
|
3241
|
-
|
|
4114
|
+
return /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4115
|
+
import_react_ecs6.UiEntity,
|
|
3242
4116
|
{
|
|
3243
4117
|
uiTransform: {
|
|
3244
4118
|
width: "100%",
|
|
@@ -3247,16 +4121,16 @@ var AdminPanelUIModule = class {
|
|
|
3247
4121
|
}
|
|
3248
4122
|
},
|
|
3249
4123
|
this.renderScaledNotification(),
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
|
|
4124
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4125
|
+
import_react_ecs6.UiEntity,
|
|
3252
4126
|
{
|
|
3253
4127
|
uiTransform: {
|
|
3254
4128
|
position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
|
|
3255
4129
|
positionType: "absolute"
|
|
3256
4130
|
}
|
|
3257
4131
|
},
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
|
|
4132
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4133
|
+
import_react_ecs6.Button,
|
|
3260
4134
|
{
|
|
3261
4135
|
uiTransform: { width: this.s(100), height: this.s(45) },
|
|
3262
4136
|
uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
|
|
@@ -3267,8 +4141,8 @@ var AdminPanelUIModule = class {
|
|
|
3267
4141
|
}
|
|
3268
4142
|
)
|
|
3269
4143
|
),
|
|
3270
|
-
this.panelOpen && /* @__PURE__ */
|
|
3271
|
-
|
|
4144
|
+
this.panelOpen && /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4145
|
+
import_react_ecs6.UiEntity,
|
|
3272
4146
|
{
|
|
3273
4147
|
key: `admin-panel-${this.client.uiScale}`,
|
|
3274
4148
|
uiTransform: {
|
|
@@ -3281,8 +4155,8 @@ var AdminPanelUIModule = class {
|
|
|
3281
4155
|
},
|
|
3282
4156
|
uiBackground: { color: C2.bg }
|
|
3283
4157
|
},
|
|
3284
|
-
/* @__PURE__ */
|
|
3285
|
-
|
|
4158
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4159
|
+
import_react_ecs6.UiEntity,
|
|
3286
4160
|
{
|
|
3287
4161
|
uiTransform: {
|
|
3288
4162
|
width: "100%",
|
|
@@ -3294,12 +4168,12 @@ var AdminPanelUIModule = class {
|
|
|
3294
4168
|
},
|
|
3295
4169
|
uiBackground: { color: C2.header }
|
|
3296
4170
|
},
|
|
3297
|
-
/* @__PURE__ */
|
|
3298
|
-
/* @__PURE__ */
|
|
3299
|
-
|
|
4171
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
|
|
4172
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4173
|
+
import_react_ecs6.Button,
|
|
3300
4174
|
{
|
|
3301
4175
|
uiTransform: { width: this.s(28), height: this.s(28) },
|
|
3302
|
-
uiBackground: { color:
|
|
4176
|
+
uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0.3) },
|
|
3303
4177
|
value: "X",
|
|
3304
4178
|
fontSize: t.header,
|
|
3305
4179
|
color: THEME.colors.red,
|
|
@@ -3307,9 +4181,9 @@ var AdminPanelUIModule = class {
|
|
|
3307
4181
|
}
|
|
3308
4182
|
)
|
|
3309
4183
|
),
|
|
3310
|
-
/* @__PURE__ */
|
|
3311
|
-
/* @__PURE__ */
|
|
3312
|
-
|
|
4184
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ import_react_ecs6.default.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
|
|
4185
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4186
|
+
import_react_ecs6.UiEntity,
|
|
3313
4187
|
{
|
|
3314
4188
|
uiTransform: {
|
|
3315
4189
|
width: "100%",
|
|
@@ -3318,12 +4192,13 @@ var AdminPanelUIModule = class {
|
|
|
3318
4192
|
flexDirection: "column"
|
|
3319
4193
|
}
|
|
3320
4194
|
},
|
|
3321
|
-
this.activeTab === "
|
|
3322
|
-
this.activeTab === "
|
|
4195
|
+
this.activeTab === "controls" && this.venue && this.controls.length > 0 && /* @__PURE__ */ import_react_ecs6.default.createElement(this.ControlsTab, null),
|
|
4196
|
+
this.activeTab === "video" && /* @__PURE__ */ import_react_ecs6.default.createElement(this.VideoTab, null),
|
|
4197
|
+
this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ import_react_ecs6.default.createElement(this.ModTab, null),
|
|
3323
4198
|
this.config.sceneTabs?.map((tab) => this.activeTab === tab.id && tab.render())
|
|
3324
4199
|
),
|
|
3325
|
-
/* @__PURE__ */
|
|
3326
|
-
|
|
4200
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4201
|
+
import_react_ecs6.UiEntity,
|
|
3327
4202
|
{
|
|
3328
4203
|
uiTransform: {
|
|
3329
4204
|
width: "100%",
|
|
@@ -3333,15 +4208,15 @@ var AdminPanelUIModule = class {
|
|
|
3333
4208
|
},
|
|
3334
4209
|
uiBackground: { color: C2.section }
|
|
3335
4210
|
},
|
|
3336
|
-
/* @__PURE__ */
|
|
3337
|
-
|
|
4211
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
4212
|
+
import_react_ecs6.Button,
|
|
3338
4213
|
{
|
|
3339
4214
|
uiTransform: { height: this.s(24) },
|
|
3340
|
-
uiBackground: { color:
|
|
4215
|
+
uiBackground: { color: import_math7.Color4.create(0, 0, 0, 0) },
|
|
3341
4216
|
value: `thestatic.tv/scene/${this.config.sceneId}`,
|
|
3342
4217
|
fontSize: t.labelSmall,
|
|
3343
4218
|
color: C2.cyan,
|
|
3344
|
-
onMouseDown: () => (0,
|
|
4219
|
+
onMouseDown: () => (0, import_RestrictedActions6.openExternalUrl)({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
|
|
3345
4220
|
}
|
|
3346
4221
|
)
|
|
3347
4222
|
)
|
|
@@ -3362,14 +4237,41 @@ var AdminPanelUIModule = class {
|
|
|
3362
4237
|
// Ensure sceneId is set
|
|
3363
4238
|
};
|
|
3364
4239
|
this.baseUrl = client.getBaseUrl();
|
|
4240
|
+
this.moderation = new ModerationModule({
|
|
4241
|
+
reread: () => this.checkAdminStatus(),
|
|
4242
|
+
myWallet: () => this.myWallet(),
|
|
4243
|
+
onChange: (blocked, standing) => this.onStandingChange(blocked, standing),
|
|
4244
|
+
log: (msg, ...args) => this.log(msg, ...args)
|
|
4245
|
+
});
|
|
4246
|
+
this.adminWait = new PlayerWait({
|
|
4247
|
+
getPlayer: () => (0, import_players2.getPlayer)(),
|
|
4248
|
+
setInterval: dclSetInterval,
|
|
4249
|
+
clearInterval: dclClearInterval,
|
|
4250
|
+
check: (player) => this.checkAdminFor(player),
|
|
4251
|
+
log: (msg) => this.log(msg)
|
|
4252
|
+
});
|
|
3365
4253
|
if (config.headerColor) {
|
|
3366
|
-
C2.header =
|
|
4254
|
+
C2.header = import_math7.Color4.create(
|
|
3367
4255
|
config.headerColor.r,
|
|
3368
4256
|
config.headerColor.g,
|
|
3369
4257
|
config.headerColor.b,
|
|
3370
4258
|
config.headerColor.a
|
|
3371
4259
|
);
|
|
3372
4260
|
}
|
|
4261
|
+
if (config.controls && config.controls.length > 0) this.registerControls(config.controls);
|
|
4262
|
+
}
|
|
4263
|
+
kickLine(sent) {
|
|
4264
|
+
return { sent, notSent: "Kick not sent", show: (line) => {
|
|
4265
|
+
this.kickStatus = line;
|
|
4266
|
+
} };
|
|
4267
|
+
}
|
|
4268
|
+
/**
|
|
4269
|
+
* The Venue tier (2026-11-19): scene controls and private mode are Venue's, so the CONTROLS tab, the declaration's
|
|
4270
|
+
* upload, a press, the saved state's read, a queued control's run and the private-mode switch all need it. The
|
|
4271
|
+
* client knows it from the session start, before this panel exists.
|
|
4272
|
+
*/
|
|
4273
|
+
get venue() {
|
|
4274
|
+
return this.client.hasVenueFeatures === true;
|
|
3373
4275
|
}
|
|
3374
4276
|
log(msg, ...args) {
|
|
3375
4277
|
if (this.config.debug) {
|
|
@@ -3388,26 +4290,36 @@ var AdminPanelUIModule = class {
|
|
|
3388
4290
|
* Initialize the admin panel - checks admin status and fetches video state
|
|
3389
4291
|
*/
|
|
3390
4292
|
async init() {
|
|
4293
|
+
this.moderation.start().catch(() => {
|
|
4294
|
+
});
|
|
3391
4295
|
await this.checkAdminStatus();
|
|
3392
4296
|
await this.fetchVideoState();
|
|
3393
4297
|
this.autoPlayDefault();
|
|
4298
|
+
this.loadReadsDone = true;
|
|
4299
|
+
await this.readSavedState();
|
|
3394
4300
|
this.startCommandPolling();
|
|
3395
4301
|
this.log("Initialized");
|
|
3396
4302
|
}
|
|
3397
4303
|
/**
|
|
3398
|
-
* Check if current player is an admin for this scene
|
|
4304
|
+
* Check if current player is an admin for this scene. With no player yet it waits for one on the SDK's timer and
|
|
4305
|
+
* checks then (utils/player-wait.ts): one wait at a time, ended quietly after 30 s with no wallet. A guest reading
|
|
4306
|
+
* (isGuest true) is checked at once and the wait goes on for a non-guest reading, checked once more if one comes
|
|
4307
|
+
* within the 30 s. Resolves when the check is done, or at once when there is none to run.
|
|
3399
4308
|
*/
|
|
3400
4309
|
async checkAdminStatus() {
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
}
|
|
4310
|
+
await this.adminWait.run();
|
|
4311
|
+
}
|
|
4312
|
+
/** The admin check proper, for a player the explorer has resolved */
|
|
4313
|
+
async checkAdminFor(player) {
|
|
3406
4314
|
this.playerWallet = player.userId;
|
|
3407
4315
|
if (this.config.forceAdmin) {
|
|
3408
4316
|
this.isAdmin = true;
|
|
3409
4317
|
this.isOwner = true;
|
|
4318
|
+
this.moderation.applyStanding({ isBanned: false, canModerate: true });
|
|
3410
4319
|
this.log("Admin status FORCED (forceAdmin: true)");
|
|
4320
|
+
this.uploadControls().catch(() => {
|
|
4321
|
+
});
|
|
4322
|
+
this.client.frames?.adminCheckSucceeded();
|
|
3411
4323
|
return;
|
|
3412
4324
|
}
|
|
3413
4325
|
try {
|
|
@@ -3418,17 +4330,54 @@ var AdminPanelUIModule = class {
|
|
|
3418
4330
|
const data = await res.json();
|
|
3419
4331
|
this.isAdmin = data.showButton ?? data.hasAccess;
|
|
3420
4332
|
this.isOwner = data.isOwner || data.isSceneAdmin;
|
|
3421
|
-
|
|
4333
|
+
const wasBanned = this.moderation.standing === "banned";
|
|
4334
|
+
if (typeof data.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
|
|
4335
|
+
this.moderation.applyStanding({
|
|
4336
|
+
isBanned: data.isBanned === true,
|
|
4337
|
+
canModerate: data.showButton === true || data.hasAccess === true,
|
|
4338
|
+
privateBlocked: data.privateBlocked === true,
|
|
4339
|
+
isCitizen: data.isCitizen === true
|
|
4340
|
+
});
|
|
4341
|
+
if (data.isBanned === true && !wasBanned) {
|
|
3422
4342
|
this.config.onBroadcast?.("You have been banned from this scene.");
|
|
3423
|
-
this.
|
|
3424
|
-
this.log("Player is banned - kicking");
|
|
4343
|
+
this.log("Player is banned - blocked");
|
|
3425
4344
|
}
|
|
3426
4345
|
this.log("Admin status:", this.isAdmin, "Owner:", this.isOwner);
|
|
4346
|
+
if (this.isAdmin) this.uploadControls().catch(() => {
|
|
4347
|
+
});
|
|
4348
|
+
if (this.isAdmin) this.client.frames?.adminCheckSucceeded();
|
|
3427
4349
|
}
|
|
3428
4350
|
} catch (err) {
|
|
3429
4351
|
this.log("Admin check error:", err);
|
|
3430
4352
|
}
|
|
3431
4353
|
}
|
|
4354
|
+
/** My wallet, lowercased: admin-check's player, else the explorer's */
|
|
4355
|
+
myWallet() {
|
|
4356
|
+
let wallet = this.playerWallet;
|
|
4357
|
+
if (!wallet) {
|
|
4358
|
+
try {
|
|
4359
|
+
wallet = (0, import_players2.getPlayer)()?.userId || "";
|
|
4360
|
+
} catch {
|
|
4361
|
+
wallet = "";
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
return wallet ? wallet.toLowerCase() : null;
|
|
4365
|
+
}
|
|
4366
|
+
/** Blocked turned on or off: the panel closes, and the client stops what it plays and tells the scene */
|
|
4367
|
+
onStandingChange(blocked, standing) {
|
|
4368
|
+
if (blocked) this.hide();
|
|
4369
|
+
this.client._onBlockedChange?.(blocked, standing);
|
|
4370
|
+
}
|
|
4371
|
+
/** True while this visitor is banned or kicked (2026-11-17) */
|
|
4372
|
+
get isVisitorBlocked() {
|
|
4373
|
+
return this.moderation.blocked;
|
|
4374
|
+
}
|
|
4375
|
+
/** A url the scene's queue or the slots would play - nothing while this visitor is blocked */
|
|
4376
|
+
playUrl(url) {
|
|
4377
|
+
if (this.moderation.blocked) return;
|
|
4378
|
+
this.currentVideoUrl = url;
|
|
4379
|
+
this.config.onVideoPlay?.(url);
|
|
4380
|
+
}
|
|
3432
4381
|
/**
|
|
3433
4382
|
* Toggle the admin panel open/closed
|
|
3434
4383
|
*/
|
|
@@ -3480,6 +4429,128 @@ var AdminPanelUIModule = class {
|
|
|
3480
4429
|
this.config.sceneTabs.push(tab);
|
|
3481
4430
|
this.log("Registered scene tab:", tab.label);
|
|
3482
4431
|
}
|
|
4432
|
+
// --- Scene controls (2026-11-18; Venue since 2026-11-19, Pro until then) ---
|
|
4433
|
+
/**
|
|
4434
|
+
* Register scene controls: the CONTROLS tab draws them, a press reaches every visitor's copy through the scene's
|
|
4435
|
+
* queue, and the declaration goes to the scene's record once an admin's check has succeeded. The same as the config's
|
|
4436
|
+
* `controls`; a control registered again by id replaces the earlier one. Only the shape is checked here - thestatic.tv
|
|
4437
|
+
* checks the ids, labels and bounds when the declaration is uploaded, and every press against it.
|
|
4438
|
+
*/
|
|
4439
|
+
registerControls(controls) {
|
|
4440
|
+
for (const control of controls) {
|
|
4441
|
+
if (!control || typeof control.id !== "string" || !Array.isArray(control.options) || typeof control.onChange !== "function") {
|
|
4442
|
+
this.log("Scene control skipped - not a SceneControl:", control);
|
|
4443
|
+
continue;
|
|
4444
|
+
}
|
|
4445
|
+
const at = this.controls.findIndex((c) => c.id === control.id);
|
|
4446
|
+
if (at >= 0) this.controls[at] = control;
|
|
4447
|
+
else this.controls.push(control);
|
|
4448
|
+
}
|
|
4449
|
+
this.log("Registered scene controls:", this.controls.map((c) => c.id));
|
|
4450
|
+
this.readSavedState().catch(() => {
|
|
4451
|
+
});
|
|
4452
|
+
this.uploadControls().catch(() => {
|
|
4453
|
+
});
|
|
4454
|
+
}
|
|
4455
|
+
/** True when `option` is one of the control's, or 'off' on a control that has OFF */
|
|
4456
|
+
isControlOption(control, option) {
|
|
4457
|
+
if (option === "off") return control.off === true;
|
|
4458
|
+
return control.options.some((o) => o.id === option);
|
|
4459
|
+
}
|
|
4460
|
+
/** A queued sceneControl's registered control and valid option, or null for anything else */
|
|
4461
|
+
controlCommand(payload) {
|
|
4462
|
+
const p = payload;
|
|
4463
|
+
if (!p || typeof p.control !== "string" || typeof p.option !== "string") return null;
|
|
4464
|
+
const control = this.controls.find((c) => c.id === p.control);
|
|
4465
|
+
if (!control || !this.isControlOption(control, p.option)) return null;
|
|
4466
|
+
return { control, option: p.option };
|
|
4467
|
+
}
|
|
4468
|
+
/** Run a control's option on this copy and mark it current; a handler that throws is logged and breaks nothing else */
|
|
4469
|
+
applyControl(control, option) {
|
|
4470
|
+
this.currentOption[control.id] = option;
|
|
4471
|
+
try {
|
|
4472
|
+
control.onChange(option);
|
|
4473
|
+
} catch (err) {
|
|
4474
|
+
this.log("Control handler failed:", control.id, option, err);
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
/** A press in the CONTROLS tab: this copy runs it at once, then everyone's through the queue (Venue, 2026-11-19) */
|
|
4478
|
+
async pressControl(control, option) {
|
|
4479
|
+
if (!this.venue) return;
|
|
4480
|
+
this.applyControl(control, option);
|
|
4481
|
+
await this.sendSceneCommand("sceneControl", { control: control.id, option }, this.controlLine);
|
|
4482
|
+
}
|
|
4483
|
+
/**
|
|
4484
|
+
* The saved option of every persist control, read once a load from the scene's public state route - after the admin
|
|
4485
|
+
* check and the video state, before the poll starts - and run on this copy, so a late arrival sees what the last
|
|
4486
|
+
* press set. A saved option that is not one of the control's is ignored, as is a failed read; a control with no saved
|
|
4487
|
+
* option keeps the scene's own default.
|
|
4488
|
+
*/
|
|
4489
|
+
async readSavedState() {
|
|
4490
|
+
if (this.stateRead || !this.loadReadsDone || !this.venue) return;
|
|
4491
|
+
const persisted = this.controls.filter((c) => c.persist === true);
|
|
4492
|
+
if (persisted.length === 0) return;
|
|
4493
|
+
this.stateRead = true;
|
|
4494
|
+
try {
|
|
4495
|
+
const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/state`);
|
|
4496
|
+
if (!res.ok) {
|
|
4497
|
+
this.log("Scene state read refused:", res.status);
|
|
4498
|
+
return;
|
|
4499
|
+
}
|
|
4500
|
+
const data = await res.json();
|
|
4501
|
+
const state = data && typeof data.state === "object" && data.state !== null ? data.state : {};
|
|
4502
|
+
for (const control of persisted) {
|
|
4503
|
+
const saved = state[control.id];
|
|
4504
|
+
if (typeof saved === "string" && this.isControlOption(control, saved)) {
|
|
4505
|
+
this.log("Saved control option:", control.id, saved);
|
|
4506
|
+
this.applyControl(control, saved);
|
|
4507
|
+
}
|
|
4508
|
+
}
|
|
4509
|
+
} catch (err) {
|
|
4510
|
+
this.log("Scene state read error:", err);
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
/**
|
|
4514
|
+
* The declaration - each control's id, label, options, off and persist, never its handler - posted once a load to the
|
|
4515
|
+
* scene's record on thestatic.tv, from a copy whose admin check succeeded, so the scene's page draws the same buttons.
|
|
4516
|
+
* thestatic.tv checks the shape and bounds and writes only a declaration that differs. A refusal is logged, never
|
|
4517
|
+
* shown to the visitor, and not retried in this load.
|
|
4518
|
+
*/
|
|
4519
|
+
async uploadControls() {
|
|
4520
|
+
if (this.controlsUploaded || !this.isAdmin || !this.venue || this.controls.length === 0) return;
|
|
4521
|
+
this.controlsUploaded = true;
|
|
4522
|
+
const controls = this.controls.map((c) => ({
|
|
4523
|
+
id: c.id,
|
|
4524
|
+
label: c.label,
|
|
4525
|
+
options: c.options.map((o) => ({ id: o.id, label: o.label })),
|
|
4526
|
+
off: c.off === true,
|
|
4527
|
+
persist: c.persist === true
|
|
4528
|
+
}));
|
|
4529
|
+
try {
|
|
4530
|
+
const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/config`, {
|
|
4531
|
+
method: "POST",
|
|
4532
|
+
headers: { "Content-Type": "application/json" },
|
|
4533
|
+
body: JSON.stringify({ controls })
|
|
4534
|
+
});
|
|
4535
|
+
if (res.ok) {
|
|
4536
|
+
this.log("Scene controls declared:", controls.map((c) => c.id));
|
|
4537
|
+
return;
|
|
4538
|
+
}
|
|
4539
|
+
const data = await res.json().catch(() => ({}));
|
|
4540
|
+
this.log("Scene controls declaration refused:", res.status, data.error);
|
|
4541
|
+
} catch (err) {
|
|
4542
|
+
this.log("Scene controls declaration error:", err);
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
/** Remember a command id the poll has run or this copy has sent, forgetting the oldest past SEEN_COMMAND_IDS_MAX */
|
|
4546
|
+
markCommandSeen(id) {
|
|
4547
|
+
if (this.seenCommandIds.has(id)) return;
|
|
4548
|
+
this.seenCommandIds.add(id);
|
|
4549
|
+
this.seenCommandOrder.push(id);
|
|
4550
|
+
while (this.seenCommandOrder.length > SEEN_COMMAND_IDS_MAX) {
|
|
4551
|
+
this.seenCommandIds.delete(this.seenCommandOrder.shift());
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
3483
4554
|
// --- Stream Polling ---
|
|
3484
4555
|
startStreamPolling() {
|
|
3485
4556
|
if (this.pollIntervalId !== null) return;
|
|
@@ -3520,52 +4591,91 @@ var AdminPanelUIModule = class {
|
|
|
3520
4591
|
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
3521
4592
|
*/
|
|
3522
4593
|
async signedRequest(url, init = {}) {
|
|
3523
|
-
const res = await (0,
|
|
4594
|
+
const res = await (0, import_SignedFetch3.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
|
|
3524
4595
|
return {
|
|
3525
4596
|
ok: res.ok,
|
|
3526
4597
|
status: res.status,
|
|
3527
4598
|
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
3528
4599
|
};
|
|
3529
4600
|
}
|
|
4601
|
+
/**
|
|
4602
|
+
* 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
|
|
4603
|
+
* cursor back as `since` once it has one - the first poll has none, so the 30-second replay on load stays, which the
|
|
4604
|
+
* kicks rely on - and tells commands apart by id: a bounded set of the last SEEN_COMMAND_IDS_MAX, this copy's own
|
|
4605
|
+
* sends among them (a press is not run twice here), so two commands in one millisecond both run. A command with no id
|
|
4606
|
+
* falls back to the timestamp rule every command used until then, and a server that answers no cursor (production
|
|
4607
|
+
* before 2026-11-18) gets no since and is read as before.
|
|
4608
|
+
*/
|
|
3530
4609
|
async pollCommands() {
|
|
3531
4610
|
try {
|
|
3532
|
-
const
|
|
4611
|
+
const since = this.commandCursor !== null ? `?since=${this.commandCursor}` : "";
|
|
4612
|
+
const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands${since}`);
|
|
3533
4613
|
if (!res.ok) return;
|
|
3534
4614
|
const data = await res.json();
|
|
3535
4615
|
const commands = data.commands || [];
|
|
4616
|
+
if (typeof data.cursor === "number") this.commandCursor = data.cursor;
|
|
3536
4617
|
for (const cmd of commands) {
|
|
3537
|
-
if (cmd.
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
this.
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
this.
|
|
3549
|
-
} else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
|
|
3550
|
-
this.log("Received video stop/clear:", cmd.type);
|
|
3551
|
-
this.config.onVideoStop?.();
|
|
3552
|
-
} else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
|
|
3553
|
-
const slotId = cmd.payload.slot;
|
|
3554
|
-
if (cmd.payload.url) {
|
|
3555
|
-
this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
|
|
3556
|
-
this.config.onVideoPlay?.(cmd.payload.url);
|
|
3557
|
-
} else {
|
|
3558
|
-
this.log("Received videoPlaySlot:", slotId);
|
|
3559
|
-
this.playSlot(slotId);
|
|
3560
|
-
}
|
|
3561
|
-
} else if (this.config.onCommand) {
|
|
3562
|
-
this.log("Received command:", cmd.type, cmd.payload);
|
|
3563
|
-
this.config.onCommand(cmd.type, cmd.payload);
|
|
4618
|
+
if (typeof cmd.id === "string" && cmd.id !== "") {
|
|
4619
|
+
if (this.seenCommandIds.has(cmd.id)) continue;
|
|
4620
|
+
this.markCommandSeen(cmd.id);
|
|
4621
|
+
if (typeof cmd.timestamp === "number" && cmd.timestamp > this.lastCommandTimestamp) this.lastCommandTimestamp = cmd.timestamp;
|
|
4622
|
+
} else {
|
|
4623
|
+
if (cmd.timestamp <= this.lastCommandTimestamp) continue;
|
|
4624
|
+
this.lastCommandTimestamp = cmd.timestamp;
|
|
4625
|
+
}
|
|
4626
|
+
try {
|
|
4627
|
+
this.runCommand(cmd);
|
|
4628
|
+
} catch (err) {
|
|
4629
|
+
this.log("Command handler failed:", cmd.type, err);
|
|
3564
4630
|
}
|
|
3565
4631
|
}
|
|
3566
4632
|
} catch (err) {
|
|
3567
4633
|
}
|
|
3568
4634
|
}
|
|
4635
|
+
/** One queued command on this copy: the SDK's own types here, a registered control's option, else the scene's onCommand */
|
|
4636
|
+
runCommand(cmd) {
|
|
4637
|
+
const control = cmd.type === "sceneControl" && this.venue ? this.controlCommand(cmd.payload) : null;
|
|
4638
|
+
if (cmd.type === "broadcast" && cmd.payload?.text) {
|
|
4639
|
+
const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
|
|
4640
|
+
this.log("Received broadcast:", msg);
|
|
4641
|
+
this.config.onBroadcast?.(msg);
|
|
4642
|
+
} else if (cmd.type === "clearBroadcast") {
|
|
4643
|
+
this.log("Received clearBroadcast");
|
|
4644
|
+
hideNotification();
|
|
4645
|
+
} else if (cmd.type === "kickBanned" || cmd.type === "kickAll") {
|
|
4646
|
+
this.log("Received kick:", cmd.type, cmd.payload);
|
|
4647
|
+
this.moderation.handleCommand(cmd.type, cmd.payload);
|
|
4648
|
+
this.config.onCommand?.(cmd.type, cmd.payload);
|
|
4649
|
+
} else if (cmd.type === "privateMode" && this.venue) {
|
|
4650
|
+
this.log("Received privateMode - re-reading my standing");
|
|
4651
|
+
this.moderation.handleCommand(cmd.type, cmd.payload);
|
|
4652
|
+
} else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
|
|
4653
|
+
this.log("Received video play:", cmd.type, cmd.payload.url);
|
|
4654
|
+
this.playUrl(cmd.payload.url);
|
|
4655
|
+
} else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
|
|
4656
|
+
this.log("Received video stop/clear:", cmd.type);
|
|
4657
|
+
if (cmd.type === "videoClear") this.currentVideoUrl = null;
|
|
4658
|
+
this.config.onVideoStop?.();
|
|
4659
|
+
} else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
|
|
4660
|
+
const slotId = cmd.payload.slot;
|
|
4661
|
+
if (cmd.payload.url) {
|
|
4662
|
+
this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
|
|
4663
|
+
this.playUrl(cmd.payload.url);
|
|
4664
|
+
} else {
|
|
4665
|
+
this.log("Received videoPlaySlot:", slotId);
|
|
4666
|
+
this.playSlot(slotId);
|
|
4667
|
+
}
|
|
4668
|
+
} else if (cmd.type === "framesRefresh") {
|
|
4669
|
+
this.log("Received framesRefresh");
|
|
4670
|
+
this.client.frames?.refresh();
|
|
4671
|
+
} else if (control) {
|
|
4672
|
+
this.log("Received scene control:", control.control.id, control.option);
|
|
4673
|
+
this.applyControl(control.control, control.option);
|
|
4674
|
+
} else if (this.config.onCommand) {
|
|
4675
|
+
this.log("Received command:", cmd.type, cmd.payload);
|
|
4676
|
+
this.config.onCommand(cmd.type, cmd.payload);
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
3569
4679
|
// --- Stream API Calls ---
|
|
3570
4680
|
async fetchStreamData() {
|
|
3571
4681
|
if (this.streamFetched || !this.playerWallet) return;
|
|
@@ -3607,6 +4717,7 @@ var AdminPanelUIModule = class {
|
|
|
3607
4717
|
defaultSlot: data.defaultSlot || null,
|
|
3608
4718
|
videoSlots: data.videoSlots || {}
|
|
3609
4719
|
};
|
|
4720
|
+
if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
|
|
3610
4721
|
this.videoStateFetched = true;
|
|
3611
4722
|
this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
|
|
3612
4723
|
}
|
|
@@ -3621,7 +4732,7 @@ var AdminPanelUIModule = class {
|
|
|
3621
4732
|
const slot = this.videoState?.videoSlots?.[slotId];
|
|
3622
4733
|
if (slot?.url) {
|
|
3623
4734
|
this.log("Playing slot:", slotId, slot.url);
|
|
3624
|
-
this.
|
|
4735
|
+
this.playUrl(slot.url);
|
|
3625
4736
|
} else {
|
|
3626
4737
|
this.log("Slot has no URL:", slotId);
|
|
3627
4738
|
this.config.onVideoSlotPlay?.(slotId);
|
|
@@ -3636,7 +4747,7 @@ var AdminPanelUIModule = class {
|
|
|
3636
4747
|
const slot = this.videoState.videoSlots?.[defaultSlot];
|
|
3637
4748
|
if (slot?.url) {
|
|
3638
4749
|
this.log("Auto-playing default slot:", defaultSlot);
|
|
3639
|
-
this.
|
|
4750
|
+
this.playUrl(slot.url);
|
|
3640
4751
|
}
|
|
3641
4752
|
}
|
|
3642
4753
|
async createChannel() {
|
|
@@ -3988,6 +5099,7 @@ var AdminPanelUIModule = class {
|
|
|
3988
5099
|
this.modStatus = "saved";
|
|
3989
5100
|
this.log("Banned wallet:", normalized);
|
|
3990
5101
|
this.config.onCommand?.("kickBanned", { wallet: normalized });
|
|
5102
|
+
await this.sendSceneCommand("kickBanned", { wallet: normalized }, this.kickLine("Banned and kicked"));
|
|
3991
5103
|
} else {
|
|
3992
5104
|
this.modStatus = "error";
|
|
3993
5105
|
}
|
|
@@ -4022,15 +5134,142 @@ var AdminPanelUIModule = class {
|
|
|
4022
5134
|
this.log("Unban error:", err);
|
|
4023
5135
|
}
|
|
4024
5136
|
}
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
5137
|
+
/**
|
|
5138
|
+
* Queue a command on thestatic.tv for every visitor's copy of the scene (2026-11-17): a signed POST to the scene's
|
|
5139
|
+
* commands route, which takes it from the scene's owner, an admin or an authorized user at the scene's registered
|
|
5140
|
+
* location, and which every copy's poll reads within its 30-second window. The one sender for the kicks, the scene
|
|
5141
|
+
* controls and, since 2026-11-18, the Video and Broadcast buttons; each shows what it came to on its section's own
|
|
5142
|
+
* line. The command id the server answers goes into the seen set, so this copy's poll does not run its own press a
|
|
5143
|
+
* second time. Returns that id (empty when the answer carries none), or null when the command was not sent.
|
|
5144
|
+
*/
|
|
5145
|
+
async sendSceneCommand(type, payload, line) {
|
|
5146
|
+
const data = await this.sendSigned("commands", { type, payload }, line);
|
|
5147
|
+
if (data === null) return null;
|
|
5148
|
+
const id = typeof data.commandId === "string" ? data.commandId : "";
|
|
5149
|
+
if (id !== "") this.markCommandSeen(id);
|
|
5150
|
+
return id;
|
|
4028
5151
|
}
|
|
5152
|
+
/**
|
|
5153
|
+
* The one signed sender's POST (2026-11-18; since 2026-11-19 private mode's switch goes through it too, to its own
|
|
5154
|
+
* route): signed as the presser to one of the scene's routes on thestatic.tv, which decides whether the presser may;
|
|
5155
|
+
* what it came to shown on the section's line in a control's four words. Returns the answer, or null when not sent.
|
|
5156
|
+
*/
|
|
5157
|
+
async sendSigned(route, body, line) {
|
|
5158
|
+
try {
|
|
5159
|
+
const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/${route}`, {
|
|
5160
|
+
method: "POST",
|
|
5161
|
+
headers: { "Content-Type": "application/json" },
|
|
5162
|
+
body: JSON.stringify(body)
|
|
5163
|
+
});
|
|
5164
|
+
const parsed = await res.json().catch(() => ({}));
|
|
5165
|
+
const data = parsed && typeof parsed === "object" ? parsed : {};
|
|
5166
|
+
if (res.ok) {
|
|
5167
|
+
line.show(line.sent);
|
|
5168
|
+
return data;
|
|
5169
|
+
}
|
|
5170
|
+
line.show(res.status === 401 || res.status === 403 ? `${line.notSent}: no access` : `${line.notSent}: HTTP ${res.status}`);
|
|
5171
|
+
this.log("Refused:", route, body.type ?? "", res.status, data.error);
|
|
5172
|
+
} catch (err) {
|
|
5173
|
+
line.show(`${line.notSent}: network error`);
|
|
5174
|
+
this.log("Send error:", route, err);
|
|
5175
|
+
}
|
|
5176
|
+
return null;
|
|
5177
|
+
}
|
|
5178
|
+
/**
|
|
5179
|
+
* PRIVATE MODE ON / OFF (2026-11-19, Venue; thestatic-hq docs/MERGE-CONTRACT-2026-11-19.md section 2): `{ on }` to
|
|
5180
|
+
* the scene's private route through the one signed sender. thestatic.tv decides who may switch it (its scene access
|
|
5181
|
+
* check) and queues `privateMode` for every copy, this one included, which re-reads its standing on it. The state
|
|
5182
|
+
* shown follows the server's answer, never the press.
|
|
5183
|
+
*/
|
|
5184
|
+
async setPrivateMode(on) {
|
|
5185
|
+
if (!this.venue) return;
|
|
5186
|
+
const data = await this.sendSigned("private", { on }, this.privateLine);
|
|
5187
|
+
if (typeof data?.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
|
|
5188
|
+
}
|
|
5189
|
+
/** KICK ALL: every visitor who cannot moderate the scene is moved out and kept out for a while (2026-11-17) */
|
|
5190
|
+
async kickAll() {
|
|
5191
|
+
this.log("KICK ALL clicked");
|
|
5192
|
+
this.config.onCommand?.("kickAll", {});
|
|
5193
|
+
await this.sendSceneCommand("kickAll", {}, this.kickLine("KICK ALL sent"));
|
|
5194
|
+
}
|
|
5195
|
+
/**
|
|
5196
|
+
* BROADCAST (2026-11-18): queued for every visitor, as the scene's page on thestatic.tv sends it - `from` the presser's
|
|
5197
|
+
* display name, ADMIN when the explorer has none (the page's own default) - and shown here at once as everyone sees
|
|
5198
|
+
* it, `from: text`. Until then the in-world Send reached the presser's copy alone.
|
|
5199
|
+
*/
|
|
4029
5200
|
sendBroadcast() {
|
|
4030
|
-
|
|
4031
|
-
|
|
5201
|
+
const text = this.broadcastText.trim();
|
|
5202
|
+
if (!text) return;
|
|
5203
|
+
const from = this.myName();
|
|
5204
|
+
this.config.onBroadcast?.(`${from}: ${text}`);
|
|
4032
5205
|
this.broadcastText = "";
|
|
4033
5206
|
this.log("Broadcast sent");
|
|
5207
|
+
this.sendSceneCommand("broadcast", { text, from }, this.broadcastLine).catch(() => {
|
|
5208
|
+
});
|
|
5209
|
+
}
|
|
5210
|
+
/** The presser's display name for a broadcast's from, ADMIN when the explorer has none; within the route's 100 */
|
|
5211
|
+
myName() {
|
|
5212
|
+
try {
|
|
5213
|
+
const name = (0, import_players2.getPlayer)()?.name;
|
|
5214
|
+
if (typeof name === "string" && name.trim() !== "") return name.trim().slice(0, 100);
|
|
5215
|
+
} catch {
|
|
5216
|
+
}
|
|
5217
|
+
return "ADMIN";
|
|
5218
|
+
}
|
|
5219
|
+
// --- The Video tab's buttons (2026-11-18): each does here at once what it did, then queues the same for everyone ---
|
|
5220
|
+
/** PLAY NOW: the typed url plays here and is queued as videoSetUrl, which thestatic.tv keeps for later arrivals */
|
|
5221
|
+
playNow() {
|
|
5222
|
+
const url = this.customVideoUrl.trim();
|
|
5223
|
+
if (!url) return;
|
|
5224
|
+
this.playUrl(url);
|
|
5225
|
+
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5226
|
+
});
|
|
5227
|
+
}
|
|
5228
|
+
/** Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it) */
|
|
5229
|
+
playStreamOnScreen(url) {
|
|
5230
|
+
this.playUrl(url);
|
|
5231
|
+
this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
|
|
5232
|
+
});
|
|
5233
|
+
}
|
|
5234
|
+
/** Play 1-5: the slot plays here (its url from the video state) and is queued as videoPlaySlot; the server resolves its url for everyone */
|
|
5235
|
+
pressSlot(slotId) {
|
|
5236
|
+
this.playSlot(slotId);
|
|
5237
|
+
this.sendSceneCommand("videoPlaySlot", { slot: slotId }, this.videoLine).catch(() => {
|
|
5238
|
+
});
|
|
5239
|
+
}
|
|
5240
|
+
/**
|
|
5241
|
+
* PLAYBACK Play: the current video - the one the screen last played here, or the scene's current url from the video
|
|
5242
|
+
* state at load - plays again here and is queued as videoPlay with its url; with none known nothing is sent and the
|
|
5243
|
+
* line says so. onCommand gets ('videoPlay', { playing: true }) as it did before, for a scene that reads it.
|
|
5244
|
+
*/
|
|
5245
|
+
playbackPlay() {
|
|
5246
|
+
this.config.onCommand?.("videoPlay", { playing: true });
|
|
5247
|
+
const url = this.currentVideoUrl;
|
|
5248
|
+
if (!url) {
|
|
5249
|
+
this.videoStatus = "Not sent: no video";
|
|
5250
|
+
return;
|
|
5251
|
+
}
|
|
5252
|
+
this.playUrl(url);
|
|
5253
|
+
this.sendSceneCommand("videoPlay", { url }, this.videoLine).catch(() => {
|
|
5254
|
+
});
|
|
5255
|
+
}
|
|
5256
|
+
/** Stop: the screen stops here and videoStop is queued for everyone */
|
|
5257
|
+
playbackStop() {
|
|
5258
|
+
this.config.onVideoStop?.();
|
|
5259
|
+
this.sendSceneCommand("videoStop", {}, this.videoLine).catch(() => {
|
|
5260
|
+
});
|
|
5261
|
+
}
|
|
5262
|
+
/**
|
|
5263
|
+
* Reset Default: the screen goes back to its default here - what every copy does on a queued videoClear - and
|
|
5264
|
+
* videoClear is queued, which also clears the scene's kept url on thestatic.tv. onCommand gets ('videoClear', {}) as
|
|
5265
|
+
* it did before.
|
|
5266
|
+
*/
|
|
5267
|
+
resetDefault() {
|
|
5268
|
+
this.config.onCommand?.("videoClear", {});
|
|
5269
|
+
this.currentVideoUrl = null;
|
|
5270
|
+
this.config.onVideoStop?.();
|
|
5271
|
+
this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
|
|
5272
|
+
});
|
|
4034
5273
|
}
|
|
4035
5274
|
setActiveTab(tab) {
|
|
4036
5275
|
const previousTab = this.activeTab;
|
|
@@ -4044,6 +5283,22 @@ var AdminPanelUIModule = class {
|
|
|
4044
5283
|
this.stopStreamPolling();
|
|
4045
5284
|
}
|
|
4046
5285
|
}
|
|
5286
|
+
/** A control's button (2026-11-18): the option's label, highlighted while that option is current on this copy */
|
|
5287
|
+
controlButton(control, option, label) {
|
|
5288
|
+
const current = this.currentOption[control.id] === option;
|
|
5289
|
+
return /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5290
|
+
import_react_ecs6.Button,
|
|
5291
|
+
{
|
|
5292
|
+
key: `control-${control.id}-${option}`,
|
|
5293
|
+
uiTransform: { minWidth: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4, padding: { left: 10, right: 10 } },
|
|
5294
|
+
uiBackground: { color: current ? C2.cyan : C2.btn },
|
|
5295
|
+
value: label,
|
|
5296
|
+
fontSize: this.theme.buttonSmall,
|
|
5297
|
+
color: current ? import_math7.Color4.Black() : C2.text,
|
|
5298
|
+
onMouseDown: () => this.pressControl(control, option)
|
|
5299
|
+
}
|
|
5300
|
+
);
|
|
5301
|
+
}
|
|
4047
5302
|
/**
|
|
4048
5303
|
* Render a scaled notification banner
|
|
4049
5304
|
* Uses same layout as NotificationBanner but with scaled font size
|
|
@@ -4054,8 +5309,8 @@ var AdminPanelUIModule = class {
|
|
|
4054
5309
|
if (!state.visible) return null;
|
|
4055
5310
|
const N2 = UI_DIMENSIONS.notification;
|
|
4056
5311
|
const colors = THEME.colors;
|
|
4057
|
-
return /* @__PURE__ */
|
|
4058
|
-
|
|
5312
|
+
return /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5313
|
+
import_react_ecs6.UiEntity,
|
|
4059
5314
|
{
|
|
4060
5315
|
uiTransform: {
|
|
4061
5316
|
positionType: "absolute",
|
|
@@ -4065,8 +5320,8 @@ var AdminPanelUIModule = class {
|
|
|
4065
5320
|
alignItems: "center"
|
|
4066
5321
|
}
|
|
4067
5322
|
},
|
|
4068
|
-
/* @__PURE__ */
|
|
4069
|
-
|
|
5323
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5324
|
+
import_react_ecs6.UiEntity,
|
|
4070
5325
|
{
|
|
4071
5326
|
uiTransform: {
|
|
4072
5327
|
minWidth: this.s(200),
|
|
@@ -4078,15 +5333,15 @@ var AdminPanelUIModule = class {
|
|
|
4078
5333
|
},
|
|
4079
5334
|
uiBackground: { color: colors.panel }
|
|
4080
5335
|
},
|
|
4081
|
-
/* @__PURE__ */
|
|
4082
|
-
|
|
5336
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5337
|
+
import_react_ecs6.UiEntity,
|
|
4083
5338
|
{
|
|
4084
5339
|
uiTransform: { width: N2.borderWidth, height: "100%" },
|
|
4085
5340
|
uiBackground: { color: colors.cyan }
|
|
4086
5341
|
}
|
|
4087
5342
|
),
|
|
4088
|
-
/* @__PURE__ */
|
|
4089
|
-
|
|
5343
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5344
|
+
import_react_ecs6.UiEntity,
|
|
4090
5345
|
{
|
|
4091
5346
|
uiTransform: {
|
|
4092
5347
|
flexGrow: 1,
|
|
@@ -4096,8 +5351,8 @@ var AdminPanelUIModule = class {
|
|
|
4096
5351
|
alignItems: "center"
|
|
4097
5352
|
}
|
|
4098
5353
|
},
|
|
4099
|
-
/* @__PURE__ */
|
|
4100
|
-
|
|
5354
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5355
|
+
import_react_ecs6.Label,
|
|
4101
5356
|
{
|
|
4102
5357
|
value: state.text,
|
|
4103
5358
|
fontSize: this.s(N2.fontSize),
|
|
@@ -4106,8 +5361,8 @@ var AdminPanelUIModule = class {
|
|
|
4106
5361
|
}
|
|
4107
5362
|
)
|
|
4108
5363
|
),
|
|
4109
|
-
/* @__PURE__ */
|
|
4110
|
-
|
|
5364
|
+
/* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5365
|
+
import_react_ecs6.UiEntity,
|
|
4111
5366
|
{
|
|
4112
5367
|
uiTransform: { width: 5, height: 5, margin: { right: 10 } },
|
|
4113
5368
|
uiBackground: { color: colors.cyan }
|
|
@@ -4119,7 +5374,7 @@ var AdminPanelUIModule = class {
|
|
|
4119
5374
|
};
|
|
4120
5375
|
|
|
4121
5376
|
// src/StaticTVClient.ts
|
|
4122
|
-
var
|
|
5377
|
+
var import_ecs5 = require("@dcl/sdk/ecs");
|
|
4123
5378
|
var utils = __toESM(require("@dcl-sdk/utils"));
|
|
4124
5379
|
var DEFAULT_BASE_URL = "https://thestatic.tv/api/v1/dcl";
|
|
4125
5380
|
var DEFAULT_FALLBACK_VIDEO = "https://media.thestatic.tv/fallback-loop.mp4";
|
|
@@ -4161,9 +5416,13 @@ var StaticTVClient = class {
|
|
|
4161
5416
|
this._keyId = null;
|
|
4162
5417
|
this._disabled = false;
|
|
4163
5418
|
this._tier = "free";
|
|
5419
|
+
/** Venue (2026-11-19): the server's flag beside a Pro tier; the event features need it */
|
|
5420
|
+
this._venue = false;
|
|
4164
5421
|
this._standardFeaturesEnabled = false;
|
|
4165
5422
|
this._proFeaturesEnabled = false;
|
|
4166
5423
|
this._pendingProConfig = null;
|
|
5424
|
+
/** Controls registered before the admin panel exists (the tier not yet confirmed) - handed to it at init (2026-11-18) */
|
|
5425
|
+
this._pendingControls = [];
|
|
4167
5426
|
this._featuresResolved = false;
|
|
4168
5427
|
/** Guide module - fetch channel lineup (standard/pro tier) */
|
|
4169
5428
|
this.guide = null;
|
|
@@ -4207,6 +5466,8 @@ var StaticTVClient = class {
|
|
|
4207
5466
|
};
|
|
4208
5467
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
4209
5468
|
this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
|
|
5469
|
+
this.frames = new FramesModule(this);
|
|
5470
|
+
if (config.frames) this.frames.register(config.frames);
|
|
4210
5471
|
if (!config.apiKey) {
|
|
4211
5472
|
this._disabled = true;
|
|
4212
5473
|
this._keyType = null;
|
|
@@ -4337,7 +5598,7 @@ var StaticTVClient = class {
|
|
|
4337
5598
|
* @internal
|
|
4338
5599
|
*/
|
|
4339
5600
|
async signedRequest(endpoint, init = {}) {
|
|
4340
|
-
const response = await (0,
|
|
5601
|
+
const response = await (0, import_SignedFetch4.signedFetch)({
|
|
4341
5602
|
url: `${this.apiUrl}${endpoint}`,
|
|
4342
5603
|
init: {
|
|
4343
5604
|
method: init.method || "POST",
|
|
@@ -4397,6 +5658,7 @@ var StaticTVClient = class {
|
|
|
4397
5658
|
* @param url Video URL to play
|
|
4398
5659
|
*/
|
|
4399
5660
|
playVideo(url) {
|
|
5661
|
+
if (this.isVisitorBlocked) return;
|
|
4400
5662
|
const screen = this.config.videoScreen;
|
|
4401
5663
|
if (screen !== void 0) {
|
|
4402
5664
|
this.log(`Playing video: ${url}`);
|
|
@@ -4431,9 +5693,9 @@ var StaticTVClient = class {
|
|
|
4431
5693
|
const fallbackUrl = this.config.fallbackVideoUrl;
|
|
4432
5694
|
const fallbackDisabled = fallbackUrl === "";
|
|
4433
5695
|
if (fallbackDisabled) {
|
|
4434
|
-
if (
|
|
5696
|
+
if (import_ecs5.VideoPlayer.has(screen)) {
|
|
4435
5697
|
this.log("Stopping video (no fallback)");
|
|
4436
|
-
|
|
5698
|
+
import_ecs5.VideoPlayer.getMutable(screen).playing = false;
|
|
4437
5699
|
}
|
|
4438
5700
|
this._currentVideoUrl = "";
|
|
4439
5701
|
} else {
|
|
@@ -4454,16 +5716,17 @@ var StaticTVClient = class {
|
|
|
4454
5716
|
_playVideoInternal(url, isFallback = false, isLiveStream = false) {
|
|
4455
5717
|
const screen = this.config.videoScreen;
|
|
4456
5718
|
if (screen === void 0) return;
|
|
5719
|
+
if (this.isVisitorBlocked) return;
|
|
4457
5720
|
this._clearVerificationTimeout();
|
|
4458
5721
|
this._streamVerified = false;
|
|
4459
|
-
if (
|
|
4460
|
-
const player =
|
|
5722
|
+
if (import_ecs5.VideoPlayer.has(screen)) {
|
|
5723
|
+
const player = import_ecs5.VideoPlayer.getMutable(screen);
|
|
4461
5724
|
player.src = url;
|
|
4462
5725
|
player.playing = true;
|
|
4463
5726
|
player.loop = isFallback;
|
|
4464
5727
|
player.volume = 1;
|
|
4465
5728
|
} else {
|
|
4466
|
-
|
|
5729
|
+
import_ecs5.VideoPlayer.create(screen, {
|
|
4467
5730
|
src: url,
|
|
4468
5731
|
playing: true,
|
|
4469
5732
|
loop: isFallback,
|
|
@@ -4485,8 +5748,8 @@ var StaticTVClient = class {
|
|
|
4485
5748
|
const screen = this.config.videoScreen;
|
|
4486
5749
|
if (screen === void 0) return;
|
|
4487
5750
|
this._videoEventsRegistered = true;
|
|
4488
|
-
|
|
4489
|
-
if (videoEvent.state ===
|
|
5751
|
+
import_ecs5.videoEventsSystem.registerVideoEventsEntity(screen, (videoEvent) => {
|
|
5752
|
+
if (videoEvent.state === import_ecs5.VideoState.VS_PLAYING) {
|
|
4490
5753
|
const timeSinceStart = Date.now() - this._verificationStartTime;
|
|
4491
5754
|
const MIN_VERIFICATION_DELAY = 2e3;
|
|
4492
5755
|
if (this._pendingVideoData && !this._streamVerified && timeSinceStart >= MIN_VERIFICATION_DELAY) {
|
|
@@ -4495,7 +5758,7 @@ var StaticTVClient = class {
|
|
|
4495
5758
|
this.log(`Stream verified: ${this._pendingVideoData.name} (after ${timeSinceStart}ms)`);
|
|
4496
5759
|
}
|
|
4497
5760
|
}
|
|
4498
|
-
if (videoEvent.state ===
|
|
5761
|
+
if (videoEvent.state === import_ecs5.VideoState.VS_ERROR) {
|
|
4499
5762
|
if (this._pendingVideoData) {
|
|
4500
5763
|
this.log(`Stream error for: ${this._pendingVideoData.name}`);
|
|
4501
5764
|
this._handleStreamOffline();
|
|
@@ -4577,6 +5840,7 @@ var StaticTVClient = class {
|
|
|
4577
5840
|
*/
|
|
4578
5841
|
_handleGuideVideoSelect(video) {
|
|
4579
5842
|
if (!video.src) return;
|
|
5843
|
+
if (this.isVisitorBlocked) return;
|
|
4580
5844
|
this._pendingVideoData = video;
|
|
4581
5845
|
const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
|
|
4582
5846
|
this._playVideoWithVerification(video, isLiveStream);
|
|
@@ -4653,6 +5917,74 @@ var StaticTVClient = class {
|
|
|
4653
5917
|
this.log(`Stream confirmed playing: ${this._pendingVideoData.name}`);
|
|
4654
5918
|
}
|
|
4655
5919
|
}
|
|
5920
|
+
/**
|
|
5921
|
+
* True while this visitor is banned from the scene or kicked out of it (Pro tier, 2026-11-17), or kept out by its
|
|
5922
|
+
* private mode (Venue, 2026-11-19): the SDK keeps them out of the scene's parcels, shows them only the notice and
|
|
5923
|
+
* plays them no video. A scene with its own media (a radio, its own screen) checks this, or passes
|
|
5924
|
+
* `onBlockedChange`, and stops it.
|
|
5925
|
+
*/
|
|
5926
|
+
get isVisitorBlocked() {
|
|
5927
|
+
return this.adminPanel?.isVisitorBlocked ?? false;
|
|
5928
|
+
}
|
|
5929
|
+
/**
|
|
5930
|
+
* This visitor's standing: 'banned', 'kicked', 'private' (2026-11-19) or 'clear', in that precedence (always 'clear'
|
|
5931
|
+
* without the Pro tier's admin panel)
|
|
5932
|
+
*/
|
|
5933
|
+
get visitorStanding() {
|
|
5934
|
+
return this.adminPanel?.moderation.standing ?? "clear";
|
|
5935
|
+
}
|
|
5936
|
+
/**
|
|
5937
|
+
* True when the last standing read said this visitor is a TheStatic.tv citizen - their wallet linked to an account
|
|
5938
|
+
* (2026-11-19). False before a read, from a server that does not answer it, and without the Pro tier's admin panel.
|
|
5939
|
+
* For a fresh answer, `checkCitizen()`.
|
|
5940
|
+
*/
|
|
5941
|
+
get visitorIsCitizen() {
|
|
5942
|
+
return this.adminPanel?.moderation.isCitizen ?? false;
|
|
5943
|
+
}
|
|
5944
|
+
/**
|
|
5945
|
+
* Whether this visitor is a TheStatic.tv citizen, fresh (2026-11-19): a read of the scene's admin-check through the
|
|
5946
|
+
* moderation module - the last answer when it is under 5 s old, else the next read, gated as every standing read
|
|
5947
|
+
* is. False without the Pro tier's admin panel, and when no read has answered. A scene's citizens-only door asks
|
|
5948
|
+
* this instead of calling a route of its own; thestatic.tv answers it from the signed request, so a scene cannot
|
|
5949
|
+
* claim a citizen.
|
|
5950
|
+
*/
|
|
5951
|
+
async checkCitizen() {
|
|
5952
|
+
if (!this.adminPanel) return false;
|
|
5953
|
+
try {
|
|
5954
|
+
return await this.adminPanel.moderation.checkCitizen();
|
|
5955
|
+
} catch {
|
|
5956
|
+
return false;
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5959
|
+
/**
|
|
5960
|
+
* The admin panel's moderation reports blocked on or off (2026-11-17): the panels close, the SDK's own video
|
|
5961
|
+
* stops (and its fallback loop comes back once clear), the watch heartbeat stops, and the scene hears of it.
|
|
5962
|
+
* @internal
|
|
5963
|
+
*/
|
|
5964
|
+
_onBlockedChange(blocked, standing) {
|
|
5965
|
+
const screen = this.config.videoScreen;
|
|
5966
|
+
if (blocked) {
|
|
5967
|
+
this.guideUI?.hide();
|
|
5968
|
+
this.chatUI?.hide();
|
|
5969
|
+
this.heartbeat?.stopWatching();
|
|
5970
|
+
this._pendingVideoData = null;
|
|
5971
|
+
this._clearVerificationTimeout();
|
|
5972
|
+
if (screen !== void 0 && import_ecs5.VideoPlayer.has(screen)) {
|
|
5973
|
+
import_ecs5.VideoPlayer.getMutable(screen).playing = false;
|
|
5974
|
+
}
|
|
5975
|
+
this._currentVideoUrl = "";
|
|
5976
|
+
} else if (screen !== void 0) {
|
|
5977
|
+
const fallbackUrl = this.config.fallbackVideoUrl !== void 0 ? this.config.fallbackVideoUrl : DEFAULT_FALLBACK_VIDEO;
|
|
5978
|
+
if (fallbackUrl !== "") this._playVideoInternal(fallbackUrl, true);
|
|
5979
|
+
}
|
|
5980
|
+
if (this.config.onBlockedChange) {
|
|
5981
|
+
try {
|
|
5982
|
+
this.config.onBlockedChange(blocked, standing);
|
|
5983
|
+
} catch (err) {
|
|
5984
|
+
this.error("onBlockedChange failed", err);
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
4656
5988
|
/**
|
|
4657
5989
|
* Internal handler for broadcast messages
|
|
4658
5990
|
* @internal
|
|
@@ -4711,8 +6043,15 @@ var StaticTVClient = class {
|
|
|
4711
6043
|
onBroadcast: (text) => this._handleBroadcast(text),
|
|
4712
6044
|
onCommand: this.config.onCommand || this._pendingProConfig?.onCommand,
|
|
4713
6045
|
// Merge other settings from enableProFeatures if provided
|
|
4714
|
-
...this._pendingProConfig
|
|
6046
|
+
...this._pendingProConfig,
|
|
6047
|
+
// The scene's controls (2026-11-18): the constructor's, enableProFeatures()'s, and any registered before now
|
|
6048
|
+
controls: [
|
|
6049
|
+
...this.config.controls || [],
|
|
6050
|
+
...this._pendingProConfig?.controls || [],
|
|
6051
|
+
...this._pendingControls
|
|
6052
|
+
]
|
|
4715
6053
|
};
|
|
6054
|
+
this._pendingControls = [];
|
|
4716
6055
|
this.adminPanel = new AdminPanelUIModule(this, adminConfig);
|
|
4717
6056
|
this._proFeaturesEnabled = true;
|
|
4718
6057
|
this.adminPanel.init().catch((err) => {
|
|
@@ -4756,8 +6095,9 @@ var StaticTVClient = class {
|
|
|
4756
6095
|
getSceneId() {
|
|
4757
6096
|
return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
|
|
4758
6097
|
}
|
|
4759
|
-
_enableFeaturesForTier(tier, keyId) {
|
|
6098
|
+
_enableFeaturesForTier(tier, keyId, venue = false) {
|
|
4760
6099
|
this._tier = tier;
|
|
6100
|
+
this._venue = tier === "pro" && venue === true;
|
|
4761
6101
|
if (keyId) {
|
|
4762
6102
|
this._keyId = keyId;
|
|
4763
6103
|
}
|
|
@@ -4772,6 +6112,7 @@ var StaticTVClient = class {
|
|
|
4772
6112
|
this.log("Pro tier detected but no video config - call enableProFeatures() or set videoScreen to enable admin panel");
|
|
4773
6113
|
}
|
|
4774
6114
|
}
|
|
6115
|
+
if (this._venue) this.frames.enable();
|
|
4775
6116
|
this._resolveFeaturesReady(tier);
|
|
4776
6117
|
}
|
|
4777
6118
|
/**
|
|
@@ -4799,6 +6140,13 @@ var StaticTVClient = class {
|
|
|
4799
6140
|
get hasProFeatures() {
|
|
4800
6141
|
return this._proFeaturesEnabled;
|
|
4801
6142
|
}
|
|
6143
|
+
/**
|
|
6144
|
+
* True when the server confirmed the Venue tier (2026-11-19): Pro plus the event features - scene
|
|
6145
|
+
* controls, frames, private mode. `tier` stays 'pro' for a Venue scene, so a scene's own Pro checks hold.
|
|
6146
|
+
*/
|
|
6147
|
+
get hasVenueFeatures() {
|
|
6148
|
+
return this._venue;
|
|
6149
|
+
}
|
|
4802
6150
|
/**
|
|
4803
6151
|
* @deprecated Use `tier` instead
|
|
4804
6152
|
*/
|
|
@@ -4868,6 +6216,57 @@ var StaticTVClient = class {
|
|
|
4868
6216
|
}
|
|
4869
6217
|
this.adminPanel.registerSceneTab(tab);
|
|
4870
6218
|
}
|
|
6219
|
+
/**
|
|
6220
|
+
* Register scene controls for the Admin Panel's CONTROLS tab and the scene's page on thestatic.tv (2026-11-18;
|
|
6221
|
+
* the Venue tier since 2026-11-19, Pro until then) - the same as passing `controls` in the config. Before the panel
|
|
6222
|
+
* exists (the tier not yet confirmed) they are kept and handed to it at init; after, they join the tab at once. On a
|
|
6223
|
+
* Pro scene without Venue they are kept and never drawn, uploaded or run. See `SceneControl`.
|
|
6224
|
+
*
|
|
6225
|
+
* @example
|
|
6226
|
+
* ```typescript
|
|
6227
|
+
* staticTV.registerControls([{
|
|
6228
|
+
* id: 'digifog', label: 'DigiFog', off: true, persist: true,
|
|
6229
|
+
* options: [{ id: 'stars', label: 'Stars' }, { id: 'pulse', label: 'Pulse' }],
|
|
6230
|
+
* onChange: (option) => fog.play(option)
|
|
6231
|
+
* }])
|
|
6232
|
+
* ```
|
|
6233
|
+
*/
|
|
6234
|
+
registerControls(controls) {
|
|
6235
|
+
if (!this.adminPanel) {
|
|
6236
|
+
this._pendingControls.push(...controls);
|
|
6237
|
+
this.log(`Scene controls registered (${controls.length}) - the admin panel takes them when the Pro tier is confirmed`);
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
6240
|
+
this.adminPanel.registerControls(controls);
|
|
6241
|
+
}
|
|
6242
|
+
/**
|
|
6243
|
+
* Register picture frames (Venue tier, 2026-11-19) - the same as passing `frames` in the config. Kept whatever the
|
|
6244
|
+
* tier (without Venue `openFrame` still opens a default's link); once Venue is known, a frame registered now gets the
|
|
6245
|
+
* content the last read gave at once. A frame registered again by id
|
|
6246
|
+
* replaces the earlier one; at most 64. Only the shape is checked here - thestatic.tv checks the ids, labels and URLs
|
|
6247
|
+
* when the declaration is uploaded. See `SceneFrame`.
|
|
6248
|
+
*
|
|
6249
|
+
* @example
|
|
6250
|
+
* ```typescript
|
|
6251
|
+
* staticTV.registerFrames([{
|
|
6252
|
+
* id: 'f00', label: 'Ground floor, west wall',
|
|
6253
|
+
* default: { image: 'https://example.com/poster.png' },
|
|
6254
|
+
* onContent: (c) => showPicture(frameEntity, c.image, c.text)
|
|
6255
|
+
* }])
|
|
6256
|
+
* ```
|
|
6257
|
+
*/
|
|
6258
|
+
registerFrames(frames) {
|
|
6259
|
+
this.frames.register(frames);
|
|
6260
|
+
}
|
|
6261
|
+
/**
|
|
6262
|
+
* A visitor clicked a frame (2026-11-19): the link opens when it is an https: one - the content's, else the frame's
|
|
6263
|
+
* default's, so a frame works before Venue is on - and, with Venue, the click is counted on thestatic.tv under the
|
|
6264
|
+
* picture the frame shows (signed, fire and forget). Call it from the frame's own pointer handler. Nothing happens
|
|
6265
|
+
* for an id the scene did not declare.
|
|
6266
|
+
*/
|
|
6267
|
+
openFrame(id) {
|
|
6268
|
+
this.frames.open(id);
|
|
6269
|
+
}
|
|
4871
6270
|
/**
|
|
4872
6271
|
* Close Admin/Guide panels (they share the same screen space)
|
|
4873
6272
|
* Chat is independent and stays open.
|
|
@@ -4940,16 +6339,19 @@ var StaticTVClient = class {
|
|
|
4940
6339
|
0 && (module.exports = {
|
|
4941
6340
|
AdminPanelUIModule,
|
|
4942
6341
|
ChatUIModule,
|
|
6342
|
+
FramesModule,
|
|
4943
6343
|
GuideModule,
|
|
4944
6344
|
GuideUIModule,
|
|
4945
6345
|
HeartbeatModule,
|
|
4946
6346
|
InteractionsModule,
|
|
4947
6347
|
KEY_TYPE_CHANNEL,
|
|
4948
6348
|
KEY_TYPE_SCENE,
|
|
6349
|
+
ModerationModule,
|
|
4949
6350
|
NotificationBanner,
|
|
4950
6351
|
SessionModule,
|
|
4951
6352
|
StaticTVClient,
|
|
4952
6353
|
fetchUserData,
|
|
6354
|
+
getParcelRects,
|
|
4953
6355
|
getPlayerDisplayName,
|
|
4954
6356
|
getPlayerPosition,
|
|
4955
6357
|
getPlayerWallet,
|