@thestatic-tv/dcl-sdk 2.5.29 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -7
- package/dist/index.d.mts +43 -7
- package/dist/index.d.ts +43 -7
- package/dist/index.js +125 -92
- package/dist/index.mjs +125 -92
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -41,11 +41,11 @@ export function main() {
|
|
|
41
41
|
|
|
42
42
|
## Example Scene
|
|
43
43
|
|
|
44
|
-
Clone our starter scene to get up and running quickly:
|
|
44
|
+
Clone our free-tier starter scene to get up and running quickly ([thestatic-dcl-standard](https://github.com/thestatic-tv/thestatic-dcl-standard) and [thestatic-dcl-pro](https://github.com/thestatic-tv/thestatic-dcl-pro) are the Standard and Pro starters):
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
git clone https://github.com/thestatic-tv/thestatic-dcl-
|
|
48
|
-
cd thestatic-dcl-
|
|
47
|
+
git clone https://github.com/thestatic-tv/thestatic-dcl-free.git
|
|
48
|
+
cd thestatic-dcl-free
|
|
49
49
|
npm install
|
|
50
50
|
npm start
|
|
51
51
|
```
|
|
@@ -99,23 +99,33 @@ staticTV.guideUI.toggle()
|
|
|
99
99
|
staticTV.chatUI.toggle()
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
## In-world admin, chat and watch time (2.6.0)
|
|
103
|
+
|
|
104
|
+
The Admin Panel, Chat, the watch heartbeat and like/follow send DCL signed requests: Decentraland
|
|
105
|
+
signs each one as the player, and thestatic.tv checks that it came from the scene deployed where
|
|
106
|
+
your scene is registered. Set your scene's parcel (or its World name) on
|
|
107
|
+
[thestatic.tv/dashboard](https://thestatic.tv/dashboard) - without it, none of them work. Versions
|
|
108
|
+
before 2.6.0 named the player's wallet in the request instead, which the server no longer accepts:
|
|
109
|
+
update and redeploy your scene to keep them working. Chill to Earn credits the player who signed
|
|
110
|
+
the heartbeat; a guest's minutes count for the channel but earn nothing, and a guest cannot like
|
|
111
|
+
or follow.
|
|
112
|
+
|
|
102
113
|
## Pricing & Tiers
|
|
103
114
|
|
|
104
115
|
See [thestatic.tv/info](https://thestatic.tv/info) for current pricing and tier features.
|
|
105
116
|
|
|
106
|
-
|
|
117
|
+
New keys start on the free tier (session tracking, no expiry); Standard and Pro are paid upgrades.
|
|
107
118
|
|
|
108
119
|
## Documentation
|
|
109
120
|
|
|
110
121
|
Full API reference and Pro tier features (Admin Panel, Custom Tabs) available at:
|
|
111
122
|
|
|
112
123
|
- **Docs**: [thestatic.tv/info](https://thestatic.tv/info)
|
|
113
|
-
- **Examples**: [github.com/thestatic-tv/thestatic-dcl-
|
|
124
|
+
- **Examples**: [thestatic-dcl-free](https://github.com/thestatic-tv/thestatic-dcl-free), [thestatic-dcl-standard](https://github.com/thestatic-tv/thestatic-dcl-standard), [thestatic-dcl-pro](https://github.com/thestatic-tv/thestatic-dcl-pro)
|
|
114
125
|
|
|
115
126
|
## Support
|
|
116
127
|
|
|
117
|
-
-
|
|
118
|
-
- Issues: [GitHub Issues](https://github.com/thestatic-tv/dcl-sdk/issues)
|
|
128
|
+
- Support: [thestatic.tv/support](https://thestatic.tv/support)
|
|
119
129
|
|
|
120
130
|
## License
|
|
121
131
|
|
package/dist/index.d.mts
CHANGED
|
@@ -100,7 +100,7 @@ interface StaticTVConfig {
|
|
|
100
100
|
*/
|
|
101
101
|
player?: PlayerData;
|
|
102
102
|
/**
|
|
103
|
-
* Custom boundary check function
|
|
103
|
+
* Custom boundary check function - overrides the SDK's auto-detected parcel bounds.
|
|
104
104
|
* Use this for L-shaped or irregular estates where the bounding box is too large.
|
|
105
105
|
* Return true if the player is physically inside your scene, false if nearby but outside.
|
|
106
106
|
* @example
|
|
@@ -185,6 +185,8 @@ interface SessionResponse {
|
|
|
185
185
|
*/
|
|
186
186
|
interface HeartbeatResponse {
|
|
187
187
|
success: boolean;
|
|
188
|
+
/** false when this player's last minute counted under a minute ago (a channel switch) */
|
|
189
|
+
counted?: boolean;
|
|
188
190
|
channelSlug: string;
|
|
189
191
|
sceneOwnerChannel: string;
|
|
190
192
|
version: string;
|
|
@@ -555,7 +557,10 @@ declare class SessionModule {
|
|
|
555
557
|
/**
|
|
556
558
|
* Heartbeat module - track video watching metrics
|
|
557
559
|
*
|
|
558
|
-
* Only tracks when player is within scene bounds.
|
|
560
|
+
* Only tracks when player is within scene bounds. Each heartbeat is a DCL signed request (2.6.0):
|
|
561
|
+
* the explorer signs it as the player and thestatic.tv credits the minute - and any Sparks - to
|
|
562
|
+
* that proven wallet. It names no wallet: earlier versions sent one, and the server credited
|
|
563
|
+
* whichever account listed it.
|
|
559
564
|
*/
|
|
560
565
|
|
|
561
566
|
declare class HeartbeatModule {
|
|
@@ -575,10 +580,6 @@ declare class HeartbeatModule {
|
|
|
575
580
|
* Stop tracking video watching
|
|
576
581
|
*/
|
|
577
582
|
stopWatching(): void;
|
|
578
|
-
/**
|
|
579
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
580
|
-
*/
|
|
581
|
-
private getWallet;
|
|
582
583
|
/**
|
|
583
584
|
* Send a watching heartbeat (1 heartbeat = 1 minute watched)
|
|
584
585
|
* Only sends if player is within scene bounds
|
|
@@ -596,6 +597,11 @@ declare class HeartbeatModule {
|
|
|
596
597
|
|
|
597
598
|
/**
|
|
598
599
|
* Interactions module - like/follow channels from DCL scenes
|
|
600
|
+
*
|
|
601
|
+
* Each is a DCL signed request (2.6.0): the explorer signs it as the player, and thestatic.tv
|
|
602
|
+
* records the like or follow for that proven wallet. It names no wallet: earlier versions sent
|
|
603
|
+
* one, and the server recorded the interaction for whichever wallet was named. Guests cannot
|
|
604
|
+
* like or follow.
|
|
599
605
|
*/
|
|
600
606
|
|
|
601
607
|
declare class InteractionsModule {
|
|
@@ -702,7 +708,7 @@ declare class ChatUIModule {
|
|
|
702
708
|
private config;
|
|
703
709
|
private _isVisible;
|
|
704
710
|
private _unreadCount;
|
|
705
|
-
private
|
|
711
|
+
private authChecked;
|
|
706
712
|
private isSigningIn;
|
|
707
713
|
private isRegisteredUser;
|
|
708
714
|
private currentUsername;
|
|
@@ -873,6 +879,13 @@ declare class AdminPanelUIModule {
|
|
|
873
879
|
private stopStreamPolling;
|
|
874
880
|
private startCommandPolling;
|
|
875
881
|
private stopCommandPolling;
|
|
882
|
+
/**
|
|
883
|
+
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
884
|
+
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
885
|
+
* came from the scene deployed at this scene's registered location. A wallet named in a query or
|
|
886
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
887
|
+
*/
|
|
888
|
+
private signedRequest;
|
|
876
889
|
private pollCommands;
|
|
877
890
|
private fetchStreamData;
|
|
878
891
|
private refreshStreamStatus;
|
|
@@ -1043,6 +1056,15 @@ declare class StaticTVClient {
|
|
|
1043
1056
|
* @internal
|
|
1044
1057
|
*/
|
|
1045
1058
|
request<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
|
|
1061
|
+
* it to that proven wallet and checks it came from this scene - never a wallet the request names.
|
|
1062
|
+
* @internal
|
|
1063
|
+
*/
|
|
1064
|
+
signedRequest<T>(endpoint: string, init?: {
|
|
1065
|
+
method?: string;
|
|
1066
|
+
body?: string;
|
|
1067
|
+
}): Promise<T>;
|
|
1046
1068
|
/**
|
|
1047
1069
|
* Log a debug message (only when debug: true)
|
|
1048
1070
|
* @internal
|
|
@@ -1174,11 +1196,25 @@ declare class StaticTVClient {
|
|
|
1174
1196
|
* @internal
|
|
1175
1197
|
*/
|
|
1176
1198
|
private _resolveFeaturesReady;
|
|
1199
|
+
/**
|
|
1200
|
+
* Called by SessionModule when the session could not start - the server
|
|
1201
|
+
* refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
|
|
1202
|
+
* With no tier ever confirmed that is the free tier: onFeaturesReady() must
|
|
1203
|
+
* settle, never hang a scene awaiting it. A tier already confirmed stays.
|
|
1204
|
+
* @internal
|
|
1205
|
+
*/
|
|
1206
|
+
_settleFeaturesAsFree(): void;
|
|
1177
1207
|
/**
|
|
1178
1208
|
* Called by SessionModule when server returns the tier
|
|
1179
1209
|
* Enables modules based on tier level
|
|
1180
1210
|
* @internal
|
|
1181
1211
|
*/
|
|
1212
|
+
/**
|
|
1213
|
+
* The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
|
|
1214
|
+
* dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
|
|
1215
|
+
* request came from the scene deployed at that scene's registered location.
|
|
1216
|
+
*/
|
|
1217
|
+
getSceneId(): string | undefined;
|
|
1182
1218
|
_enableFeaturesForTier(tier: SDKTier, keyId?: string | null): void;
|
|
1183
1219
|
/**
|
|
1184
1220
|
* @deprecated Use `_enableFeaturesForTier` instead
|
package/dist/index.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ interface StaticTVConfig {
|
|
|
100
100
|
*/
|
|
101
101
|
player?: PlayerData;
|
|
102
102
|
/**
|
|
103
|
-
* Custom boundary check function
|
|
103
|
+
* Custom boundary check function - overrides the SDK's auto-detected parcel bounds.
|
|
104
104
|
* Use this for L-shaped or irregular estates where the bounding box is too large.
|
|
105
105
|
* Return true if the player is physically inside your scene, false if nearby but outside.
|
|
106
106
|
* @example
|
|
@@ -185,6 +185,8 @@ interface SessionResponse {
|
|
|
185
185
|
*/
|
|
186
186
|
interface HeartbeatResponse {
|
|
187
187
|
success: boolean;
|
|
188
|
+
/** false when this player's last minute counted under a minute ago (a channel switch) */
|
|
189
|
+
counted?: boolean;
|
|
188
190
|
channelSlug: string;
|
|
189
191
|
sceneOwnerChannel: string;
|
|
190
192
|
version: string;
|
|
@@ -555,7 +557,10 @@ declare class SessionModule {
|
|
|
555
557
|
/**
|
|
556
558
|
* Heartbeat module - track video watching metrics
|
|
557
559
|
*
|
|
558
|
-
* Only tracks when player is within scene bounds.
|
|
560
|
+
* Only tracks when player is within scene bounds. Each heartbeat is a DCL signed request (2.6.0):
|
|
561
|
+
* the explorer signs it as the player and thestatic.tv credits the minute - and any Sparks - to
|
|
562
|
+
* that proven wallet. It names no wallet: earlier versions sent one, and the server credited
|
|
563
|
+
* whichever account listed it.
|
|
559
564
|
*/
|
|
560
565
|
|
|
561
566
|
declare class HeartbeatModule {
|
|
@@ -575,10 +580,6 @@ declare class HeartbeatModule {
|
|
|
575
580
|
* Stop tracking video watching
|
|
576
581
|
*/
|
|
577
582
|
stopWatching(): void;
|
|
578
|
-
/**
|
|
579
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
580
|
-
*/
|
|
581
|
-
private getWallet;
|
|
582
583
|
/**
|
|
583
584
|
* Send a watching heartbeat (1 heartbeat = 1 minute watched)
|
|
584
585
|
* Only sends if player is within scene bounds
|
|
@@ -596,6 +597,11 @@ declare class HeartbeatModule {
|
|
|
596
597
|
|
|
597
598
|
/**
|
|
598
599
|
* Interactions module - like/follow channels from DCL scenes
|
|
600
|
+
*
|
|
601
|
+
* Each is a DCL signed request (2.6.0): the explorer signs it as the player, and thestatic.tv
|
|
602
|
+
* records the like or follow for that proven wallet. It names no wallet: earlier versions sent
|
|
603
|
+
* one, and the server recorded the interaction for whichever wallet was named. Guests cannot
|
|
604
|
+
* like or follow.
|
|
599
605
|
*/
|
|
600
606
|
|
|
601
607
|
declare class InteractionsModule {
|
|
@@ -702,7 +708,7 @@ declare class ChatUIModule {
|
|
|
702
708
|
private config;
|
|
703
709
|
private _isVisible;
|
|
704
710
|
private _unreadCount;
|
|
705
|
-
private
|
|
711
|
+
private authChecked;
|
|
706
712
|
private isSigningIn;
|
|
707
713
|
private isRegisteredUser;
|
|
708
714
|
private currentUsername;
|
|
@@ -873,6 +879,13 @@ declare class AdminPanelUIModule {
|
|
|
873
879
|
private stopStreamPolling;
|
|
874
880
|
private startCommandPolling;
|
|
875
881
|
private stopCommandPolling;
|
|
882
|
+
/**
|
|
883
|
+
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
884
|
+
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
885
|
+
* came from the scene deployed at this scene's registered location. A wallet named in a query or
|
|
886
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
887
|
+
*/
|
|
888
|
+
private signedRequest;
|
|
876
889
|
private pollCommands;
|
|
877
890
|
private fetchStreamData;
|
|
878
891
|
private refreshStreamStatus;
|
|
@@ -1043,6 +1056,15 @@ declare class StaticTVClient {
|
|
|
1043
1056
|
* @internal
|
|
1044
1057
|
*/
|
|
1045
1058
|
request<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
|
|
1061
|
+
* it to that proven wallet and checks it came from this scene - never a wallet the request names.
|
|
1062
|
+
* @internal
|
|
1063
|
+
*/
|
|
1064
|
+
signedRequest<T>(endpoint: string, init?: {
|
|
1065
|
+
method?: string;
|
|
1066
|
+
body?: string;
|
|
1067
|
+
}): Promise<T>;
|
|
1046
1068
|
/**
|
|
1047
1069
|
* Log a debug message (only when debug: true)
|
|
1048
1070
|
* @internal
|
|
@@ -1174,11 +1196,25 @@ declare class StaticTVClient {
|
|
|
1174
1196
|
* @internal
|
|
1175
1197
|
*/
|
|
1176
1198
|
private _resolveFeaturesReady;
|
|
1199
|
+
/**
|
|
1200
|
+
* Called by SessionModule when the session could not start - the server
|
|
1201
|
+
* refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
|
|
1202
|
+
* With no tier ever confirmed that is the free tier: onFeaturesReady() must
|
|
1203
|
+
* settle, never hang a scene awaiting it. A tier already confirmed stays.
|
|
1204
|
+
* @internal
|
|
1205
|
+
*/
|
|
1206
|
+
_settleFeaturesAsFree(): void;
|
|
1177
1207
|
/**
|
|
1178
1208
|
* Called by SessionModule when server returns the tier
|
|
1179
1209
|
* Enables modules based on tier level
|
|
1180
1210
|
* @internal
|
|
1181
1211
|
*/
|
|
1212
|
+
/**
|
|
1213
|
+
* The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
|
|
1214
|
+
* dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
|
|
1215
|
+
* request came from the scene deployed at that scene's registered location.
|
|
1216
|
+
*/
|
|
1217
|
+
getSceneId(): string | undefined;
|
|
1182
1218
|
_enableFeaturesForTier(tier: SDKTier, keyId?: string | null): void;
|
|
1183
1219
|
/**
|
|
1184
1220
|
* @deprecated Use `_enableFeaturesForTier` instead
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,9 @@ async function request(url, options = {}) {
|
|
|
64
64
|
return response.json();
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
// src/StaticTVClient.ts
|
|
68
|
+
var import_SignedFetch3 = require("~system/SignedFetch");
|
|
69
|
+
|
|
67
70
|
// src/modules/guide.ts
|
|
68
71
|
var GuideModule = class {
|
|
69
72
|
// 30 seconds
|
|
@@ -482,9 +485,11 @@ var SessionModule = class {
|
|
|
482
485
|
this.client._enableFeaturesForTier(this._tier, this._keyId);
|
|
483
486
|
return this.sessionId;
|
|
484
487
|
}
|
|
488
|
+
this.client._settleFeaturesAsFree();
|
|
485
489
|
return null;
|
|
486
490
|
} catch (error) {
|
|
487
491
|
this.client.log(`Failed to start session: ${error}`);
|
|
492
|
+
this.client._settleFeaturesAsFree();
|
|
488
493
|
return null;
|
|
489
494
|
}
|
|
490
495
|
}
|
|
@@ -637,13 +642,6 @@ var HeartbeatModule = class {
|
|
|
637
642
|
this.currentChannel = null;
|
|
638
643
|
this.isWatching = false;
|
|
639
644
|
}
|
|
640
|
-
/**
|
|
641
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
642
|
-
*/
|
|
643
|
-
getWallet() {
|
|
644
|
-
const config = this.client.getConfig();
|
|
645
|
-
return config.player?.wallet || getPlayerWallet();
|
|
646
|
-
}
|
|
647
645
|
/**
|
|
648
646
|
* Send a watching heartbeat (1 heartbeat = 1 minute watched)
|
|
649
647
|
* Only sends if player is within scene bounds
|
|
@@ -655,14 +653,9 @@ var HeartbeatModule = class {
|
|
|
655
653
|
return;
|
|
656
654
|
}
|
|
657
655
|
try {
|
|
658
|
-
|
|
659
|
-
await this.client.request("/heartbeat", {
|
|
656
|
+
await this.client.signedRequest("/heartbeat", {
|
|
660
657
|
method: "POST",
|
|
661
|
-
body: JSON.stringify({
|
|
662
|
-
channelSlug: this.currentChannel,
|
|
663
|
-
walletAddress: this.getWallet(),
|
|
664
|
-
sessionId
|
|
665
|
-
})
|
|
658
|
+
body: JSON.stringify({ channelSlug: this.currentChannel })
|
|
666
659
|
});
|
|
667
660
|
this.client.log(`Heartbeat sent for ${this.currentChannel}`);
|
|
668
661
|
} catch (error) {
|
|
@@ -702,13 +695,9 @@ var InteractionsModule = class {
|
|
|
702
695
|
return null;
|
|
703
696
|
}
|
|
704
697
|
try {
|
|
705
|
-
const response = await this.client.
|
|
698
|
+
const response = await this.client.signedRequest("/interact", {
|
|
706
699
|
method: "POST",
|
|
707
|
-
body: JSON.stringify({
|
|
708
|
-
action: "like",
|
|
709
|
-
channelSlug,
|
|
710
|
-
walletAddress
|
|
711
|
-
})
|
|
700
|
+
body: JSON.stringify({ action: "like", channelSlug })
|
|
712
701
|
});
|
|
713
702
|
if (response.alreadyExists) {
|
|
714
703
|
this.client.log(`Already liked ${channelSlug}`);
|
|
@@ -735,13 +724,9 @@ var InteractionsModule = class {
|
|
|
735
724
|
return null;
|
|
736
725
|
}
|
|
737
726
|
try {
|
|
738
|
-
const response = await this.client.
|
|
727
|
+
const response = await this.client.signedRequest("/interact", {
|
|
739
728
|
method: "POST",
|
|
740
|
-
body: JSON.stringify({
|
|
741
|
-
action: "follow",
|
|
742
|
-
channelSlug,
|
|
743
|
-
walletAddress
|
|
744
|
-
})
|
|
729
|
+
body: JSON.stringify({ action: "follow", channelSlug })
|
|
745
730
|
});
|
|
746
731
|
if (response.alreadyExists) {
|
|
747
732
|
this.client.log(`Already following ${channelSlug}`);
|
|
@@ -1679,7 +1664,6 @@ var import_math4 = require("@dcl/sdk/math");
|
|
|
1679
1664
|
var import_SignedFetch = require("~system/SignedFetch");
|
|
1680
1665
|
var import_players = require("@dcl/sdk/players");
|
|
1681
1666
|
var import_RestrictedActions2 = require("~system/RestrictedActions");
|
|
1682
|
-
var FIREBASE_API_KEY = "AIzaSyCX5jViDWUSagUmAX7S4OXgXyJZ9shaC5Y";
|
|
1683
1667
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
1684
1668
|
var POLL_INTERVAL_PASSIVE = 3e4;
|
|
1685
1669
|
var ChatUIModule = class {
|
|
@@ -1687,8 +1671,10 @@ var ChatUIModule = class {
|
|
|
1687
1671
|
// Visibility state
|
|
1688
1672
|
this._isVisible = false;
|
|
1689
1673
|
this._unreadCount = 0;
|
|
1690
|
-
// Authentication state
|
|
1691
|
-
|
|
1674
|
+
// Authentication state. There is no login token (thestatic.tv STATIC-01, 2026-10-07): the old
|
|
1675
|
+
// flow got a Firebase custom token from /api/auth/dcl, which any scene could ask for on a
|
|
1676
|
+
// visitor's behalf. Status and sends are now DCL signed requests bound to this scene.
|
|
1677
|
+
this.authChecked = false;
|
|
1692
1678
|
this.isSigningIn = false;
|
|
1693
1679
|
this.isRegisteredUser = false;
|
|
1694
1680
|
this.currentUsername = "Guest";
|
|
@@ -1848,7 +1834,12 @@ var ChatUIModule = class {
|
|
|
1848
1834
|
return baseUrl.replace("/api/v1/dcl", "");
|
|
1849
1835
|
}
|
|
1850
1836
|
async performAuth() {
|
|
1851
|
-
if (this.isSigningIn || this.
|
|
1837
|
+
if (this.isSigningIn || this.authChecked) return;
|
|
1838
|
+
const sceneId = this.client.getSceneId();
|
|
1839
|
+
if (!sceneId) {
|
|
1840
|
+
this.client.log("Chat: no sceneId - signed chat needs the scene this SDK is registered as");
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1852
1843
|
this.isSigningIn = true;
|
|
1853
1844
|
try {
|
|
1854
1845
|
const baseUrl = this.getBaseUrl();
|
|
@@ -1857,29 +1848,18 @@ var ChatUIModule = class {
|
|
|
1857
1848
|
init: {
|
|
1858
1849
|
method: "POST",
|
|
1859
1850
|
headers: { "Content-Type": "application/json" },
|
|
1860
|
-
body: JSON.stringify({})
|
|
1851
|
+
body: JSON.stringify({ sceneId })
|
|
1861
1852
|
}
|
|
1862
1853
|
});
|
|
1863
|
-
if (!response.ok) throw new Error("Backend refused
|
|
1854
|
+
if (!response.ok) throw new Error("Backend refused the signed status check");
|
|
1864
1855
|
const authData = JSON.parse(response.body);
|
|
1865
1856
|
if (authData.username) this.currentUsername = authData.username;
|
|
1866
1857
|
this.isRegisteredUser = !!authData.isRegistered;
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
method: "POST",
|
|
1871
|
-
headers: { "Content-Type": "application/json" },
|
|
1872
|
-
body: JSON.stringify({ token: authData.token, returnSecureToken: true })
|
|
1873
|
-
}
|
|
1874
|
-
);
|
|
1875
|
-
const exchangeData = await exchangeRes.json();
|
|
1876
|
-
if (exchangeData.idToken) {
|
|
1877
|
-
this.idToken = exchangeData.idToken;
|
|
1878
|
-
if (this.inputText && this.isRegisteredUser) {
|
|
1879
|
-
this.handleSend();
|
|
1880
|
-
}
|
|
1858
|
+
this.authChecked = true;
|
|
1859
|
+
if (this.inputText && this.isRegisteredUser) {
|
|
1860
|
+
this.handleSend();
|
|
1881
1861
|
}
|
|
1882
|
-
this.client.log("Chat
|
|
1862
|
+
this.client.log("Chat status checked");
|
|
1883
1863
|
} catch (e) {
|
|
1884
1864
|
this.client.log(`Chat auth failed: ${e}`);
|
|
1885
1865
|
} finally {
|
|
@@ -1948,11 +1928,13 @@ var ChatUIModule = class {
|
|
|
1948
1928
|
}
|
|
1949
1929
|
async handleSend() {
|
|
1950
1930
|
if (!this.inputText.trim()) return;
|
|
1951
|
-
if (!this.
|
|
1931
|
+
if (!this.authChecked) {
|
|
1952
1932
|
await this.performAuth();
|
|
1953
1933
|
return;
|
|
1954
1934
|
}
|
|
1955
1935
|
if (!this.isRegisteredUser) return;
|
|
1936
|
+
const sceneId = this.client.getSceneId();
|
|
1937
|
+
if (!sceneId) return;
|
|
1956
1938
|
const message = this.inputText.trim();
|
|
1957
1939
|
this.inputText = "";
|
|
1958
1940
|
try {
|
|
@@ -1961,18 +1943,15 @@ var ChatUIModule = class {
|
|
|
1961
1943
|
url: `${baseUrl}/api/chat/send`,
|
|
1962
1944
|
init: {
|
|
1963
1945
|
method: "POST",
|
|
1964
|
-
headers: {
|
|
1965
|
-
|
|
1966
|
-
Authorization: `Bearer ${this.idToken}`
|
|
1967
|
-
},
|
|
1968
|
-
body: JSON.stringify({ channelId: this.currentChannelId, text: message })
|
|
1946
|
+
headers: { "Content-Type": "application/json" },
|
|
1947
|
+
body: JSON.stringify({ channelId: this.currentChannelId, text: message, sceneId })
|
|
1969
1948
|
}
|
|
1970
1949
|
});
|
|
1971
1950
|
if (response.ok) {
|
|
1972
1951
|
await this.fetchMessages();
|
|
1973
1952
|
this.resetChatTimer();
|
|
1974
|
-
} else if (response.status === 401) {
|
|
1975
|
-
this.
|
|
1953
|
+
} else if (response.status === 401 || response.status === 403) {
|
|
1954
|
+
this.authChecked = false;
|
|
1976
1955
|
this.performAuth();
|
|
1977
1956
|
}
|
|
1978
1957
|
} catch (e) {
|
|
@@ -2476,6 +2455,7 @@ var import_react_ecs5 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
|
2476
2455
|
var import_math5 = require("@dcl/sdk/math");
|
|
2477
2456
|
var import_players2 = require("@dcl/sdk/players");
|
|
2478
2457
|
var import_RestrictedActions3 = require("~system/RestrictedActions");
|
|
2458
|
+
var import_SignedFetch2 = require("~system/SignedFetch");
|
|
2479
2459
|
|
|
2480
2460
|
// src/ui/ui-renderer.tsx
|
|
2481
2461
|
var import_react_ecs4 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
@@ -3241,8 +3221,8 @@ var AdminPanelUIModule = class {
|
|
|
3241
3221
|
return;
|
|
3242
3222
|
}
|
|
3243
3223
|
try {
|
|
3244
|
-
const res = await
|
|
3245
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/admin-check
|
|
3224
|
+
const res = await this.signedRequest(
|
|
3225
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/admin-check`
|
|
3246
3226
|
);
|
|
3247
3227
|
if (res.ok) {
|
|
3248
3228
|
const data = await res.json();
|
|
@@ -3343,6 +3323,20 @@ var AdminPanelUIModule = class {
|
|
|
3343
3323
|
this.log("Command polling stopped");
|
|
3344
3324
|
}
|
|
3345
3325
|
}
|
|
3326
|
+
/**
|
|
3327
|
+
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
3328
|
+
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
3329
|
+
* came from the scene deployed at this scene's registered location. A wallet named in a query or
|
|
3330
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
3331
|
+
*/
|
|
3332
|
+
async signedRequest(url, init = {}) {
|
|
3333
|
+
const res = await (0, import_SignedFetch2.signedFetch)({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
|
|
3334
|
+
return {
|
|
3335
|
+
ok: res.ok,
|
|
3336
|
+
status: res.status,
|
|
3337
|
+
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
3338
|
+
};
|
|
3339
|
+
}
|
|
3346
3340
|
async pollCommands() {
|
|
3347
3341
|
try {
|
|
3348
3342
|
const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
|
|
@@ -3386,8 +3380,8 @@ var AdminPanelUIModule = class {
|
|
|
3386
3380
|
async fetchStreamData() {
|
|
3387
3381
|
if (this.streamFetched || !this.playerWallet) return;
|
|
3388
3382
|
try {
|
|
3389
|
-
const res = await
|
|
3390
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/stream
|
|
3383
|
+
const res = await this.signedRequest(
|
|
3384
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/stream`
|
|
3391
3385
|
);
|
|
3392
3386
|
if (res.ok) {
|
|
3393
3387
|
this.streamData = await res.json();
|
|
@@ -3401,8 +3395,8 @@ var AdminPanelUIModule = class {
|
|
|
3401
3395
|
async refreshStreamStatus() {
|
|
3402
3396
|
if (!this.playerWallet) return;
|
|
3403
3397
|
try {
|
|
3404
|
-
const res = await
|
|
3405
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/stream
|
|
3398
|
+
const res = await this.signedRequest(
|
|
3399
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/stream`
|
|
3406
3400
|
);
|
|
3407
3401
|
if (res.ok) {
|
|
3408
3402
|
this.streamData = await res.json();
|
|
@@ -3461,12 +3455,12 @@ var AdminPanelUIModule = class {
|
|
|
3461
3455
|
this.channelCreateError = "";
|
|
3462
3456
|
try {
|
|
3463
3457
|
this.log("Creating channel for scene...");
|
|
3464
|
-
const res = await
|
|
3458
|
+
const res = await this.signedRequest(
|
|
3465
3459
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream/create`,
|
|
3466
3460
|
{
|
|
3467
3461
|
method: "POST",
|
|
3468
3462
|
headers: { "Content-Type": "application/json" },
|
|
3469
|
-
body: JSON.stringify({
|
|
3463
|
+
body: JSON.stringify({})
|
|
3470
3464
|
}
|
|
3471
3465
|
);
|
|
3472
3466
|
const data = await res.json();
|
|
@@ -3491,12 +3485,12 @@ var AdminPanelUIModule = class {
|
|
|
3491
3485
|
this.trialClaimError = "";
|
|
3492
3486
|
try {
|
|
3493
3487
|
this.log("Claiming streaming trial...");
|
|
3494
|
-
const res = await
|
|
3488
|
+
const res = await this.signedRequest(
|
|
3495
3489
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream/claim-trial`,
|
|
3496
3490
|
{
|
|
3497
3491
|
method: "POST",
|
|
3498
3492
|
headers: { "Content-Type": "application/json" },
|
|
3499
|
-
body: JSON.stringify({
|
|
3493
|
+
body: JSON.stringify({})
|
|
3500
3494
|
}
|
|
3501
3495
|
);
|
|
3502
3496
|
const data = await res.json();
|
|
@@ -3521,12 +3515,12 @@ var AdminPanelUIModule = class {
|
|
|
3521
3515
|
this.channelDeleteError = "";
|
|
3522
3516
|
try {
|
|
3523
3517
|
this.log("Deleting channel for scene...");
|
|
3524
|
-
const res = await
|
|
3518
|
+
const res = await this.signedRequest(
|
|
3525
3519
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`,
|
|
3526
3520
|
{
|
|
3527
3521
|
method: "POST",
|
|
3528
3522
|
headers: { "Content-Type": "application/json" },
|
|
3529
|
-
body: JSON.stringify({
|
|
3523
|
+
body: JSON.stringify({})
|
|
3530
3524
|
}
|
|
3531
3525
|
);
|
|
3532
3526
|
const data = await res.json();
|
|
@@ -3556,12 +3550,12 @@ var AdminPanelUIModule = class {
|
|
|
3556
3550
|
this.streamControlStatus = "";
|
|
3557
3551
|
try {
|
|
3558
3552
|
this.log("Starting stream...");
|
|
3559
|
-
const res = await
|
|
3553
|
+
const res = await this.signedRequest(
|
|
3560
3554
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream`,
|
|
3561
3555
|
{
|
|
3562
3556
|
method: "POST",
|
|
3563
3557
|
headers: { "Content-Type": "application/json" },
|
|
3564
|
-
body: JSON.stringify({ action: "start"
|
|
3558
|
+
body: JSON.stringify({ action: "start" })
|
|
3565
3559
|
}
|
|
3566
3560
|
);
|
|
3567
3561
|
const data = await res.json();
|
|
@@ -3588,12 +3582,12 @@ var AdminPanelUIModule = class {
|
|
|
3588
3582
|
this.streamControlStatus = "";
|
|
3589
3583
|
try {
|
|
3590
3584
|
this.log("Stopping stream...");
|
|
3591
|
-
const res = await
|
|
3585
|
+
const res = await this.signedRequest(
|
|
3592
3586
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream`,
|
|
3593
3587
|
{
|
|
3594
3588
|
method: "POST",
|
|
3595
3589
|
headers: { "Content-Type": "application/json" },
|
|
3596
|
-
body: JSON.stringify({ action: "stop"
|
|
3590
|
+
body: JSON.stringify({ action: "stop" })
|
|
3597
3591
|
}
|
|
3598
3592
|
);
|
|
3599
3593
|
const data = await res.json();
|
|
@@ -3619,12 +3613,12 @@ var AdminPanelUIModule = class {
|
|
|
3619
3613
|
this.keyRotateStatus = "";
|
|
3620
3614
|
try {
|
|
3621
3615
|
this.log("Rotating stream key...");
|
|
3622
|
-
const res = await
|
|
3616
|
+
const res = await this.signedRequest(
|
|
3623
3617
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream`,
|
|
3624
3618
|
{
|
|
3625
3619
|
method: "POST",
|
|
3626
3620
|
headers: { "Content-Type": "application/json" },
|
|
3627
|
-
body: JSON.stringify({ action: "rotateKey"
|
|
3621
|
+
body: JSON.stringify({ action: "rotateKey" })
|
|
3628
3622
|
}
|
|
3629
3623
|
);
|
|
3630
3624
|
const data = await res.json();
|
|
@@ -3647,8 +3641,8 @@ var AdminPanelUIModule = class {
|
|
|
3647
3641
|
if (!this.playerWallet) return;
|
|
3648
3642
|
this.modStatus = "loading";
|
|
3649
3643
|
try {
|
|
3650
|
-
const res = await
|
|
3651
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/config
|
|
3644
|
+
const res = await this.signedRequest(
|
|
3645
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3652
3646
|
{ headers: { "Content-Type": "application/json" } }
|
|
3653
3647
|
);
|
|
3654
3648
|
if (res.ok) {
|
|
@@ -3676,14 +3670,13 @@ var AdminPanelUIModule = class {
|
|
|
3676
3670
|
if (this.sceneAdmins.includes(normalized)) return;
|
|
3677
3671
|
this.modStatus = "loading";
|
|
3678
3672
|
try {
|
|
3679
|
-
const res = await
|
|
3673
|
+
const res = await this.signedRequest(
|
|
3680
3674
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3681
3675
|
{
|
|
3682
3676
|
method: "POST",
|
|
3683
3677
|
headers: { "Content-Type": "application/json" },
|
|
3684
3678
|
body: JSON.stringify({
|
|
3685
|
-
sceneAdmins: [...this.sceneAdmins, normalized]
|
|
3686
|
-
wallet: this.playerWallet
|
|
3679
|
+
sceneAdmins: [...this.sceneAdmins, normalized]
|
|
3687
3680
|
})
|
|
3688
3681
|
}
|
|
3689
3682
|
);
|
|
@@ -3704,14 +3697,13 @@ var AdminPanelUIModule = class {
|
|
|
3704
3697
|
if (!wallet || !this.playerWallet) return;
|
|
3705
3698
|
this.modStatus = "loading";
|
|
3706
3699
|
try {
|
|
3707
|
-
const res = await
|
|
3700
|
+
const res = await this.signedRequest(
|
|
3708
3701
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3709
3702
|
{
|
|
3710
3703
|
method: "POST",
|
|
3711
3704
|
headers: { "Content-Type": "application/json" },
|
|
3712
3705
|
body: JSON.stringify({
|
|
3713
|
-
sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
|
|
3714
|
-
wallet: this.playerWallet
|
|
3706
|
+
sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
|
|
3715
3707
|
})
|
|
3716
3708
|
}
|
|
3717
3709
|
);
|
|
@@ -3737,14 +3729,13 @@ var AdminPanelUIModule = class {
|
|
|
3737
3729
|
if (this.bannedWallets.includes(normalized)) return;
|
|
3738
3730
|
this.modStatus = "loading";
|
|
3739
3731
|
try {
|
|
3740
|
-
const res = await
|
|
3732
|
+
const res = await this.signedRequest(
|
|
3741
3733
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3742
3734
|
{
|
|
3743
3735
|
method: "POST",
|
|
3744
3736
|
headers: { "Content-Type": "application/json" },
|
|
3745
3737
|
body: JSON.stringify({
|
|
3746
|
-
bannedWallets: [...this.bannedWallets, normalized]
|
|
3747
|
-
wallet: this.playerWallet
|
|
3738
|
+
bannedWallets: [...this.bannedWallets, normalized]
|
|
3748
3739
|
})
|
|
3749
3740
|
}
|
|
3750
3741
|
);
|
|
@@ -3766,14 +3757,13 @@ var AdminPanelUIModule = class {
|
|
|
3766
3757
|
if (!wallet || !this.playerWallet) return;
|
|
3767
3758
|
this.modStatus = "loading";
|
|
3768
3759
|
try {
|
|
3769
|
-
const res = await
|
|
3760
|
+
const res = await this.signedRequest(
|
|
3770
3761
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3771
3762
|
{
|
|
3772
3763
|
method: "POST",
|
|
3773
3764
|
headers: { "Content-Type": "application/json" },
|
|
3774
3765
|
body: JSON.stringify({
|
|
3775
|
-
bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
|
|
3776
|
-
wallet: this.playerWallet
|
|
3766
|
+
bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
|
|
3777
3767
|
})
|
|
3778
3768
|
}
|
|
3779
3769
|
);
|
|
@@ -3998,11 +3988,6 @@ var StaticTVClient = class {
|
|
|
3998
3988
|
return;
|
|
3999
3989
|
}
|
|
4000
3990
|
this.session = new SessionModule(this);
|
|
4001
|
-
if (this._keyType === KEY_TYPE_CHANNEL) {
|
|
4002
|
-
this._tier = "standard";
|
|
4003
|
-
this._initStandardModules();
|
|
4004
|
-
this._resolveFeaturesReady("standard");
|
|
4005
|
-
}
|
|
4006
3991
|
if (this.config.autoStartSession) {
|
|
4007
3992
|
fetchUserData().then(() => {
|
|
4008
3993
|
this.session.startSession().catch((err) => {
|
|
@@ -4103,6 +4088,33 @@ var StaticTVClient = class {
|
|
|
4103
4088
|
}
|
|
4104
4089
|
});
|
|
4105
4090
|
}
|
|
4091
|
+
/**
|
|
4092
|
+
* Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
|
|
4093
|
+
* it to that proven wallet and checks it came from this scene - never a wallet the request names.
|
|
4094
|
+
* @internal
|
|
4095
|
+
*/
|
|
4096
|
+
async signedRequest(endpoint, init = {}) {
|
|
4097
|
+
const response = await (0, import_SignedFetch3.signedFetch)({
|
|
4098
|
+
url: `${this.apiUrl}${endpoint}`,
|
|
4099
|
+
init: {
|
|
4100
|
+
method: init.method || "POST",
|
|
4101
|
+
headers: {
|
|
4102
|
+
"Content-Type": "application/json",
|
|
4103
|
+
"x-dcl-api-key": this.config.apiKey
|
|
4104
|
+
},
|
|
4105
|
+
body: init.body
|
|
4106
|
+
}
|
|
4107
|
+
});
|
|
4108
|
+
let data = {};
|
|
4109
|
+
try {
|
|
4110
|
+
data = response.body ? JSON.parse(response.body) : {};
|
|
4111
|
+
} catch {
|
|
4112
|
+
}
|
|
4113
|
+
if (!response.ok) {
|
|
4114
|
+
throw new Error(data.error || `HTTP ${response.status}`);
|
|
4115
|
+
}
|
|
4116
|
+
return data;
|
|
4117
|
+
}
|
|
4106
4118
|
/**
|
|
4107
4119
|
* Log a debug message (only when debug: true)
|
|
4108
4120
|
* @internal
|
|
@@ -4475,11 +4487,32 @@ var StaticTVClient = class {
|
|
|
4475
4487
|
this._featuresReadyResolve(tier);
|
|
4476
4488
|
}
|
|
4477
4489
|
}
|
|
4490
|
+
/**
|
|
4491
|
+
* Called by SessionModule when the session could not start - the server
|
|
4492
|
+
* refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
|
|
4493
|
+
* With no tier ever confirmed that is the free tier: onFeaturesReady() must
|
|
4494
|
+
* settle, never hang a scene awaiting it. A tier already confirmed stays.
|
|
4495
|
+
* @internal
|
|
4496
|
+
*/
|
|
4497
|
+
_settleFeaturesAsFree() {
|
|
4498
|
+
if (!this._featuresResolved) {
|
|
4499
|
+
this._tier = "free";
|
|
4500
|
+
this._resolveFeaturesReady("free");
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4478
4503
|
/**
|
|
4479
4504
|
* Called by SessionModule when server returns the tier
|
|
4480
4505
|
* Enables modules based on tier level
|
|
4481
4506
|
* @internal
|
|
4482
4507
|
*/
|
|
4508
|
+
/**
|
|
4509
|
+
* The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
|
|
4510
|
+
* dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
|
|
4511
|
+
* request came from the scene deployed at that scene's registered location.
|
|
4512
|
+
*/
|
|
4513
|
+
getSceneId() {
|
|
4514
|
+
return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
|
|
4515
|
+
}
|
|
4483
4516
|
_enableFeaturesForTier(tier, keyId) {
|
|
4484
4517
|
this._tier = tier;
|
|
4485
4518
|
if (keyId) {
|
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,9 @@ async function request(url, options = {}) {
|
|
|
16
16
|
return response.json();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// src/StaticTVClient.ts
|
|
20
|
+
import { signedFetch as signedFetch3 } from "~system/SignedFetch";
|
|
21
|
+
|
|
19
22
|
// src/modules/guide.ts
|
|
20
23
|
var GuideModule = class {
|
|
21
24
|
// 30 seconds
|
|
@@ -434,9 +437,11 @@ var SessionModule = class {
|
|
|
434
437
|
this.client._enableFeaturesForTier(this._tier, this._keyId);
|
|
435
438
|
return this.sessionId;
|
|
436
439
|
}
|
|
440
|
+
this.client._settleFeaturesAsFree();
|
|
437
441
|
return null;
|
|
438
442
|
} catch (error) {
|
|
439
443
|
this.client.log(`Failed to start session: ${error}`);
|
|
444
|
+
this.client._settleFeaturesAsFree();
|
|
440
445
|
return null;
|
|
441
446
|
}
|
|
442
447
|
}
|
|
@@ -589,13 +594,6 @@ var HeartbeatModule = class {
|
|
|
589
594
|
this.currentChannel = null;
|
|
590
595
|
this.isWatching = false;
|
|
591
596
|
}
|
|
592
|
-
/**
|
|
593
|
-
* Get player wallet - prioritize config, fallback to runtime detection
|
|
594
|
-
*/
|
|
595
|
-
getWallet() {
|
|
596
|
-
const config = this.client.getConfig();
|
|
597
|
-
return config.player?.wallet || getPlayerWallet();
|
|
598
|
-
}
|
|
599
597
|
/**
|
|
600
598
|
* Send a watching heartbeat (1 heartbeat = 1 minute watched)
|
|
601
599
|
* Only sends if player is within scene bounds
|
|
@@ -607,14 +605,9 @@ var HeartbeatModule = class {
|
|
|
607
605
|
return;
|
|
608
606
|
}
|
|
609
607
|
try {
|
|
610
|
-
|
|
611
|
-
await this.client.request("/heartbeat", {
|
|
608
|
+
await this.client.signedRequest("/heartbeat", {
|
|
612
609
|
method: "POST",
|
|
613
|
-
body: JSON.stringify({
|
|
614
|
-
channelSlug: this.currentChannel,
|
|
615
|
-
walletAddress: this.getWallet(),
|
|
616
|
-
sessionId
|
|
617
|
-
})
|
|
610
|
+
body: JSON.stringify({ channelSlug: this.currentChannel })
|
|
618
611
|
});
|
|
619
612
|
this.client.log(`Heartbeat sent for ${this.currentChannel}`);
|
|
620
613
|
} catch (error) {
|
|
@@ -654,13 +647,9 @@ var InteractionsModule = class {
|
|
|
654
647
|
return null;
|
|
655
648
|
}
|
|
656
649
|
try {
|
|
657
|
-
const response = await this.client.
|
|
650
|
+
const response = await this.client.signedRequest("/interact", {
|
|
658
651
|
method: "POST",
|
|
659
|
-
body: JSON.stringify({
|
|
660
|
-
action: "like",
|
|
661
|
-
channelSlug,
|
|
662
|
-
walletAddress
|
|
663
|
-
})
|
|
652
|
+
body: JSON.stringify({ action: "like", channelSlug })
|
|
664
653
|
});
|
|
665
654
|
if (response.alreadyExists) {
|
|
666
655
|
this.client.log(`Already liked ${channelSlug}`);
|
|
@@ -687,13 +676,9 @@ var InteractionsModule = class {
|
|
|
687
676
|
return null;
|
|
688
677
|
}
|
|
689
678
|
try {
|
|
690
|
-
const response = await this.client.
|
|
679
|
+
const response = await this.client.signedRequest("/interact", {
|
|
691
680
|
method: "POST",
|
|
692
|
-
body: JSON.stringify({
|
|
693
|
-
action: "follow",
|
|
694
|
-
channelSlug,
|
|
695
|
-
walletAddress
|
|
696
|
-
})
|
|
681
|
+
body: JSON.stringify({ action: "follow", channelSlug })
|
|
697
682
|
});
|
|
698
683
|
if (response.alreadyExists) {
|
|
699
684
|
this.client.log(`Already following ${channelSlug}`);
|
|
@@ -1631,7 +1616,6 @@ import { Color4 as Color44 } from "@dcl/sdk/math";
|
|
|
1631
1616
|
import { signedFetch } from "~system/SignedFetch";
|
|
1632
1617
|
import { getPlayer } from "@dcl/sdk/players";
|
|
1633
1618
|
import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
|
|
1634
|
-
var FIREBASE_API_KEY = "AIzaSyCX5jViDWUSagUmAX7S4OXgXyJZ9shaC5Y";
|
|
1635
1619
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
1636
1620
|
var POLL_INTERVAL_PASSIVE = 3e4;
|
|
1637
1621
|
var ChatUIModule = class {
|
|
@@ -1639,8 +1623,10 @@ var ChatUIModule = class {
|
|
|
1639
1623
|
// Visibility state
|
|
1640
1624
|
this._isVisible = false;
|
|
1641
1625
|
this._unreadCount = 0;
|
|
1642
|
-
// Authentication state
|
|
1643
|
-
|
|
1626
|
+
// Authentication state. There is no login token (thestatic.tv STATIC-01, 2026-10-07): the old
|
|
1627
|
+
// flow got a Firebase custom token from /api/auth/dcl, which any scene could ask for on a
|
|
1628
|
+
// visitor's behalf. Status and sends are now DCL signed requests bound to this scene.
|
|
1629
|
+
this.authChecked = false;
|
|
1644
1630
|
this.isSigningIn = false;
|
|
1645
1631
|
this.isRegisteredUser = false;
|
|
1646
1632
|
this.currentUsername = "Guest";
|
|
@@ -1800,7 +1786,12 @@ var ChatUIModule = class {
|
|
|
1800
1786
|
return baseUrl.replace("/api/v1/dcl", "");
|
|
1801
1787
|
}
|
|
1802
1788
|
async performAuth() {
|
|
1803
|
-
if (this.isSigningIn || this.
|
|
1789
|
+
if (this.isSigningIn || this.authChecked) return;
|
|
1790
|
+
const sceneId = this.client.getSceneId();
|
|
1791
|
+
if (!sceneId) {
|
|
1792
|
+
this.client.log("Chat: no sceneId - signed chat needs the scene this SDK is registered as");
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1804
1795
|
this.isSigningIn = true;
|
|
1805
1796
|
try {
|
|
1806
1797
|
const baseUrl = this.getBaseUrl();
|
|
@@ -1809,29 +1800,18 @@ var ChatUIModule = class {
|
|
|
1809
1800
|
init: {
|
|
1810
1801
|
method: "POST",
|
|
1811
1802
|
headers: { "Content-Type": "application/json" },
|
|
1812
|
-
body: JSON.stringify({})
|
|
1803
|
+
body: JSON.stringify({ sceneId })
|
|
1813
1804
|
}
|
|
1814
1805
|
});
|
|
1815
|
-
if (!response.ok) throw new Error("Backend refused
|
|
1806
|
+
if (!response.ok) throw new Error("Backend refused the signed status check");
|
|
1816
1807
|
const authData = JSON.parse(response.body);
|
|
1817
1808
|
if (authData.username) this.currentUsername = authData.username;
|
|
1818
1809
|
this.isRegisteredUser = !!authData.isRegistered;
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
method: "POST",
|
|
1823
|
-
headers: { "Content-Type": "application/json" },
|
|
1824
|
-
body: JSON.stringify({ token: authData.token, returnSecureToken: true })
|
|
1825
|
-
}
|
|
1826
|
-
);
|
|
1827
|
-
const exchangeData = await exchangeRes.json();
|
|
1828
|
-
if (exchangeData.idToken) {
|
|
1829
|
-
this.idToken = exchangeData.idToken;
|
|
1830
|
-
if (this.inputText && this.isRegisteredUser) {
|
|
1831
|
-
this.handleSend();
|
|
1832
|
-
}
|
|
1810
|
+
this.authChecked = true;
|
|
1811
|
+
if (this.inputText && this.isRegisteredUser) {
|
|
1812
|
+
this.handleSend();
|
|
1833
1813
|
}
|
|
1834
|
-
this.client.log("Chat
|
|
1814
|
+
this.client.log("Chat status checked");
|
|
1835
1815
|
} catch (e) {
|
|
1836
1816
|
this.client.log(`Chat auth failed: ${e}`);
|
|
1837
1817
|
} finally {
|
|
@@ -1900,11 +1880,13 @@ var ChatUIModule = class {
|
|
|
1900
1880
|
}
|
|
1901
1881
|
async handleSend() {
|
|
1902
1882
|
if (!this.inputText.trim()) return;
|
|
1903
|
-
if (!this.
|
|
1883
|
+
if (!this.authChecked) {
|
|
1904
1884
|
await this.performAuth();
|
|
1905
1885
|
return;
|
|
1906
1886
|
}
|
|
1907
1887
|
if (!this.isRegisteredUser) return;
|
|
1888
|
+
const sceneId = this.client.getSceneId();
|
|
1889
|
+
if (!sceneId) return;
|
|
1908
1890
|
const message = this.inputText.trim();
|
|
1909
1891
|
this.inputText = "";
|
|
1910
1892
|
try {
|
|
@@ -1913,18 +1895,15 @@ var ChatUIModule = class {
|
|
|
1913
1895
|
url: `${baseUrl}/api/chat/send`,
|
|
1914
1896
|
init: {
|
|
1915
1897
|
method: "POST",
|
|
1916
|
-
headers: {
|
|
1917
|
-
|
|
1918
|
-
Authorization: `Bearer ${this.idToken}`
|
|
1919
|
-
},
|
|
1920
|
-
body: JSON.stringify({ channelId: this.currentChannelId, text: message })
|
|
1898
|
+
headers: { "Content-Type": "application/json" },
|
|
1899
|
+
body: JSON.stringify({ channelId: this.currentChannelId, text: message, sceneId })
|
|
1921
1900
|
}
|
|
1922
1901
|
});
|
|
1923
1902
|
if (response.ok) {
|
|
1924
1903
|
await this.fetchMessages();
|
|
1925
1904
|
this.resetChatTimer();
|
|
1926
|
-
} else if (response.status === 401) {
|
|
1927
|
-
this.
|
|
1905
|
+
} else if (response.status === 401 || response.status === 403) {
|
|
1906
|
+
this.authChecked = false;
|
|
1928
1907
|
this.performAuth();
|
|
1929
1908
|
}
|
|
1930
1909
|
} catch (e) {
|
|
@@ -2428,6 +2407,7 @@ import ReactEcs5, { UiEntity as UiEntity5, Button as Button3, Label as Label5, I
|
|
|
2428
2407
|
import { Color4 as Color45, Vector3 } from "@dcl/sdk/math";
|
|
2429
2408
|
import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
|
|
2430
2409
|
import { movePlayerTo, openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
|
|
2410
|
+
import { signedFetch as signedFetch2 } from "~system/SignedFetch";
|
|
2431
2411
|
|
|
2432
2412
|
// src/ui/ui-renderer.tsx
|
|
2433
2413
|
import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
|
|
@@ -3193,8 +3173,8 @@ var AdminPanelUIModule = class {
|
|
|
3193
3173
|
return;
|
|
3194
3174
|
}
|
|
3195
3175
|
try {
|
|
3196
|
-
const res = await
|
|
3197
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/admin-check
|
|
3176
|
+
const res = await this.signedRequest(
|
|
3177
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/admin-check`
|
|
3198
3178
|
);
|
|
3199
3179
|
if (res.ok) {
|
|
3200
3180
|
const data = await res.json();
|
|
@@ -3295,6 +3275,20 @@ var AdminPanelUIModule = class {
|
|
|
3295
3275
|
this.log("Command polling stopped");
|
|
3296
3276
|
}
|
|
3297
3277
|
}
|
|
3278
|
+
/**
|
|
3279
|
+
* Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
|
|
3280
|
+
* explorer signs it with the player's identity, and the server checks the signature and that it
|
|
3281
|
+
* came from the scene deployed at this scene's registered location. A wallet named in a query or
|
|
3282
|
+
* body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
|
|
3283
|
+
*/
|
|
3284
|
+
async signedRequest(url, init = {}) {
|
|
3285
|
+
const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
|
|
3286
|
+
return {
|
|
3287
|
+
ok: res.ok,
|
|
3288
|
+
status: res.status,
|
|
3289
|
+
json: async () => res.body ? JSON.parse(res.body) : {}
|
|
3290
|
+
};
|
|
3291
|
+
}
|
|
3298
3292
|
async pollCommands() {
|
|
3299
3293
|
try {
|
|
3300
3294
|
const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
|
|
@@ -3338,8 +3332,8 @@ var AdminPanelUIModule = class {
|
|
|
3338
3332
|
async fetchStreamData() {
|
|
3339
3333
|
if (this.streamFetched || !this.playerWallet) return;
|
|
3340
3334
|
try {
|
|
3341
|
-
const res = await
|
|
3342
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/stream
|
|
3335
|
+
const res = await this.signedRequest(
|
|
3336
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/stream`
|
|
3343
3337
|
);
|
|
3344
3338
|
if (res.ok) {
|
|
3345
3339
|
this.streamData = await res.json();
|
|
@@ -3353,8 +3347,8 @@ var AdminPanelUIModule = class {
|
|
|
3353
3347
|
async refreshStreamStatus() {
|
|
3354
3348
|
if (!this.playerWallet) return;
|
|
3355
3349
|
try {
|
|
3356
|
-
const res = await
|
|
3357
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/stream
|
|
3350
|
+
const res = await this.signedRequest(
|
|
3351
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/stream`
|
|
3358
3352
|
);
|
|
3359
3353
|
if (res.ok) {
|
|
3360
3354
|
this.streamData = await res.json();
|
|
@@ -3413,12 +3407,12 @@ var AdminPanelUIModule = class {
|
|
|
3413
3407
|
this.channelCreateError = "";
|
|
3414
3408
|
try {
|
|
3415
3409
|
this.log("Creating channel for scene...");
|
|
3416
|
-
const res = await
|
|
3410
|
+
const res = await this.signedRequest(
|
|
3417
3411
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream/create`,
|
|
3418
3412
|
{
|
|
3419
3413
|
method: "POST",
|
|
3420
3414
|
headers: { "Content-Type": "application/json" },
|
|
3421
|
-
body: JSON.stringify({
|
|
3415
|
+
body: JSON.stringify({})
|
|
3422
3416
|
}
|
|
3423
3417
|
);
|
|
3424
3418
|
const data = await res.json();
|
|
@@ -3443,12 +3437,12 @@ var AdminPanelUIModule = class {
|
|
|
3443
3437
|
this.trialClaimError = "";
|
|
3444
3438
|
try {
|
|
3445
3439
|
this.log("Claiming streaming trial...");
|
|
3446
|
-
const res = await
|
|
3440
|
+
const res = await this.signedRequest(
|
|
3447
3441
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream/claim-trial`,
|
|
3448
3442
|
{
|
|
3449
3443
|
method: "POST",
|
|
3450
3444
|
headers: { "Content-Type": "application/json" },
|
|
3451
|
-
body: JSON.stringify({
|
|
3445
|
+
body: JSON.stringify({})
|
|
3452
3446
|
}
|
|
3453
3447
|
);
|
|
3454
3448
|
const data = await res.json();
|
|
@@ -3473,12 +3467,12 @@ var AdminPanelUIModule = class {
|
|
|
3473
3467
|
this.channelDeleteError = "";
|
|
3474
3468
|
try {
|
|
3475
3469
|
this.log("Deleting channel for scene...");
|
|
3476
|
-
const res = await
|
|
3470
|
+
const res = await this.signedRequest(
|
|
3477
3471
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream/delete`,
|
|
3478
3472
|
{
|
|
3479
3473
|
method: "POST",
|
|
3480
3474
|
headers: { "Content-Type": "application/json" },
|
|
3481
|
-
body: JSON.stringify({
|
|
3475
|
+
body: JSON.stringify({})
|
|
3482
3476
|
}
|
|
3483
3477
|
);
|
|
3484
3478
|
const data = await res.json();
|
|
@@ -3508,12 +3502,12 @@ var AdminPanelUIModule = class {
|
|
|
3508
3502
|
this.streamControlStatus = "";
|
|
3509
3503
|
try {
|
|
3510
3504
|
this.log("Starting stream...");
|
|
3511
|
-
const res = await
|
|
3505
|
+
const res = await this.signedRequest(
|
|
3512
3506
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream`,
|
|
3513
3507
|
{
|
|
3514
3508
|
method: "POST",
|
|
3515
3509
|
headers: { "Content-Type": "application/json" },
|
|
3516
|
-
body: JSON.stringify({ action: "start"
|
|
3510
|
+
body: JSON.stringify({ action: "start" })
|
|
3517
3511
|
}
|
|
3518
3512
|
);
|
|
3519
3513
|
const data = await res.json();
|
|
@@ -3540,12 +3534,12 @@ var AdminPanelUIModule = class {
|
|
|
3540
3534
|
this.streamControlStatus = "";
|
|
3541
3535
|
try {
|
|
3542
3536
|
this.log("Stopping stream...");
|
|
3543
|
-
const res = await
|
|
3537
|
+
const res = await this.signedRequest(
|
|
3544
3538
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream`,
|
|
3545
3539
|
{
|
|
3546
3540
|
method: "POST",
|
|
3547
3541
|
headers: { "Content-Type": "application/json" },
|
|
3548
|
-
body: JSON.stringify({ action: "stop"
|
|
3542
|
+
body: JSON.stringify({ action: "stop" })
|
|
3549
3543
|
}
|
|
3550
3544
|
);
|
|
3551
3545
|
const data = await res.json();
|
|
@@ -3571,12 +3565,12 @@ var AdminPanelUIModule = class {
|
|
|
3571
3565
|
this.keyRotateStatus = "";
|
|
3572
3566
|
try {
|
|
3573
3567
|
this.log("Rotating stream key...");
|
|
3574
|
-
const res = await
|
|
3568
|
+
const res = await this.signedRequest(
|
|
3575
3569
|
`${this.baseUrl}/scene/${this.config.sceneId}/stream`,
|
|
3576
3570
|
{
|
|
3577
3571
|
method: "POST",
|
|
3578
3572
|
headers: { "Content-Type": "application/json" },
|
|
3579
|
-
body: JSON.stringify({ action: "rotateKey"
|
|
3573
|
+
body: JSON.stringify({ action: "rotateKey" })
|
|
3580
3574
|
}
|
|
3581
3575
|
);
|
|
3582
3576
|
const data = await res.json();
|
|
@@ -3599,8 +3593,8 @@ var AdminPanelUIModule = class {
|
|
|
3599
3593
|
if (!this.playerWallet) return;
|
|
3600
3594
|
this.modStatus = "loading";
|
|
3601
3595
|
try {
|
|
3602
|
-
const res = await
|
|
3603
|
-
`${this.baseUrl}/scene/${this.config.sceneId}/config
|
|
3596
|
+
const res = await this.signedRequest(
|
|
3597
|
+
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3604
3598
|
{ headers: { "Content-Type": "application/json" } }
|
|
3605
3599
|
);
|
|
3606
3600
|
if (res.ok) {
|
|
@@ -3628,14 +3622,13 @@ var AdminPanelUIModule = class {
|
|
|
3628
3622
|
if (this.sceneAdmins.includes(normalized)) return;
|
|
3629
3623
|
this.modStatus = "loading";
|
|
3630
3624
|
try {
|
|
3631
|
-
const res = await
|
|
3625
|
+
const res = await this.signedRequest(
|
|
3632
3626
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3633
3627
|
{
|
|
3634
3628
|
method: "POST",
|
|
3635
3629
|
headers: { "Content-Type": "application/json" },
|
|
3636
3630
|
body: JSON.stringify({
|
|
3637
|
-
sceneAdmins: [...this.sceneAdmins, normalized]
|
|
3638
|
-
wallet: this.playerWallet
|
|
3631
|
+
sceneAdmins: [...this.sceneAdmins, normalized]
|
|
3639
3632
|
})
|
|
3640
3633
|
}
|
|
3641
3634
|
);
|
|
@@ -3656,14 +3649,13 @@ var AdminPanelUIModule = class {
|
|
|
3656
3649
|
if (!wallet || !this.playerWallet) return;
|
|
3657
3650
|
this.modStatus = "loading";
|
|
3658
3651
|
try {
|
|
3659
|
-
const res = await
|
|
3652
|
+
const res = await this.signedRequest(
|
|
3660
3653
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3661
3654
|
{
|
|
3662
3655
|
method: "POST",
|
|
3663
3656
|
headers: { "Content-Type": "application/json" },
|
|
3664
3657
|
body: JSON.stringify({
|
|
3665
|
-
sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
|
|
3666
|
-
wallet: this.playerWallet
|
|
3658
|
+
sceneAdmins: this.sceneAdmins.filter((w) => w !== wallet)
|
|
3667
3659
|
})
|
|
3668
3660
|
}
|
|
3669
3661
|
);
|
|
@@ -3689,14 +3681,13 @@ var AdminPanelUIModule = class {
|
|
|
3689
3681
|
if (this.bannedWallets.includes(normalized)) return;
|
|
3690
3682
|
this.modStatus = "loading";
|
|
3691
3683
|
try {
|
|
3692
|
-
const res = await
|
|
3684
|
+
const res = await this.signedRequest(
|
|
3693
3685
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3694
3686
|
{
|
|
3695
3687
|
method: "POST",
|
|
3696
3688
|
headers: { "Content-Type": "application/json" },
|
|
3697
3689
|
body: JSON.stringify({
|
|
3698
|
-
bannedWallets: [...this.bannedWallets, normalized]
|
|
3699
|
-
wallet: this.playerWallet
|
|
3690
|
+
bannedWallets: [...this.bannedWallets, normalized]
|
|
3700
3691
|
})
|
|
3701
3692
|
}
|
|
3702
3693
|
);
|
|
@@ -3718,14 +3709,13 @@ var AdminPanelUIModule = class {
|
|
|
3718
3709
|
if (!wallet || !this.playerWallet) return;
|
|
3719
3710
|
this.modStatus = "loading";
|
|
3720
3711
|
try {
|
|
3721
|
-
const res = await
|
|
3712
|
+
const res = await this.signedRequest(
|
|
3722
3713
|
`${this.baseUrl}/scene/${this.config.sceneId}/config`,
|
|
3723
3714
|
{
|
|
3724
3715
|
method: "POST",
|
|
3725
3716
|
headers: { "Content-Type": "application/json" },
|
|
3726
3717
|
body: JSON.stringify({
|
|
3727
|
-
bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
|
|
3728
|
-
wallet: this.playerWallet
|
|
3718
|
+
bannedWallets: this.bannedWallets.filter((w) => w !== wallet)
|
|
3729
3719
|
})
|
|
3730
3720
|
}
|
|
3731
3721
|
);
|
|
@@ -3950,11 +3940,6 @@ var StaticTVClient = class {
|
|
|
3950
3940
|
return;
|
|
3951
3941
|
}
|
|
3952
3942
|
this.session = new SessionModule(this);
|
|
3953
|
-
if (this._keyType === KEY_TYPE_CHANNEL) {
|
|
3954
|
-
this._tier = "standard";
|
|
3955
|
-
this._initStandardModules();
|
|
3956
|
-
this._resolveFeaturesReady("standard");
|
|
3957
|
-
}
|
|
3958
3943
|
if (this.config.autoStartSession) {
|
|
3959
3944
|
fetchUserData().then(() => {
|
|
3960
3945
|
this.session.startSession().catch((err) => {
|
|
@@ -4055,6 +4040,33 @@ var StaticTVClient = class {
|
|
|
4055
4040
|
}
|
|
4056
4041
|
});
|
|
4057
4042
|
}
|
|
4043
|
+
/**
|
|
4044
|
+
* Make an API request the explorer signs as the player (DCL signed fetch): thestatic.tv credits
|
|
4045
|
+
* it to that proven wallet and checks it came from this scene - never a wallet the request names.
|
|
4046
|
+
* @internal
|
|
4047
|
+
*/
|
|
4048
|
+
async signedRequest(endpoint, init = {}) {
|
|
4049
|
+
const response = await signedFetch3({
|
|
4050
|
+
url: `${this.apiUrl}${endpoint}`,
|
|
4051
|
+
init: {
|
|
4052
|
+
method: init.method || "POST",
|
|
4053
|
+
headers: {
|
|
4054
|
+
"Content-Type": "application/json",
|
|
4055
|
+
"x-dcl-api-key": this.config.apiKey
|
|
4056
|
+
},
|
|
4057
|
+
body: init.body
|
|
4058
|
+
}
|
|
4059
|
+
});
|
|
4060
|
+
let data = {};
|
|
4061
|
+
try {
|
|
4062
|
+
data = response.body ? JSON.parse(response.body) : {};
|
|
4063
|
+
} catch {
|
|
4064
|
+
}
|
|
4065
|
+
if (!response.ok) {
|
|
4066
|
+
throw new Error(data.error || `HTTP ${response.status}`);
|
|
4067
|
+
}
|
|
4068
|
+
return data;
|
|
4069
|
+
}
|
|
4058
4070
|
/**
|
|
4059
4071
|
* Log a debug message (only when debug: true)
|
|
4060
4072
|
* @internal
|
|
@@ -4427,11 +4439,32 @@ var StaticTVClient = class {
|
|
|
4427
4439
|
this._featuresReadyResolve(tier);
|
|
4428
4440
|
}
|
|
4429
4441
|
}
|
|
4442
|
+
/**
|
|
4443
|
+
* Called by SessionModule when the session could not start - the server
|
|
4444
|
+
* refused it (an unpaid legacy key, since 2026-10-07) or the request failed.
|
|
4445
|
+
* With no tier ever confirmed that is the free tier: onFeaturesReady() must
|
|
4446
|
+
* settle, never hang a scene awaiting it. A tier already confirmed stays.
|
|
4447
|
+
* @internal
|
|
4448
|
+
*/
|
|
4449
|
+
_settleFeaturesAsFree() {
|
|
4450
|
+
if (!this._featuresResolved) {
|
|
4451
|
+
this._tier = "free";
|
|
4452
|
+
this._resolveFeaturesReady("free");
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4430
4455
|
/**
|
|
4431
4456
|
* Called by SessionModule when server returns the tier
|
|
4432
4457
|
* Enables modules based on tier level
|
|
4433
4458
|
* @internal
|
|
4434
4459
|
*/
|
|
4460
|
+
/**
|
|
4461
|
+
* The TheStatic scene this SDK runs as - config.sceneId, else the API key's id (they are the same
|
|
4462
|
+
* dcl_scenes doc for unified keys). In-world signed requests name it, and the server checks the
|
|
4463
|
+
* request came from the scene deployed at that scene's registered location.
|
|
4464
|
+
*/
|
|
4465
|
+
getSceneId() {
|
|
4466
|
+
return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
|
|
4467
|
+
}
|
|
4435
4468
|
_enableFeaturesForTier(tier, keyId) {
|
|
4436
4469
|
this._tier = tier;
|
|
4437
4470
|
if (keyId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thestatic-tv/dcl-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Connect your Decentraland scene to thestatic.tv - full channel lineup, metrics tracking, and interactions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://thestatic.tv",
|
|
45
45
|
"bugs": {
|
|
46
|
-
"url": "https://
|
|
46
|
+
"url": "https://thestatic.tv/support"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@dcl-sdk/utils": ">=1.0.0",
|
|
@@ -52,9 +52,15 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@dcl-sdk/utils": "^1.4.0",
|
|
54
54
|
"@dcl/sdk": "^7.0.0",
|
|
55
|
-
"@vitest/coverage-v8": "^4.
|
|
55
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
56
56
|
"tsup": "^8.0.0",
|
|
57
57
|
"typescript": "^5.0.0",
|
|
58
|
-
"vitest": "^4.
|
|
58
|
+
"vitest": "^4.1.11"
|
|
59
|
+
},
|
|
60
|
+
"overrides": {
|
|
61
|
+
"protobufjs": "^7.6.3",
|
|
62
|
+
"esbuild": "^0.28.1",
|
|
63
|
+
"ts-deepmerge": "^8.0.0",
|
|
64
|
+
"cookie": "^0.7.0"
|
|
59
65
|
}
|
|
60
66
|
}
|