Skip to content

Commit 33b7e01

Browse files
Merge pull request #6089 from decentraland/release/release-20240205
Release 20240212
2 parents c4af76b + e1e1f36 commit 33b7e01

File tree

16 files changed

+83
-70
lines changed

16 files changed

+83
-70
lines changed

browser-interface/packages/config/index.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,6 @@ export const QS_MAX_VISIBLE_PEERS =
8282
export const BUILDER_SERVER_URL =
8383
ensureSingleString(qs.get('BUILDER_SERVER_URL')) ?? 'https://builder-api.decentraland.org/v1'
8484

85-
const SSO_URL = ensureQueryStringUrl(qs.get('SSO_URL')) ?? 'https://id.decentraland.org'
86-
export function getSSOUrl() {
87-
const sso = new URL(SSO_URL)
88-
const ssoHost = sso.hostname.split('.').reverse()
89-
const currentHost = location.hostname.split('.').reverse()
90-
91-
// ensures the same top level domain for the SSO
92-
if (ssoHost[0] === currentHost[0] && ssoHost[1] === currentHost[1]) {
93-
return SSO_URL
94-
}
95-
96-
return null
97-
}
98-
9985
/**
10086
* Get the root URL and ensure not to end with slash
10187
* @returns Root URL with pathname where the index.html is served.

browser-interface/packages/entryPoints/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { ETHEREUM_NETWORK, HAS_INITIAL_POSITION_MARK, getSSOUrl } from 'config/index'
1+
import { ETHEREUM_NETWORK, HAS_INITIAL_POSITION_MARK } from 'config/index'
22
import { WebSocketProvider } from 'eth-connect'
33
import { IDecentralandKernel, IEthereumProvider, KernelOptions, KernelResult, LoginState } from '@dcl/kernel-interface'
4-
import * as SingleSignOn from '@dcl/single-sign-on-client'
54
import { getFromPersistentStorage, setPersistentStorage } from 'lib/browser/persistentStorage'
65
import { gridToWorld } from 'lib/decentraland/parcels/gridToWorld'
76
import { parseParcelPosition } from 'lib/decentraland/parcels/parseParcelPosition'
87
import { resolveBaseUrl } from 'lib/decentraland/url/resolveBaseUrl'
98
import { storeCondition } from 'lib/redux/storeCondition'
10-
import { defaultLogger } from 'lib/logger'
119
import { initShared } from 'shared'
1210
import { sendHomeScene } from 'shared/atlas/actions'
1311
import { homePointKey } from 'shared/atlas/utils'
@@ -33,15 +31,6 @@ import { isWebGLCompatible } from './validations'
3331
declare const globalThis: { DecentralandKernel: IDecentralandKernel }
3432
globalThis.DecentralandKernel = {
3533
async initKernel(options: KernelOptions): Promise<KernelResult> {
36-
try {
37-
let sso = getSSOUrl()
38-
if (sso) {
39-
SingleSignOn.init(sso)
40-
}
41-
} catch (err) {
42-
defaultLogger.error('Error initializing SingleSignOn', err)
43-
}
44-
4534
await setupBaseUrl(options)
4635

4736
ensureValidWebGLCanvasContainer(options)

browser-interface/packages/shared/catalogs/sagas.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,17 @@ function fetchOwnedEmotes(ethAddress: string, client: CatalystClient) {
262262
return client.fetchOwnedEmotes(ethAddress, true)
263263
}
264264

265+
export function urnWithoutToken(urn: string): string {
266+
const value = urn.split(':')
267+
if (value.length === 7) {
268+
return value.slice(0, 6).join(':')
269+
}
270+
return urn
271+
}
272+
265273
async function fetchWearablesByFilters(filters: WearablesRequestFilters, client: CatalystClient) {
266-
return client.fetchWearables(filters)
274+
const wearableIds = filters.wearableIds?.map(urnWithoutToken)
275+
return client.fetchWearables({ ...filters, wearableIds })
267276
}
268277

269278
async function fetchEmotesByFilters(filters: EmotesRequestFilters, client: CatalystClient) {

browser-interface/packages/shared/portableExperiences/reducer.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
REMOVE_SCENE_PX,
1010
SHUTDOWN_ALL_PORTABLE_EXPERIENCES
1111
} from './actions'
12+
import { REMOVE_DESIRED_PORTABLE_EXPERIENCE, RemoveDesiredPortableExperienceAction } from '../wearablesPortableExperience/actions'
1213

1314
const INITIAL_STATE: PortableExperiencesState = {
1415
deniedPortableExperiencesFromRenderer: [],
@@ -19,7 +20,7 @@ const INITIAL_STATE: PortableExperiencesState = {
1920

2021
export function portableExperienceReducer(
2122
state?: PortableExperiencesState,
22-
action?: PortableExperienceActions
23+
action?: PortableExperienceActions | RemoveDesiredPortableExperienceAction
2324
): PortableExperiencesState {
2425
if (!state) {
2526
return INITIAL_STATE
@@ -30,6 +31,14 @@ export function portableExperienceReducer(
3031
}
3132

3233
switch (action.type) {
34+
case REMOVE_DESIRED_PORTABLE_EXPERIENCE: {
35+
return {
36+
...state,
37+
deniedPortableExperiencesFromRenderer: state.deniedPortableExperiencesFromRenderer.filter(
38+
($) => $ !== action.payload.id
39+
)
40+
}
41+
}
3342
case SHUTDOWN_ALL_PORTABLE_EXPERIENCES: {
3443
return { ...state, globalPortalExperienceShutDown: true }
3544
}

browser-interface/packages/shared/session/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const deleteSession = async (userId?: string) => {
2626
if (userId) {
2727
await removeFromPersistentStorage(sessionKey(userId))
2828

29-
await SingleSignOn.clearIdentity(userId)
29+
SingleSignOn.localStorageClearIdentity(userId)
3030
}
3131
}
3232

@@ -56,7 +56,7 @@ async function getSessionWithSSOIdentity(sessions: StoredSession[]) {
5656

5757
const session = sessions[0]
5858

59-
const ssoIdentity = await SingleSignOn.getIdentity(session.identity.address)
59+
const ssoIdentity = SingleSignOn.localStorageGetIdentity(session.identity.address)
6060

6161
if (!ssoIdentity || isSessionExpired({ identity: ssoIdentity })) {
6262
return null

browser-interface/packages/shared/session/sagas.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ async function createAuthIdentity(requestManager: RequestManager, isGuest: boole
319319

320320
let auth: AuthIdentity
321321

322-
const ssoIdentity = await SingleSignOn.getIdentity(address)
322+
const ssoIdentity = SingleSignOn.localStorageGetIdentity(address)
323323

324324
if (!ssoIdentity || isSessionExpired({ identity: ssoIdentity })) {
325325
auth = await Authenticator.initializeAuthChain(address, ephemeral, ephemeralLifespanMinutes, signer)
326326

327-
await SingleSignOn.storeIdentity(address, auth)
327+
SingleSignOn.localStorageStoreIdentity(address, auth)
328328
} else {
329329
auth = ssoIdentity
330330
}
@@ -337,14 +337,12 @@ function* logout() {
337337
const network: ETHEREUM_NETWORK = yield select(getSelectedNetwork)
338338
if (identity && identity.address && network) {
339339
yield call(() => localProfilesRepo.remove(identity.address, network))
340+
yield call(deleteSession, identity.address)
340341
globalObservable.emit('logout', { address: identity.address, network })
341342
}
342343

343344
yield put(setRoomConnection(undefined))
344345

345-
if (identity?.address) {
346-
yield call(deleteSession, identity.address)
347-
}
348346
window.location.reload()
349347
}
350348

browser-interface/packages/shared/wearablesPortableExperience/sagas.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
} from './actions'
2121
import { waitForRealm } from 'shared/realm/waitForRealmAdapter'
2222
import { KeyAndHash } from '../catalogs/types'
23+
import { urnWithoutToken } from '../catalogs/sagas'
2324

2425
export function* wearablesPortableExperienceSaga(): any {
2526
yield takeLatest(PROFILE_SUCCESS, handleSelfProfileSuccess)
@@ -29,13 +30,12 @@ export function* wearablesPortableExperienceSaga(): any {
2930

3031
function* handleSelfProfileSuccess(action: ProfileSuccessAction): any {
3132
const isMyProfile: boolean = yield select(isCurrentUserId, action.payload.profile.userId)
32-
3333
// cancel the saga if we receive a profile from a different user
3434
if (!isMyProfile) {
3535
return
3636
}
3737

38-
const newProfileWearables = action.payload.profile.avatar?.wearables || []
38+
const newProfileWearables = action.payload.profile.avatar?.wearables.map(urnWithoutToken) || []
3939
const currentDesiredPortableExperiences: Record<string, LoadableScene | null> = yield select(
4040
getDesiredWearablePortableExpriences
4141
)
@@ -69,9 +69,9 @@ function* handleProcessWearables(action: ProcessWearablesAction) {
6969
const currentDesiredPortableExperiences: Record<string, LoadableScene | null> = yield select(
7070
getDesiredWearablePortableExpriences
7171
)
72-
73-
if (payload.wearable.id in currentDesiredPortableExperiences) {
74-
yield put(addDesiredPortableExperience(payload.wearable.id, payload.wearable))
72+
const wearableId = urnWithoutToken(payload.wearable.id)
73+
if (wearableId in currentDesiredPortableExperiences) {
74+
yield put(addDesiredPortableExperience(wearableId, payload.wearable))
7575
}
7676
}
7777

@@ -150,7 +150,7 @@ export async function wearableToSceneEntity(wearable: WearableV2, defaultBaseUrl
150150
const metadata: Scene = sceneJson ? await jsonFetch(baseUrl + sceneJson.hash) : defaultSceneJson()
151151

152152
return {
153-
id: wearable.id,
153+
id: urnWithoutToken(wearable.id),
154154
baseUrl,
155155
parentCid: 'avatar',
156156
entity: {

browser-interface/packages/shared/world/runtime-7/engine.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export function createInternalEngine(id: string, parcels: string[], isGlobalScen
7878

7979
if (entityId >= AVATAR_RESERVED_ENTITIES.to) {
8080
engine.removeEntity(entity)
81-
console.error(`[BOEDO] Max amount of users reached`, entityId)
8281
return
8382
}
8483
PlayerIdentityData.create(entity, { address: userId, isGuest: profile.isGuest })
@@ -115,7 +114,6 @@ export function createInternalEngine(id: string, parcels: string[], isGlobalScen
115114
const entity = avatarMap.get(userId)
116115

117116
if (!entity) {
118-
console.error(`[BOEDO] user not found !`, { userId })
119117
return addUser(userId)
120118
}
121119

unity-renderer/Assets/DCLPlugins/ExperiencesViewer/Scripts/ExperiencesViewerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private void DisableOrEnablePortableExperience(string pexId, bool isPlaying)
117117

118118
view.ShowEnabledToast(scene?.GetSceneName());
119119
}
120-
else
120+
else if (scene != null)
121121
{
122122
portableExperiencesBridge.SetDisabledPortableExperiences(disabledPortableExperiences.GetKeys()
123123
.Concat(new[] { pexId })

unity-renderer/Assets/DCLServices/EmotesService/Domain/IEmotesService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ namespace DCL.Emotes
55
{
66
public interface IEmotesService : IService
77
{
8-
UniTask<IEmoteReference> RequestEmote(EmoteBodyId emoteBodyId, CancellationToken cancellationToken);
8+
UniTask<IEmoteReference> RequestEmote(EmoteBodyId emoteBodyId, CancellationToken cancellationToken, string contentUrl = null);
99
}
1010
}

0 commit comments

Comments
 (0)