Merge branch 'develop' into perf-v11

This commit is contained in:
Rohit
2025-03-11 21:31:57 +05:30
committed by GitHub
18 changed files with 1839 additions and 612 deletions

View File

@@ -182,18 +182,24 @@ router.get('/stop/:browserId', requireSignIn, async (req: AuthenticatedRequest,
/**
* GET endpoint for getting the id of the active remote browser.
*/
router.get('/active', requireSignIn, (req, res) => {
const id = getActiveBrowserId();
router.get('/active', requireSignIn, (req: AuthenticatedRequest, res) => {
if (!req.user) {
return res.status(401).send('User not authenticated');
}
const id = getActiveBrowserId(req.user?.id);
return res.send(id);
});
/**
* GET endpoint for getting the current url of the active remote browser.
*/
router.get('/active/url', requireSignIn, (req, res) => {
const id = getActiveBrowserId();
router.get('/active/url', requireSignIn, (req: AuthenticatedRequest, res) => {
if (!req.user) {
return res.status(401).send('User not authenticated');
}
const id = getActiveBrowserId(req.user?.id);
if (id) {
const url = getRemoteBrowserCurrentUrl(id);
const url = getRemoteBrowserCurrentUrl(id, req.user?.id);
return res.send(url);
}
return res.send(null);
@@ -202,10 +208,13 @@ router.get('/active/url', requireSignIn, (req, res) => {
/**
* GET endpoint for getting the current tabs of the active remote browser.
*/
router.get('/active/tabs', requireSignIn, (req, res) => {
const id = getActiveBrowserId();
router.get('/active/tabs', requireSignIn, (req: AuthenticatedRequest, res) => {
if (!req.user) {
return res.status(401).send('User not authenticated');
}
const id = getActiveBrowserId(req.user?.id);
if (id) {
const hosts = getRemoteBrowserCurrentTabs(id);
const hosts = getRemoteBrowserCurrentTabs(id, req.user?.id);
return res.send(hosts);
}
return res.send([]);
@@ -219,7 +228,7 @@ router.get('/interpret', requireSignIn, async (req: AuthenticatedRequest, res) =
if (!req.user) {
return res.status(401).send('User not authenticated');
}
await interpretWholeWorkflow();
await interpretWholeWorkflow(req.user?.id);
return res.send('interpretation done');
} catch (e) {
return res.send('interpretation failed');
@@ -233,7 +242,7 @@ router.get('/interpret/stop', requireSignIn, async (req: AuthenticatedRequest, r
if (!req.user) {
return res.status(401).send('User not authenticated');
}
await stopRunningInterpretation();
await stopRunningInterpretation(req.user?.id);
return res.send('interpretation stopped');
});