Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /app

# Copy package files
COPY package*.json ./
COPY maxun-core ./maxun-core

# Install dependencies
RUN npm install --legacy-peer-deps
Expand Down
1 change: 0 additions & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ WORKDIR /app

# Install node dependencies
COPY package*.json ./
COPY maxun-core ./maxun-core
COPY src ./src
COPY public ./public
COPY server ./server
Expand Down
4 changes: 2 additions & 2 deletions server/src/browser-management/classes/RemoteBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ export class RemoteBrowser {
* @param socket socket.io socket instance used to communicate with the client side
* @constructor
*/
public constructor(socket: Socket, userId: string) {
public constructor(socket: Socket, userId: string, poolId: string) {
this.socket = socket;
this.userId = userId;
this.interpreter = new WorkflowInterpreter(socket);
this.generator = new WorkflowGenerator(socket);
this.generator = new WorkflowGenerator(socket, poolId);
}

private initializeMemoryManagement(): void {
Expand Down
4 changes: 2 additions & 2 deletions server/src/browser-management/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const initializeRemoteBrowserForRecording = (userId: string): string => {
remoteBrowser?.updateSocket(socket);
await remoteBrowser?.makeAndEmitScreenshot();
} else {
const browserSession = new RemoteBrowser(socket, userId);
const browserSession = new RemoteBrowser(socket, userId, id);
browserSession.interpreter.subscribeToPausing();
await browserSession.initialize(userId);
await browserSession.registerEditorEvents();
Expand Down Expand Up @@ -62,7 +62,7 @@ export const createRemoteBrowserForRun = (userId: string): string => {
io.of(`/${id}`),
async (socket: Socket) => {
try {
const browserSession = new RemoteBrowser(socket, userId);
const browserSession = new RemoteBrowser(socket, userId, id);
await browserSession.initialize(userId);
browserPool.addRemoteBrowser(id, browserSession, userId, false, "run");
socket.emit('ready-for-run');
Expand Down
9 changes: 5 additions & 4 deletions server/src/workflow-management/classes/Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { CustomActions } from "../../../../src/shared/types";
import Robot from "../../models/Robot";
import { getBestSelectorForAction } from "../utils";
import { browserPool } from "../../server";
import { uuid } from "uuidv4";
import { capture } from "../../utils/analytics"
import { decrypt, encrypt } from "../../utils/auth";
Expand Down Expand Up @@ -70,14 +69,17 @@ export class WorkflowGenerator {

private paginationMode: boolean = false;

private poolId: string | null = null;

/**
* The public constructor of the WorkflowGenerator.
* Takes socket for communication as a parameter and registers some important events on it.
* @param socket The socket used to communicate with the client.
* @constructor
*/
public constructor(socket: Socket) {
public constructor(socket: Socket, poolId: string) {
this.socket = socket;
this.poolId = poolId;
this.registerEventHandlers(socket);
this.initializeSocketListeners();
}
Expand Down Expand Up @@ -148,8 +150,7 @@ export class WorkflowGenerator {
});
socket.on('activeIndex', (data) => this.generatedData.lastIndex = parseInt(data));
socket.on('decision', async ({ pair, actionType, decision, userId }) => {
const id = browserPool.getActiveBrowserId(userId, "recording");
if (id) {
if (this.poolId) {
// const activeBrowser = browserPool.getRemoteBrowser(id);
// const currentPage = activeBrowser?.getCurrentPage();
if (!decision) {
Expand Down