Skip to content

Commit 474ae12

Browse files
Merge pull request #6259 from decentraland/release/release20241203
Release: 20241203
2 parents 9b4bdea + eebd86e commit 474ae12

File tree

10 files changed

+65
-31
lines changed

10 files changed

+65
-31
lines changed

browser-interface/packages/shared/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ export type KernelConfigForRenderer = {
606606
kernelVersion: string
607607
rendererVersion: string
608608
avatarTextureAPIBaseUrl: string
609-
urlParamsForWearablesDebug: boolean // temporal field until the whole the wearables catalog sagas flow is migrated to Unity
609+
urlParamsForWearablesDebug: boolean, // temporal field until the whole the wearables catalog sagas flow is migrated to Unity
610+
builderUrl: string
610611
}
611612

612613
export type RealmsInfoForRenderer = {

browser-interface/packages/unity-interface/kernelConfigForRenderer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
PREVIEW,
99
DEBUG,
1010
getTLD,
11-
ETHEREUM_NETWORK
11+
ETHEREUM_NETWORK, BUILDER_SERVER_URL
1212
} from 'config'
1313
import { nameValidCharacterRegex, nameValidRegex } from 'lib/decentraland/profiles/names'
1414
import { getWorld } from '@dcl/schemas'
@@ -31,6 +31,7 @@ export function kernelConfigForRenderer(): KernelConfigForRenderer {
3131
PREVIEW || ((DEBUG || getTLD() !== 'org') && network !== ETHEREUM_NETWORK.MAINNET)
3232

3333
const urlParamsForWearablesDebug = !!(WITH_FIXED_ITEMS || WITH_FIXED_COLLECTIONS || COLLECTIONS_OR_ITEMS_ALLOWED)
34+
const builderUrl = BUILDER_SERVER_URL;
3435

3536
return {
3637
...globalState.meta.config.world,
@@ -54,6 +55,7 @@ export function kernelConfigForRenderer(): KernelConfigForRenderer {
5455
/** @deprecated */
5556
rendererVersion: explorerVersion,
5657
avatarTextureAPIBaseUrl: getAvatarTextureAPIBaseUrl(getSelectedNetwork(globalState)),
57-
urlParamsForWearablesDebug: urlParamsForWearablesDebug
58+
urlParamsForWearablesDebug: urlParamsForWearablesDebug,
59+
builderUrl: builderUrl
5860
}
5961
}

unity-renderer/Assets/DCLServices/EmotesCatalog/EmotesCatalogService/LambdasEmotesCatalogService.cs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ private class EmoteCollectionResponse
3737
private readonly ICatalyst catalyst;
3838
private readonly ILambdasService lambdasService;
3939
private readonly DataStore dataStore;
40+
private readonly KernelConfig kernelConfig;
4041
private readonly Dictionary<string, string> ownedUrns = new (new Dictionary<string, string>(), StringIgnoreCaseEqualityComparer.Default);
4142

4243
private EmbeddedEmotesSO embeddedEmotesSo;
@@ -49,13 +50,15 @@ public LambdasEmotesCatalogService(IEmotesRequestSource emoteSource,
4950
IAddressableResourceProvider addressableResourceProvider,
5051
ICatalyst catalyst,
5152
ILambdasService lambdasService,
52-
DataStore dataStore)
53+
DataStore dataStore,
54+
KernelConfig kernelConfig)
5355
{
5456
this.emoteSource = emoteSource;
5557
this.addressableResourceProvider = addressableResourceProvider;
5658
this.catalyst = catalyst;
5759
this.lambdasService = lambdasService;
5860
this.dataStore = dataStore;
61+
this.kernelConfig = kernelConfig;
5962
}
6063

6164
private async UniTaskVoid InitializeAsyncEmbeddedEmotes()
@@ -108,21 +111,22 @@ public bool TryGetLoadedEmote(string id, out WearableItem emote)
108111

