fear: accept userId

This commit is contained in:
karishmas6
2024-10-27 17:55:25 +05:30
parent d2a12e6f6b
commit 54f1a39344

View File

@@ -20,7 +20,7 @@ import logger from "../logger";
* @returns string * @returns string
* @category BrowserManagement-Controller * @category BrowserManagement-Controller
*/ */
export const initializeRemoteBrowserForRecording = (options: RemoteBrowserOptions): string => { export const initializeRemoteBrowserForRecording = (options: RemoteBrowserOptions, userId: string): string => {
const id = getActiveBrowserId() || uuid(); const id = getActiveBrowserId() || uuid();
createSocketConnection( createSocketConnection(
io.of(id), io.of(id),
@@ -34,7 +34,7 @@ export const initializeRemoteBrowserForRecording = (options: RemoteBrowserOption
} else { } else {
const browserSession = new RemoteBrowser(socket); const browserSession = new RemoteBrowser(socket);
browserSession.interpreter.subscribeToPausing(); browserSession.interpreter.subscribeToPausing();
await browserSession.initialize(options); await browserSession.initialize(options, userId);
await browserSession.registerEditorEvents(); await browserSession.registerEditorEvents();
await browserSession.subscribeToScreencast(); await browserSession.subscribeToScreencast();
browserPool.addRemoteBrowser(id, browserSession, true); browserPool.addRemoteBrowser(id, browserSession, true);
@@ -52,13 +52,13 @@ export const initializeRemoteBrowserForRecording = (options: RemoteBrowserOption
* @returns string * @returns string
* @category BrowserManagement-Controller * @category BrowserManagement-Controller
*/ */
export const createRemoteBrowserForRun = (options: RemoteBrowserOptions): string => { export const createRemoteBrowserForRun = (options: RemoteBrowserOptions, userId: string): string => {
const id = uuid(); const id = uuid();
createSocketConnectionForRun( createSocketConnectionForRun(
io.of(id), io.of(id),
async (socket: Socket) => { async (socket: Socket) => {
const browserSession = new RemoteBrowser(socket); const browserSession = new RemoteBrowser(socket);
await browserSession.initialize(options); await browserSession.initialize(options, userId);
browserPool.addRemoteBrowser(id, browserSession, true); browserPool.addRemoteBrowser(id, browserSession, true);
socket.emit('ready-for-run'); socket.emit('ready-for-run');
}); });