From 59e494c9be103fef30203258931d41d578493cb5 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 7 Mar 2025 22:43:06 +0530 Subject: [PATCH] feat: get user for browser --- .../src/browser-management/classes/BrowserPool.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/src/browser-management/classes/BrowserPool.ts b/server/src/browser-management/classes/BrowserPool.ts index e09f96ef..a52c85d6 100644 --- a/server/src/browser-management/classes/BrowserPool.ts +++ b/server/src/browser-management/classes/BrowserPool.ts @@ -183,5 +183,18 @@ export class BrowserPool { return browserId; }; + /** + * Returns the user ID associated with a browser ID. + * + * @param browserId the browser ID to find the user for + * @returns the user ID for the browser, or null if the browser doesn't exist + */ + public getUserForBrowser = (browserId: string): string | null => { + if (!this.pool[browserId]) { + return null; + } + return this.pool[browserId].userId; + }; + } \ No newline at end of file