Merge pull request #185 from getmaxun/console-cleanup

chore: console cleanup
This commit is contained in:
Karishma Shukla
2024-11-19 17:04:21 +05:30
committed by GitHub
11 changed files with 2 additions and 33 deletions

View File

@@ -495,7 +495,7 @@ async function createWorkflowAndStoreMetadata(id: string, userId: string) {
} catch (e) {
const { message } = e as Error;
logger.log('info', `Error while scheduling a run with id: ${id}`);
console.log(message);
console.log(`Error scheduling run:`, message);
return {
success: false,
error: message,
@@ -767,7 +767,6 @@ router.post("/robots/:id/runs", requireAPIKey, async (req: AuthenticatedRequest,
return res.status(401).json({ ok: false, error: 'Unauthorized' });
}
const runId = await handleRunRecording(req.params.id, req.user.dataValues.id);
console.log(`Result`, runId);
if (!runId) {
throw new Error('Run ID is undefined');

View File

@@ -163,9 +163,7 @@ export class RemoteBrowser {
contextOptions.userAgent = browserUserAgent;
this.context = await this.browser.newContext(contextOptions);
console.log(`Context from initialize: ${JSON.stringify(this.context)}`)
this.currentPage = await this.context.newPage();
console.log(`CPage from initialize: ${JSON.stringify(this.currentPage)}`)
// await this.currentPage.setExtraHTTPHeaders({
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
// });

View File

@@ -271,7 +271,6 @@ const handleChangeUrl = async (generator: WorkflowGenerator, page: Page, url: st
try {
await page.goto(url);
logger.log('debug', `Went to ${url}`);
console.log(`Went to ${url}`)
} catch (e) {
const { message } = e as Error;
logger.log('error', message);

View File

@@ -16,7 +16,6 @@ export const requireSignIn = (req: UserRequest, res: Response, next: any) => {
}
verify(token, secret, (err: any, user: any) => {
console.log(`Before: ${JSON.stringify(user)} and ${req.user}`)
if (err) {
console.log('JWT verification error:', err);
return res.sendStatus(403);
@@ -26,10 +25,7 @@ export const requireSignIn = (req: UserRequest, res: Response, next: any) => {
user.id = user.userId;
delete user.userId; // temporary: del the old key for clarity
}
req.user = user;
console.log(`After: ${JSON.stringify(user)} and ${JSON.stringify(req.user)}`)
next();
});
};

View File

@@ -14,8 +14,6 @@ interface AuthenticatedRequest extends Request {
}
router.post("/register", async (req, res) => {
console.log("Received request at /auth/register");
try {
const { email, password } = req.body;

View File

@@ -74,8 +74,6 @@ router.get('/test', requireSignIn, async (req: AuthenticatedRequest, res: Respon
const decryptedProxyUsername = user.proxy_username ? decrypt(user.proxy_username) : null;
const decryptedProxyPassword = user.proxy_password ? decrypt(user.proxy_password) : null;
console.log(`Decrypted vals: ${decryptedProxyPassword}, ${decryptedProxyUrl}, ${decryptedProxyUsername}`);
const proxyOptions: any = {
server: decryptedProxyUrl,
...(decryptedProxyUsername && decryptedProxyPassword && {
@@ -170,8 +168,6 @@ export const getDecryptedProxyConfig = async (userId: string) => {
const decryptedProxyUsername = user.proxy_username ? decrypt(user.proxy_username) : null;
const decryptedProxyPassword = user.proxy_password ? decrypt(user.proxy_password) : null;
console.log(`Decrypting ${decryptedProxyUrl}, ${decryptedProxyUsername}, ${decryptedProxyPassword}`);
return {
proxy_url: decryptedProxyUrl,
proxy_username: decryptedProxyUsername,

View File

@@ -57,7 +57,6 @@ router.get('/start', requireSignIn, async (req: AuthenticatedRequest, res: Respo
}
const id = initializeRemoteBrowserForRecording(req.user.id);
console.log('id start:', id);
return res.send(id);
});
@@ -70,7 +69,6 @@ router.post('/start', requireSignIn, (req: AuthenticatedRequest, res:Response) =
return res.status(401).send('User not authenticated');
}
const id = initializeRemoteBrowserForRecording(req.user.id);
console.log('id start POST:', id);
return res.send(id);
});

View File

@@ -180,9 +180,7 @@ router.put('/recordings/:id', requireSignIn, async (req: AuthenticatedRequest, r
await robot.save();
const updatedRobot = await Robot.findOne({ where: { 'recording_meta.id': id } });
console.log('After save:', updatedRobot);
// Log the update
logger.log('info', `Robot with ID ${id} was updated successfully.`);
return res.status(200).json({ message: 'Robot updated successfully', robot });

View File

@@ -5,11 +5,6 @@ import { handleRunRecording } from "./workflow-management/scheduler";
import Robot from './models/Robot';
import { computeNextRun } from './utils/schedule';
console.log('Environment variables:', {
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
});
const connection = new IORedis({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT, 10) : 6379,
@@ -68,7 +63,6 @@ console.log('Worker is running...');
async function jobCounts() {
const jobCounts = await workflowQueue.getJobCounts();
console.log('Jobs:', jobCounts);
}
jobCounts();
@@ -78,8 +72,4 @@ process.on('SIGINT', () => {
process.exit();
});
export { workflowQueue, worker };
export const temp = () => {
console.log('temp');
}
export { workflowQueue, worker };

View File

@@ -128,7 +128,6 @@ export class WorkflowGenerator {
*/
private registerEventHandlers = (socket: Socket) => {
socket.on('save', (data) => {
console.log('Received data:', data);
const { fileName, userId } = data;
logger.log('debug', `Saving workflow ${fileName} for user ID ${userId}`);
this.saveNewWorkflow(fileName, userId);

View File

@@ -102,8 +102,6 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl
const [rows, setRows] = React.useState<Data[]>([]);
const [isModalOpen, setModalOpen] = React.useState(false);
console.log('rows', rows);
const { notify, setRecordings, browserId, setBrowserId, recordingUrl, setRecordingUrl, recordingName, setRecordingName, recordingId, setRecordingId } = useGlobalInfoStore();
const navigate = useNavigate();