Skip to content

Commit ba7bf26

Browse files
davidejensengonpombo8fzavaliapbosiom3taphysics
authored
Release 2023 08 14 (#5582)
* bump scene-runtime. Fix sdk sourcemaps (#5554) * feat: Integrate single sign on (#5548) * feat: Integrate single sign on * fix: Update client * fix: Update client * fix: Update single sign on client * fix: Update client * feat: Update sso client * feat: Update sso client * feat: Sso url by query param * fix: Update package * fix: add `sourceType` property to `getActiveVideoStreams` response (#5571) * fix: Update sso client (#5570) * fix: removed link escaping when sending to kernel (#5568) * Reduce the transaction amount again (#5578) * Feat: camera reel polishing (#5544) ## What does this PR change? This PR polishes CameraReel and Screencapture features (for the InWorld Camera initiative). It includes major refactoring of both components. On screencapture side - Cinemachine was introduced in Camera movement logic - Screenshot capturing HDR fixed, but with heavy texture upsacle, crop and resize operations - Name tags added also to Avatar On Camera Reel (Gallery) there were a lot of refactoring and polishing, adding transition and missing logic - Metrics were also added ## How to test the changes? You can follow this page to check all requirements https://www.notion.so/decentraland/In-World-Camera-736683ff6b2d4532ad71c873f7de522d - ScreenCapture 1. Launch the explorer 2. Open screencapture camera by button below minimap or via keyboard C 3. Position camera by moving it (see shortcuts in the bottom-left). Check that you cannot pass through colliders and that you cannot go super far away (it should be bounded by sphere around of the player ~16 meters) 4. Check that all buttons in this view are functional - you can take close it, show/hide shortcut panel, take screenshot (animation should be there with SFX), and open CameraRell - CameraReel Gallery 1. Open Gallery via shortcut K or in the ExploreMenu 2. Check sorting of the images and that new pictures added as first (at the top-left). 3. Check that you can delete/copy link/share twitter from the 3 dots on each picture 4. Check that downloaded resolution of pictures is 1920x1080 no matter what resolutions was your screen - CameraReel Screenshot Viewer 1. Open one screenshot from the Gallery by clicking on it 2. Verify that you can see persons and wearables info on the ride panel 3. Verify that you can jump to a place by clicking on the Scene button in the right panel 4. Veriy that you can open Marketplace by clicking on the Wearables from the list * chore: bumping schema versions and fixing test (#5581) Co-authored-by: Agustina Aldasoro <agusaldasoro@users.noreply.github.com> * Hotfix: Swap C and H as a new shortcut for control panel (#5586) Changed UI representation from C to H for both tutorial and Controls screen * Hotfix: disable CameraReel for guests users (#5585) disable CameraReel for guests users * Hotfix: first person vie screenshot camera stuck and jump/run animation freeze (#5588) * enter 3rd person view on enabling screenshot camera * fix avatar freeze in animation * set flag for the transition --------- Co-authored-by: Gon Pombo <gonzalo@decentraland.org> Co-authored-by: Fernando Zavalia <24811313+fzavalia@users.noreply.github.com> Co-authored-by: pbosio <pato@decentraland.org> Co-authored-by: Ashley Canning <ashley.canning@decentraland.org> Co-authored-by: Vitaly Popuzin <35366872+popuz@users.noreply.github.com> Co-authored-by: Miguel Oliva <moliva@users.noreply.github.com> Co-authored-by: Agustina Aldasoro <agusaldasoro@users.noreply.github.com> Co-authored-by: D-Fabio <10808443+0xD-Fabio@users.noreply.github.com>
1 parent 90c102a commit ba7bf26

File tree

222 files changed

+19532
-10271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+19532
-10271
lines changed

browser-interface/package-lock.json

Lines changed: 52 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

browser-interface/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@
6262
"@dcl/hashing": "^1.1.3",
6363
"@dcl/kernel-interface": "^2.0.0-20230512115658.commit-b582e05",
6464
"@dcl/legacy-ecs": "^6.11.11",
65-
"@dcl/protocol": "^1.0.0-5752058730.commit-921fc5d",
65+
"@dcl/protocol": "^1.0.0-5812097343.commit-8025576",
6666
"@dcl/rpc": "^1.1.1",
67-
"@dcl/scene-runtime": "7.0.6-20230803143954.commit-ad6c961",
68-
"@dcl/schemas": "^7.4.1",
67+
"@dcl/scene-runtime": "7.0.6-20230809174058.commit-2408927",
68+
"@dcl/schemas": "^9.1.1",
69+
"@dcl/single-sign-on-client": "^0.0.12",
6970
"@dcl/urn-resolver": "^2.2.0",
7071
"@types/mocha": "^10.0.1",
7172
"@types/redux-logger": "^3.0.9",

browser-interface/packages/config/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export const QS_MAX_VISIBLE_PEERS =
7575
export const BUILDER_SERVER_URL =
7676
ensureSingleString(qs.get('BUILDER_SERVER_URL')) ?? 'https://builder-api.decentraland.org/v1'
7777

78+
export const SSO_URL = ensureSingleString(qs.get('SSO_URL')) ?? 'https://id.decentraland.org'
79+
7880
/**
7981
* Get the root URL and ensure not to end with slash
8082
* @returns Root URL with pathname where the index.html is served.

browser-interface/packages/entryPoints/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { ETHEREUM_NETWORK, HAS_INITIAL_POSITION_MARK } from 'config/index'
1+
import { ETHEREUM_NETWORK, HAS_INITIAL_POSITION_MARK, SSO_URL } 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'
45
import { getFromPersistentStorage, setPersistentStorage } from 'lib/browser/persistentStorage'
56
import { gridToWorld } from 'lib/decentraland/parcels/gridToWorld'
67
import { parseParcelPosition } from 'lib/decentraland/parcels/parseParcelPosition'
@@ -31,6 +32,8 @@ import { isWebGLCompatible } from './validations'
3132
declare const globalThis: { DecentralandKernel: IDecentralandKernel }
3233
globalThis.DecentralandKernel = {
3334
async initKernel(options: KernelOptions): Promise<KernelResult> {
35+
SingleSignOn.init(SSO_URL)
36+
3437
await setupBaseUrl(options)
3538

3639
ensureValidWebGLCanvasContainer(options)

browser-interface/packages/shared/apis/host/CommsAPI.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
import type { RpcServerPort } from '@dcl/rpc'
22
import * as codegen from '@dcl/rpc/dist/codegen'
33
import type { PortContext } from './context'
4-
import { VideoTracksActiveStreamsRequest, VideoTracksActiveStreamsData, CommsApiServiceDefinition } from 'shared/protocol/decentraland/kernel/apis/comms_api.gen'
4+
import { VideoTracksActiveStreamsRequest, VideoTracksActiveStreamsData, CommsApiServiceDefinition, VideoTrackSourceType } from 'shared/protocol/decentraland/kernel/apis/comms_api.gen'
55
import { isWorldLoaderActive } from 'shared/realm/selectors'
66
import { store } from 'shared/store/isolatedStore'
77
import { getLivekitActiveVideoStreams } from 'shared/comms/selectors'
88
import { ensureRealmAdapter } from 'shared/realm/ensureRealmAdapter'
99
import { ActiveVideoStreams } from 'shared/comms/adapters/types'
10+
import { Track } from 'livekit-client'
1011

1112
export function registerCommsApiServiceServerImplementation(port: RpcServerPort<PortContext>) {
1213
codegen.registerService(port, CommsApiServiceDefinition, async () => ({
1314
async getActiveVideoStreams(req: VideoTracksActiveStreamsRequest, ctx: PortContext) {
1415

1516
const realmAdapter = await ensureRealmAdapter()
1617
const isWorld = isWorldLoaderActive(realmAdapter)
17-
if (!isWorld){
18+
if (!isWorld) {
1819
ctx.logger.error('API only available for Worlds')
1920
return { streams: [] }
2021
}
2122

22-
// TODO: scene permissions?
2323
const activeVideoStreams: Map<string, ActiveVideoStreams> | undefined = getLivekitActiveVideoStreams(store.getState())
2424

2525
if (!activeVideoStreams)
2626
return { streams: [] }
2727

2828
let streams: VideoTracksActiveStreamsData[] = []
2929

30-
for (let [sid, videoStreamData] of activeVideoStreams) {
30+
for (const [sid, videoStreamData] of activeVideoStreams) {
3131
if (videoStreamData.videoTracks.size > 0) {
32-
for (let [videoSid, _] of videoStreamData.videoTracks) {
33-
streams.push({
34-
identity: videoStreamData.identity,
35-
trackSid: `livekit-video://${sid}/${videoSid}`
36-
})
32+
for (const [videoSid, trackData] of videoStreamData.videoTracks) {
33+
if (!!trackData.source) {
34+
streams.push({
35+
identity: videoStreamData.identity,
36+
trackSid: `livekit-video://${sid}/${videoSid}`,
37+
sourceType: trackData.source === Track.Source.Camera ? VideoTrackSourceType.VTST_CAMERA
38+
: trackData.source === Track.Source.ScreenShare ? VideoTrackSourceType.VTST_SCREEN_SHARE
39+
: VideoTrackSourceType.VTST_UNKNOWN
40+
})
41+
}
3742
}
3843
}
3944
}

browser-interface/packages/shared/comms/adapters/LivekitAdapter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
Participant,
88
RemoteParticipant,
99
Room,
10-
RoomEvent
10+
RoomEvent,
11+
Track
1112
} from 'livekit-client'
1213
import mitt from 'mitt'
1314
import { trackEvent } from 'shared/analytics/trackEvent'
@@ -149,10 +150,10 @@ export class LivekitAdapter implements MinimumCommunicationsAdapter {
149150

150151
for (const [sid, participant] of participants) {
151152
if (participant.videoTracks.size > 0) {
152-
const participantTracks = new Map<string, MediaStream>()
153+
const participantTracks = new Map<string, Track>()
153154
for (const [videoSid, track] of participant.videoTracks) {
154155
if (track.videoTrack?.mediaStream) {
155-
participantTracks.set(videoSid, track.videoTrack.mediaStream)
156+
participantTracks.set(videoSid, track.videoTrack)
156157
}
157158
}
158159
result.set(sid, { identity: participant.identity, videoTracks: participantTracks })

browser-interface/packages/shared/comms/adapters/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Emitter } from 'mitt'
22
import { VoiceHandler } from 'shared/voiceChat/VoiceHandler'
3+
import { Track } from 'livekit-client'
34

45
export interface MinimumCommunicationsAdapter {
56
/**
@@ -63,5 +64,5 @@ export type AdapterMessageEvent = {
6364

6465
export type ActiveVideoStreams = {
6566
identity: string
66-
videoTracks: Map<string, MediaStream>
67+
videoTracks: Map<string, Track>
6768
}

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as SingleSignOn from '@dcl/single-sign-on-client'
12
import {
23
getFromPersistentStorage,
34
getKeysFromPersistentStorage,
@@ -23,6 +24,8 @@ export const storeSession: (session: StoredSession) => Promise<void> = async (se
2324
export const deleteSession = async (userId?: string) => {
2425
if (userId) {
2526
await removeFromPersistentStorage(sessionKey(userId))
27+
28+
await SingleSignOn.clearIdentity(userId)
2629
}
2730
}
2831

@@ -32,18 +35,35 @@ export const deleteSession = async (userId?: string) => {
3235
export const retrieveLastSessionByAddress: (address: string) => Promise<StoredSession | null> = async (
3336
address: string
3437
) => {
35-
const sessions = (await retrieveAllCurrentSessions()).filter(withAddress(address))
36-
37-
return sessions.length > 0 ? sessions[0] : null
38+
return getSessionWithSSOIdentity((await retrieveAllCurrentSessions()).filter(withAddress(address)))
3839
}
3940

4041
/**
4142
* Retrieve the last session stored that is a guest session
4243
*/
4344
export const retrieveLastGuestSession: () => Promise<StoredSession | null> = async () => {
44-
const sessions = (await retrieveAllCurrentSessions()).filter(isGuest).sort(byExpiration)
45+
return getSessionWithSSOIdentity((await retrieveAllCurrentSessions()).filter(isGuest).sort(byExpiration))
46+
}
47+
48+
/**
49+
* From a list of sessions return the first one with the SSO identity
50+
*/
51+
async function getSessionWithSSOIdentity(sessions: StoredSession[]) {
52+
if (!sessions.length) {
53+
return null
54+
}
55+
56+
const session = sessions[0]
57+
58+
const ssoIdentity = await SingleSignOn.getIdentity(session.identity.address)
59+
60+
if (!ssoIdentity) {
61+
return null
62+
}
63+
64+
session.identity = { ...session.identity, ...ssoIdentity }
4565

46-
return sessions.length > 0 ? sessions[0] : null
66+
return session
4767
}
4868

4969
/**

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Authenticator } from '@dcl/crypto'
1+
import { AuthIdentity, Authenticator } from '@dcl/crypto'
22
import { createUnsafeIdentity } from '@dcl/crypto/dist/crypto'
3+
import * as SingleSignOn from '@dcl/single-sign-on-client'
34
import {
45
DEBUG_KERNEL_LOG,
56
ETHEREUM_NETWORK,
@@ -316,7 +317,17 @@ async function createAuthIdentity(requestManager: RequestManager, isGuest: boole
316317

317318
const { address, signer, hasConnectedWeb3, ephemeralLifespanMinutes } = await getSigner(requestManager, isGuest)
318319

319-
const auth = await Authenticator.initializeAuthChain(address, ephemeral, ephemeralLifespanMinutes, signer)
320+
let auth: AuthIdentity
321+
322+
const ssoIdentity = await SingleSignOn.getIdentity(address)
323+
324+
if (!ssoIdentity) {
325+
auth = await Authenticator.initializeAuthChain(address, ephemeral, ephemeralLifespanMinutes, signer)
326+
327+
await SingleSignOn.storeIdentity(address, auth)
328+
} else {
329+
auth = ssoIdentity
330+
}
320331

321332
return { ...auth, rawAddress: address, address: address.toLowerCase(), hasConnectedWeb3 }
322333
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async function initializeWebRenderer(options: RendererOptions): Promise<Decentra
149149
const videoSid = split[split.length - 1]
150150
const participantSid = split[split.length - 2]
151151
const activeVideoStreams: Map<string, ActiveVideoStreams> | undefined = getLivekitActiveVideoStreams(store.getState())
152-
return activeVideoStreams?.get(participantSid)?.videoTracks.get(videoSid)
152+
return activeVideoStreams?.get(participantSid)?.videoTracks.get(videoSid)?.mediaStream
153153
}
154154
}
155155
}

0 commit comments

Comments
 (0)