From 0e944e274aa49504f185d5c9e9af30f75a045a5e Mon Sep 17 00:00:00 2001 From: SuperComboGamer Date: Sat, 20 Dec 2025 23:13:30 -0500 Subject: [PATCH] feat: increase maximum terminal session limit and improve path handling - Updated the maximum terminal session limit from 500 to 1000 to accommodate more concurrent sessions. - Enhanced path handling in the editor and HTTP API client to normalize file paths for both Unix and Windows systems, ensuring consistent URL encoding. --- apps/server/src/services/terminal-service.ts | 2 +- apps/ui/src/lib/http-api-client.ts | 9 +++++---- apps/ui/src/main.ts | 8 +++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/server/src/services/terminal-service.ts b/apps/server/src/services/terminal-service.ts index 2a2602ec..b569ec28 100644 --- a/apps/server/src/services/terminal-service.ts +++ b/apps/server/src/services/terminal-service.ts @@ -16,7 +16,7 @@ const MAX_SCROLLBACK_SIZE = 50000; // ~50KB per terminal // Session limit constants - shared with routes/settings.ts export const MIN_MAX_SESSIONS = 1; -export const MAX_MAX_SESSIONS = 500; +export const MAX_MAX_SESSIONS = 1000; // Maximum number of concurrent terminal sessions // Can be overridden via TERMINAL_MAX_SESSIONS environment variable diff --git a/apps/ui/src/lib/http-api-client.ts b/apps/ui/src/lib/http-api-client.ts index 037aea13..c3694f99 100644 --- a/apps/ui/src/lib/http-api-client.ts +++ b/apps/ui/src/lib/http-api-client.ts @@ -225,10 +225,11 @@ export class HttpApiClient implements ElectronAPI { // Build VS Code URL scheme: vscode://file/path:line:column // This works on systems where VS Code's URL handler is registered // URL encode the path to handle special characters (spaces, brackets, etc.) - // but preserve the leading slash for absolute paths - const encodedPath = filePath.startsWith('/') - ? '/' + filePath.slice(1).split('/').map(encodeURIComponent).join('/') - : filePath.split('/').map(encodeURIComponent).join('/'); + // Handle both Unix (/) and Windows (\) path separators + const normalizedPath = filePath.replace(/\\/g, '/'); + const encodedPath = normalizedPath.startsWith('/') + ? '/' + normalizedPath.slice(1).split('/').map(encodeURIComponent).join('/') + : normalizedPath.split('/').map(encodeURIComponent).join('/'); let url = `vscode://file${encodedPath}`; if (line !== undefined && line > 0) { url += `:${line}`; diff --git a/apps/ui/src/main.ts b/apps/ui/src/main.ts index e650f686..a07ec8ab 100644 --- a/apps/ui/src/main.ts +++ b/apps/ui/src/main.ts @@ -417,9 +417,11 @@ ipcMain.handle("shell:openInEditor", async (_, filePath: string, line?: number, // Build VS Code URL scheme: vscode://file/path:line:column // This works on all platforms where VS Code is installed // URL encode the path to handle special characters (spaces, brackets, etc.) - const encodedPath = filePath.startsWith('/') - ? '/' + filePath.slice(1).split('/').map(encodeURIComponent).join('/') - : filePath.split('/').map(encodeURIComponent).join('/'); + // Handle both Unix (/) and Windows (\) path separators + const normalizedPath = filePath.replace(/\\/g, '/'); + const encodedPath = normalizedPath.startsWith('/') + ? '/' + normalizedPath.slice(1).split('/').map(encodeURIComponent).join('/') + : normalizedPath.split('/').map(encodeURIComponent).join('/'); let url = `vscode://file${encodedPath}`; if (line !== undefined && line > 0) { url += `:${line}`;