temp: rewrite headless config

This commit is contained in:
karishmas6
2024-11-03 02:59:30 +05:30
parent 006b249774
commit d2115b1104
6 changed files with 42 additions and 68 deletions

View File

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