109112
public async UniTask<WearableItem> RequestEmoteFromBuilderAsync(string emoteId, CancellationToken cancellationToken)
110113
{
111-
const string TEMPLATE_URL = "https://builder-api.decentraland.org/v1/items/:emoteId/";
112-
string url = TEMPLATE_URL.Replace(":emoteId", emoteId);
114+
string domain = GetBuilderDomainUrl();
115+
string url = $"{domain}/items/{emoteId}/";
116+
string templateUrl = $"{domain}/items/{emoteId}/";
113117

114118
try
115119
{
116120
(WearableItemResponseFromBuilder response, bool success) = await lambdasService.GetFromSpecificUrl<WearableItemResponseFromBuilder>(
117-
TEMPLATE_URL, url,
121+
templateUrl, url,
118122
isSigned: true,
119123
cancellationToken: cancellationToken);
120124

121125
if (!success)
122126
throw new Exception($"The request of wearables from builder '{emoteId}' failed!");
123127

124128
WearableItem wearable = response.data.ToWearableItem(
125-
"https://builder-api.decentraland.org/v1/storage/contents/",
129+
$"{domain}/storage/contents/",
126130
assetBundlesUrl);
127131

128132
if (!wearable.IsEmote()) return null;
@@ -348,8 +352,7 @@ public async UniTask<EmbeddedEmotesSO> GetEmbeddedEmotes()
348352
public async UniTask<IReadOnlyList<WearableItem>> RequestEmoteCollectionInBuilderAsync(IEnumerable<string> collectionIds,
349353
CancellationToken cancellationToken, List<WearableItem> emoteBuffer = null)
350354
{
351-
const string TEMPLATE_URL = "https://builder-api.decentraland.org/v1/collections/:collectionId/items/";
352-
355+
string domain = GetBuilderDomainUrl();
353356
var emotes = emoteBuffer ?? new List<WearableItem>();
354357

355358
var queryParams = new[]
@@ -360,10 +363,11 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestEmoteCollectionInBuilde
360363

361364
foreach (string collectionId in collectionIds)
362365
{
363-
string url = TEMPLATE_URL.Replace(":collectionId", collectionId);
366+
var url = $"{domain}/collections/{collectionId}";
367+
var templateUrl = $"{domain}/collections/:collectionId/items/";
364368

365369
(WearableCollectionResponseFromBuilder response, bool success) = await lambdasService.GetFromSpecificUrl<WearableCollectionResponseFromBuilder>(
366-
TEMPLATE_URL, url,
370+
templateUrl, url,
367371
cancellationToken: cancellationToken,
368372
isSigned: true,
369373
urlEncodedParams: queryParams);
@@ -373,7 +377,7 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestEmoteCollectionInBuilde
373377

374378
foreach (BuilderWearable bw in response.data.results)
375379
{
376-
var wearable = bw.ToWearableItem("https://builder-api.decentraland.org/v1/storage/contents/",
380+
var wearable = bw.ToWearableItem($"{domain}/storage/contents/",
377381
assetBundlesUrl);
378382
if (!wearable.IsEmote()) continue;
379383
emotes.Add(wearable);
@@ -460,4 +464,13 @@ private void EmbedEmotes()
460464
emotesOnUse[embeddedEmote.id] = 5000;
461465
}
462466
}
467+
468+
private string GetBuilderDomainUrl()
469+
{
470+
string domain = kernelConfig.Get().builderUrl;
471+
472+
if (string.IsNullOrEmpty(domain))
473+
domain = "https://builder-api.decentraland.org/v1";
474+
return domain;
475+
}
463476
}

unity-renderer/Assets/DCLServices/EmotesCatalog/Tests/EmotesCatalogServiceShould.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void SetUp()
2727
IAddressableResourceProvider addressableResourceProvider = Substitute.For<IAddressableResourceProvider>();
2828
addressableResourceProvider.GetAddressable<EmbeddedEmotesSO>(Arg.Any<string>(), Arg.Any<CancellationToken>()).Returns(GetEmbeddedEmotesSO());
2929
catalog = new LambdasEmotesCatalogService(emotesRequestSource, addressableResourceProvider, Substitute.For<ICatalyst>(),
30-
Substitute.For<ILambdasService>(), new DataStore());
30+
Substitute.For<ILambdasService>(), new DataStore(), KernelConfig.i);
3131
catalog.Initialize();
3232
}
3333

@@ -342,7 +342,7 @@ public void EmbedEmotes()
342342
IAddressableResourceProvider addressableResourceProvider = Substitute.For<IAddressableResourceProvider>();
343343
addressableResourceProvider.GetAddressable<EmbeddedEmotesSO>(Arg.Any<string>(), Arg.Any<CancellationToken>()).Returns(GetExampleEmbeddedEmotesSO());
344344
catalog = new LambdasEmotesCatalogService(Substitute.For<IEmotesRequestSource>(), addressableResourceProvider,
345-
Substitute.For<ICatalyst>(), Substitute.For<ILambdasService>(), new DataStore());
345+
Substitute.For<ICatalyst>(), Substitute.For<ILambdasService>(), new DataStore(), KernelConfig.i);
346346
catalog.Initialize();
347347

348348
Assert.AreEqual(catalog.emotes["id1"], embededEmotes[0]);

