diff --git a/assist/servers/websocket.js b/assist/servers/websocket.js index f146057e0..48bf629f0 100644 --- a/assist/servers/websocket.js +++ b/assist/servers/websocket.js @@ -196,10 +196,15 @@ const autocomplete = async function (req, res) { } const findSessionSocketId = async (io, roomId, tabId) => { + let pickFirstSession = tabId === undefined; const connected_sockets = await io.in(roomId).fetchSockets(); for (let item of connected_sockets) { - if (item.handshake.query.identity === IDENTITIES.session && item.tabId === tabId) { - return item.id; + if (item.handshake.query.identity === IDENTITIES.session) { + if (pickFirstSession) { + return item.id; + } else if (item.tabId === tabId) { + return item.id; + } } } return null; @@ -340,8 +345,8 @@ module.exports = { return } // Back compatibility (add top layer with meta information) - if (args[0].meta === undefined) { - args[0] = {meta: {tabId: socket.tabId}, data: args[0]}; + if (args[0]?.meta === undefined && socket.identity === IDENTITIES.session) { + args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]}; } Object.assign(socket.handshake.query.sessionInfo, args[0].data, {tabId: args[0].meta.tabId}); socket.to(socket.roomId).emit(EVENTS_DEFINITION.emit.UPDATE_EVENT, args[0]); @@ -368,8 +373,8 @@ module.exports = { return } // Back compatibility (add top layer with meta information) - if (args[0].meta === undefined) { - args[0] = {meta: {tabId: socket.tabId}, data: args[0]}; + if (args[0]?.meta === undefined && socket.identity === IDENTITIES.session) { + args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]}; } if (socket.identity === IDENTITIES.session) { debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to room:${socket.roomId}`); @@ -377,7 +382,7 @@ module.exports = { socket.to(socket.roomId).emit(eventName, args[0]); } else { debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to session of room:${socket.roomId}`); - let socketId = await findSessionSocketId(io, socket.roomId, args[0].meta.tabId); + let socketId = await findSessionSocketId(io, socket.roomId, args[0]?.meta?.tabId); if (socketId === null) { debug && console.log(`session not found for:${socket.roomId}`); io.to(socket.id).emit(EVENTS_DEFINITION.emit.NO_SESSIONS); diff --git a/ee/assist/servers/websocket-cluster.js b/ee/assist/servers/websocket-cluster.js index 4cad9dcb1..3b2231c44 100644 --- a/ee/assist/servers/websocket-cluster.js +++ b/ee/assist/servers/websocket-cluster.js @@ -247,10 +247,15 @@ const autocomplete = async function (req, res) { } const findSessionSocketId = async (io, roomId, tabId) => { + let pickFirstSession = tabId === undefined; const connected_sockets = await io.in(roomId).fetchSockets(); for (let item of connected_sockets) { - if (item.handshake.query.identity === IDENTITIES.session && item.tabId === tabId) { - return item.id; + if (item.handshake.query.identity === IDENTITIES.session) { + if (pickFirstSession) { + return item.id; + } else if (item.tabId === tabId) { + return item.id; + } } } return null; @@ -421,8 +426,8 @@ module.exports = { return } // Back compatibility (add top layer with meta information) - if (args[0].meta === undefined) { - args[0] = {meta: {tabId: socket.tabId}, data: args[0]}; + if (args[0].meta === undefined && socket.identity === IDENTITIES.session) { + args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]}; } if (socket.identity === IDENTITIES.session) { debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to room:${socket.roomId}`); diff --git a/ee/assist/servers/websocket.js b/ee/assist/servers/websocket.js index 4411593e4..32921fa49 100644 --- a/ee/assist/servers/websocket.js +++ b/ee/assist/servers/websocket.js @@ -216,10 +216,15 @@ const autocomplete = async function (req, res) { } const findSessionSocketId = async (io, roomId, tabId) => { + let pickFirstSession = tabId === undefined; const connected_sockets = await io.in(roomId).fetchSockets(); for (let item of connected_sockets) { - if (item.handshake.query.identity === IDENTITIES.session && item.tabId === tabId) { - return item.id; + if (item.handshake.query.identity === IDENTITIES.session) { + if (pickFirstSession) { + return item.id; + } else if (item.tabId === tabId) { + return item.id; + } } } return null; @@ -389,8 +394,8 @@ module.exports = { return } // Back compatibility (add top layer with meta information) - if (args[0].meta === undefined) { - args[0] = {meta: {tabId: socket.tabId}, data: args[0]}; + if (args[0].meta === undefined && socket.identity === IDENTITIES.session) { + args[0] = {meta: {tabId: socket.tabId, version: 1}, data: args[0]}; } if (socket.identity === IDENTITIES.session) { debug && console.log(`received event:${eventName}, from:${socket.identity}, sending message to room:${socket.peerId}`); diff --git a/frontend/.env.sample b/frontend/.env.sample index e70a4baf4..5462fb161 100644 --- a/frontend/.env.sample +++ b/frontend/.env.sample @@ -23,4 +23,4 @@ MINIO_SECRET_KEY = '' # APP and TRACKER VERSIONS VERSION = 1.13.0 -TRACKER_VERSION = '7.0.2' +TRACKER_VERSION = '8.0.0' diff --git a/frontend/app/components/Assist/Assist.tsx b/frontend/app/components/Assist/Assist.tsx index 9d81f0161..dc025b75b 100644 --- a/frontend/app/components/Assist/Assist.tsx +++ b/frontend/app/components/Assist/Assist.tsx @@ -17,7 +17,7 @@ interface Props extends RouteComponentProps { function Assist(props: Props) { const { history, siteId, isEnterprise } = props; const isAssist = history.location.pathname.includes('assist'); - const isRecords = history.location.pathname.includes('offline-playback'); + const isRecords = history.location.pathname.includes('recordings'); const redirect = (path: string) => { history.push(withSiteId(path, siteId)); @@ -37,7 +37,7 @@ function Assist(props: Props) { redirect(recordings())} disabled={!isEnterprise} diff --git a/frontend/app/components/Assist/RecordingsList/Recordings.tsx b/frontend/app/components/Assist/RecordingsList/Recordings.tsx index d393247e3..652567f77 100644 --- a/frontend/app/components/Assist/RecordingsList/Recordings.tsx +++ b/frontend/app/components/Assist/RecordingsList/Recordings.tsx @@ -31,7 +31,7 @@ function Recordings(props: Props) {
- +
diff --git a/frontend/app/components/Assist/RecordingsList/RecordingsList.tsx b/frontend/app/components/Assist/RecordingsList/RecordingsList.tsx index 244de38e4..d98d816fc 100644 --- a/frontend/app/components/Assist/RecordingsList/RecordingsList.tsx +++ b/frontend/app/components/Assist/RecordingsList/RecordingsList.tsx @@ -28,8 +28,8 @@ function RecordingsList() {
{recordsSearch !== '' - ? 'No matching results' - : 'No videos available for offline playback.'} + ? 'No matching results.' + : 'No recordings available.'}
} diff --git a/frontend/app/player/web/assist/AssistManager.ts b/frontend/app/player/web/assist/AssistManager.ts index 2750d461f..1f01814d7 100644 --- a/frontend/app/player/web/assist/AssistManager.ts +++ b/frontend/app/player/web/assist/AssistManager.ts @@ -171,7 +171,8 @@ export default class AssistManager { }) socket.on('messages', messages => { - if (messages.data !== undefined) this.assistVersion = 2 + const isOldVersion = messages.meta.version === 1 + this.assistVersion = isOldVersion ? 1 : 2 const data = messages.data || messages jmr.append(data) // as RawMessage[] @@ -179,6 +180,10 @@ export default class AssistManager { waitingForMessages = false // TODO: more explicit this.setStatus(ConnectionStatus.Connected) } + if (messages.meta.tabId !== this.store.get().currentTab && isOldVersion) { + reader.currentTab = messages.meta.tabId + this.store.update({ currentTab: messages.meta.tabId }) + } for (let msg = reader.readNext();msg !== null;msg = reader.readNext()) { this.handleMessage(msg, msg._index) diff --git a/frontend/app/player/web/assist/Call.ts b/frontend/app/player/web/assist/Call.ts index 5399a2b25..ebd1ba846 100644 --- a/frontend/app/player/web/assist/Call.ts +++ b/frontend/app/player/web/assist/Call.ts @@ -173,7 +173,7 @@ export default class Call { } private emitData = (event: string, data?: any) => { - if (this.assistVersion === 1) { + if (this.getAssistVersion() === 1) { this.socket?.emit(event, data) } else { this.socket?.emit(event, { meta: { tabId: this.store.get().currentTab }, data }) @@ -238,7 +238,8 @@ export default class Call { if (!this.store.get().currentTab) { console.warn('No tab data to connect to peer') } - const peerId = this.assistVersion === 1 ? this.peerID : `${this.peerID}-${tab || Object.keys(this.store.get().tabs)[0]}` + const peerId = this.getAssistVersion() === 1 ? this.peerID : `${this.peerID}-${tab || Object.keys(this.store.get().tabs)[0]}` + console.log(peerId, this.getAssistVersion()) void this._peerConnection(peerId); this.emitData("_agent_name", appStore.getState().getIn([ 'user', 'account', 'name'])) } diff --git a/frontend/app/player/web/assist/RemoteControl.ts b/frontend/app/player/web/assist/RemoteControl.ts index 3b7405788..aa5690e86 100644 --- a/frontend/app/player/web/assist/RemoteControl.ts +++ b/frontend/app/player/web/assist/RemoteControl.ts @@ -29,7 +29,7 @@ export default class RemoteControl { private screen: Screen, private agentInfo: Object, private onToggle: (active: boolean) => void, - private getAssistVersion: () => number, + private getAssistVersion: () => number ){ socket.on("control_granted", ({ meta, data }) => { this.toggleRemoteControl(data === socket.id) @@ -58,7 +58,7 @@ export default class RemoteControl { } private emitData = (event: string, data?: any) => { - if (this.assistVersion === 1) { + if (this.getAssistVersion() === 1) { this.socket.emit(event, data) } else { this.socket.emit(event, { meta: { tabId: this.store.get().currentTab }, data }) diff --git a/frontend/app/player/web/assist/ScreenRecording.ts b/frontend/app/player/web/assist/ScreenRecording.ts index 3a7c71947..3ef140729 100644 --- a/frontend/app/player/web/assist/ScreenRecording.ts +++ b/frontend/app/player/web/assist/ScreenRecording.ts @@ -59,7 +59,7 @@ export default class ScreenRecording { } private emitData = (event: string, data?: any) => { - if (this.assistVersion === 1) { + if (this.getAssistVersion() === 1) { this.socket.emit(event, data) } else { this.socket.emit(event, { meta: { tabId: this.store.get().currentTab }, data }) diff --git a/frontend/app/routes.js b/frontend/app/routes.js index 92c87780e..411b48ba5 100644 --- a/frontend/app/routes.js +++ b/frontend/app/routes.js @@ -84,7 +84,7 @@ export const onboarding = (tab = routerOBTabString) => `/onboarding/${ tab }`; export const sessions = params => queried('/sessions', params); export const assist = params => queried('/assist', params); -export const recordings = params => queried("/offline-playback", params); +export const recordings = params => queried("/recordings", params); export const multiviewIndex = params => queried('/multiview', params); export const multiview = (sessionsQuery = ':sessionsquery', hash) => hashed(`/multiview/${sessionsQuery}`, hash); export const session = (sessionId = ':sessionId', hash) => hashed(`/session/${ sessionId }`, hash); diff --git a/tracker/tracker-assist/package.json b/tracker/tracker-assist/package.json index bcdee50af..bdca10d05 100644 --- a/tracker/tracker-assist/package.json +++ b/tracker/tracker-assist/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker-assist", "description": "Tracker plugin for screen assistance through the WebRTC", - "version": "6.0.0-beta.11", + "version": "6.0.0", "keywords": [ "WebRTC", "assistance", @@ -21,7 +21,7 @@ "replace-paths": "replace-in-files cjs/* --string='@openreplay/tracker' --replacement='@openreplay/tracker/cjs' && replace-in-files cjs/* --string='/lib/' --replacement='/'", "replace-versions": "npm run replace-pkg-version && npm run replace-req-version", "replace-pkg-version": "replace-in-files lib/* cjs/* --string='PACKAGE_VERSION' --replacement=$npm_package_version", - "replace-req-version": "replace-in-files lib/* cjs/* --string='REQUIRED_TRACKER_VERSION' --replacement='3.5.14'", + "replace-req-version": "replace-in-files lib/* cjs/* --string='REQUIRED_TRACKER_VERSION' --replacement='8.0.0'", "prepublishOnly": "npm run build", "prepare": "cd ../../ && husky install tracker/.husky/", "lint-front": "lint-staged", diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index d76c42964..9bedaa6f6 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker", "description": "The OpenReplay tracker main package", - "version": "8.0.0-beta.5", + "version": "8.0.0", "keywords": [ "logging", "replay"