unity-renderer/Assets/DCLServices/EmotesCatalog/Tests/EmotesCatalogTests.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"GUID:68069f49d86442cd9618861b4d74b1aa",
1515
"GUID:dffbb581f2650ea4990781f603ac258a",
1616
"GUID:a4bf61c057a098f4ca05b539a6d8c0fe",
17-
"GUID:28f74c468a54948bfa9f625c5d428f56"
17+
"GUID:28f74c468a54948bfa9f625c5d428f56",
18+
"GUID:c44f6fd10d3d94432a107d581e0096b5"
1819
],
1920
"includePlatforms": [],
2021
"excludePlatforms": [],

unity-renderer/Assets/DCLServices/WearablesCatalogService/LambdasWearablesCatalogService.cs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public WearableCollectionResponse(EntityDto[] entities)
5353
private readonly List<string> pendingWearablesToRequest = new ();
5454
private readonly BaseVariable<FeatureFlag> featureFlags;
5555
private readonly DataStore dataStore;
56+
private readonly KernelConfig kernelConfig;
5657
private readonly ICatalyst catalyst;
5758

5859
private string assetBundlesUrl => featureFlags.Get().IsFeatureEnabled("ab-new-cdn") ? "https://ab-cdn.decentraland.org/" : "https://content-assets-as-bundle.decentraland.org/";
@@ -64,10 +65,12 @@ public LambdasWearablesCatalogService(BaseDictionary<string, WearableItem> weara
6465
ILambdasService lambdasService,
6566
IServiceProviders serviceProviders,
6667
BaseVariable<FeatureFlag> featureFlags,
67-
DataStore dataStore)
68+
DataStore dataStore,
69+
KernelConfig kernelConfig)
6870
{
6971
this.featureFlags = featureFlags;
7072
this.dataStore = dataStore;
73+
this.kernelConfig = kernelConfig;
7174
this.lambdasService = lambdasService;
7275
WearablesCatalog = wearablesCatalog;
7376
catalyst = serviceProviders.catalyst;
@@ -285,11 +288,11 @@ public async UniTask<WearableItem> RequestWearableFromBuilderAsync(string wearab
285288
return wearable;
286289
}
287290

288-
const string TEMPLATE_URL = "https://builder-api.decentraland.org/v1/items/:wearableId/";
289-
string url = TEMPLATE_URL.Replace(":wearableId", wearableId);
291+
string domain = GetBuilderDomainUrl();
292+
var url = $"{domain}/items/{wearableId}";
290293

291294
(WearableItemResponseFromBuilder response, bool success) = await lambdasService.GetFromSpecificUrl<WearableItemResponseFromBuilder>(
292-
TEMPLATE_URL, url,
295+
domain, url,
293296
isSigned: true,
294297
cancellationToken: ct);
295298

@@ -299,7 +302,7 @@ public async UniTask<WearableItem> RequestWearableFromBuilderAsync(string wearab
299302
List<WearableItem> ws = new List<WearableItem>
300303
{
301304
response.data.ToWearableItem(
302-
"https://builder-api.decentraland.org/v1/storage/contents/",
305+
$"{domain}/storage/contents/",
303306
assetBundlesUrl),
304307
};
305308

@@ -346,8 +349,7 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollection(IEnu
346349
public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBuilder(IEnumerable<string> collectionIds,
347350
CancellationToken cancellationToken, List<WearableItem> collectionBuffer = null)
348351
{
349-
const string TEMPLATE_URL = "https://builder-api.decentraland.org/v1/collections/:collectionId/items/";
350-
352+
string domain = GetBuilderDomainUrl();
351353
var wearables = collectionBuffer ?? new List<WearableItem>();
352354

353355
var queryParams = new[]
@@ -358,10 +360,11 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBui
358360

359361
foreach (string collectionId in collectionIds)
360362
{
361-
string url = TEMPLATE_URL.Replace(":collectionId", collectionId);
363+
var url = $"{domain}/collections/{collectionId}/items/";
364+
var templateUrl = $"{domain}/collections/:collectionId/items/";
362365

363366
(WearableCollectionResponseFromBuilder response, bool success) = await lambdasService.GetFromSpecificUrl<WearableCollectionResponseFromBuilder>(
364-
TEMPLATE_URL, url,
367+
templateUrl, url,
365368
isSigned: true,
366369
urlEncodedParams: queryParams,
367370
cancellationToken: cancellationToken);
@@ -371,7 +374,7 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBui
371374

372375
List<WearableItem> ws = response.data.results
373376
.Select(bw => bw.ToWearableItem(
374-
"https://builder-api.decentraland.org/v1/storage/contents/",
377+
$"{domain}/storage/contents/",
375378
assetBundlesUrl))
376379
.Where(bw => !bw.IsEmote())
377380
.ToList();
@@ -701,5 +704,14 @@ private bool IsInvalidWearable(EntityDto.MetadataDto metadata)
701704

702705
private bool IsLocalPreview() =>
703706
dataStore.realm.playerRealm.Get()?.serverName?.Equals("LocalPreview", StringComparison.OrdinalIgnoreCase) ?? false;
707+
708+
private string GetBuilderDomainUrl()
709+
{
710+
string domain = kernelConfig.Get().builderUrl;
711+
712+
if (string.IsNullOrEmpty(domain))
713+
domain = "https://builder-api.decentraland.org/v1";
714+
return domain;
715+
}
704716
}
705717
}

unity-renderer/Assets/DCLServices/WearablesCatalogService/Tests/LambdasWearablesCatalogServiceShould.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void SetUp()
7070

7171
BaseVariable<FeatureFlag> featureFlags = new BaseVariable<FeatureFlag>();
7272
featureFlags.Set(new FeatureFlag());
73-
service = new LambdasWearablesCatalogService(initialCatalog, lambdasService, serviceProviders, featureFlags, new DataStore());
73+
service = new LambdasWearablesCatalogService(initialCatalog, lambdasService, serviceProviders, featureFlags, new DataStore(), KernelConfig.i);
7474
service.Initialize();
7575
}
7676

unity-renderer/Assets/DCLServices/WearablesCatalogService/Tests/WarablesCatalogServiceTests.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"CatalystInterfaces",
1515
"FeatureFlagData",
1616
"Utils",
17-
"DataStore"
17+
"DataStore",
18+
"KernelConfiguration"
1819
],
1920
"includePlatforms": [],
2021
"excludePlatforms": [],

unity-renderer/Assets/Scripts/MainScripts/DCL/Environment/Factories/ServiceLocatorFactory/ServiceLocatorFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static ServiceLocator CreateDefault()
133133
featureFlagsDataStore);
134134

135135
var lambdasEmotesCatalogService = new LambdasEmotesCatalogService(emotesRequest, addressableResourceProvider,
136-
result.Get<IServiceProviders>().catalyst, result.Get<ILambdasService>(), DataStore.i);
136+
result.Get<IServiceProviders>().catalyst, result.Get<ILambdasService>(), DataStore.i, KernelConfig.i);
137137
var webInterfaceEmotesCatalogService = new WebInterfaceEmotesCatalogService(EmotesCatalogBridge.GetOrCreate(), addressableResourceProvider);
138138
return new EmotesCatalogServiceProxy(lambdasEmotesCatalogService, webInterfaceEmotesCatalogService, featureFlagsDataStore, KernelConfig.i);
139139
});
@@ -149,7 +149,8 @@ public static ServiceLocator CreateDefault()
149149
result.Get<ILambdasService>(),
150150
result.Get<IServiceProviders>(),
151151
featureFlagsDataStore,
152-
DataStore.i),
152+
DataStore.i,
153+
KernelConfig.i),
153154
WebInterfaceWearablesCatalogService.Instance,
154155
DataStore.i.common.wearables,
155156
KernelConfig.i,

unity-renderer/Assets/Scripts/MainScripts/DCL/KernelConfiguration/KernelConfigModel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class KernelConfigModel
2121
public ProceduralSkybox proceduralSkyboxConfig = new ProceduralSkybox();
2222
public string avatarTextureAPIBaseUrl = string.Empty;
2323
public bool urlParamsForWearablesDebug = false;
24+
public string builderUrl = string.Empty;
2425

2526
public override bool Equals(object obj) { return obj is KernelConfigModel other && Equals(other); }
2627

@@ -48,7 +49,8 @@ public bool Equals(KernelConfigModel other)
4849
&& debugConfig.Equals(other.debugConfig)
4950
&& proceduralSkyboxConfig.Equals(other.proceduralSkyboxConfig)
5051
&& avatarTextureAPIBaseUrl == other.avatarTextureAPIBaseUrl
51-
&& urlParamsForWearablesDebug == other.urlParamsForWearablesDebug;
52+
&& urlParamsForWearablesDebug == other.urlParamsForWearablesDebug
53+
&& builderUrl == other.builderUrl;
5254
}
5355

5456
public string GetTld() =>
@@ -70,6 +72,7 @@ public KernelConfigModel Clone()
7072
clone.proceduralSkyboxConfig = proceduralSkyboxConfig.Clone();
7173
clone.avatarTextureAPIBaseUrl = avatarTextureAPIBaseUrl;
7274
clone.urlParamsForWearablesDebug = urlParamsForWearablesDebug;
75+
clone.builderUrl = builderUrl;
7376
return clone;
7477
}
7578
}

0 commit comments

Comments
 (0)