From 11ae3a348c460879873b2c9ed094757c6f27ad38 Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Mon, 2 Jun 2025 17:40:15 +0100 Subject: [PATCH 1/2] Increment version to 0.23.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df1c719..b6c50d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dev-proxy-toolkit", - "version": "0.23.3", + "version": "0.23.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dev-proxy-toolkit", - "version": "0.23.3", + "version": "0.23.4", "dependencies": { "json-to-ast": "^2.1.0" }, diff --git a/package.json b/package.json index da1b942..9e9ec6b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "dev-proxy-toolkit", "displayName": "Dev Proxy Toolkit", "description": "Makes it easy to create and update Dev Proxy configuration files.", - "version": "0.23.3", + "version": "0.23.4", "publisher": "garrytrinder", "engines": { "vscode": "^1.89.0" From 0696256fc26fe47d1cc4c78a93aa6ef7df6ea508 Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Mon, 2 Jun 2025 17:40:57 +0100 Subject: [PATCH 2/2] Add Discover URLs to watch command. Closes #225 Closes #225 --- CHANGELOG.md | 3 ++- README.md | 1 + package.json | 7 +++++++ src/commands.ts | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9879f0b..6094144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > **Note**: odd version numbers, for example, `0.13.0`, are not included in this changelog. They are used to test the new features and fixes before the final release. -## [0.23.3] - Unreleased +## [0.23.4] - Unreleased ### Added: - Support for using Dev Proxy Beta with commands +- Command: `dev-proxy-toolkit.discover-urls-to-watch` - Start Dev Proxy in discovery mode ### Changed: diff --git a/README.md b/README.md index a5265c8..7bc4c01 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ The following sections describe the features that the extension contributes to V - `Dev Proxy Toolkit: Stop recording`- Only available when Dev Proxy is recording - `Dev Proxy Toolkit: Open configuration file`- Only available when Dev Proxy is installed - `Dev Proxy Toolkit: Create configuration file`- Only available when Dev Proxy is installed +- `Dev Proxy Toolkit: Discover URLs to watch` - Only available when Dev Proxy is not running ### Diagnostics diff --git a/package.json b/package.json index 9e9ec6b..2ed9e6c 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,13 @@ "category": "Dev Proxy Toolkit", "icon": "$(file-code)", "enablement": "isDevProxyInstalled" + }, + { + "command": "dev-proxy-toolkit.discover-urls-to-watch", + "title": "Discover URLs to watch", + "category": "Dev Proxy Toolkit", + "icon": "$(debug-start)", + "enablement": "!isDevProxyRunning" } ], "menus": { diff --git a/src/commands.ts b/src/commands.ts index ccc26af..9b2e6ac 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -302,4 +302,36 @@ export const registerCommands = (context: vscode.ExtensionContext, configuration vscode.window.showErrorMessage('Failed to create new config file'); } })); + + context.subscriptions.push( + vscode.commands.registerCommand('dev-proxy-toolkit.discover-urls-to-watch', async () => { + const newTerminal = configuration.get('newTerminal') as boolean; + + let terminal: vscode.Terminal; + + if (!newTerminal && vscode.window.activeTerminal) { + terminal = vscode.window.activeTerminal; + } else { + terminal = vscode.window.createTerminal('Dev Proxy'); + + } + + const processNames = await vscode.window.showInputBox({ + prompt: 'Enter the process names (space separated). Leave empty to intercept requests from all processes.', + placeHolder: 'msedge pwsh', + value: '', + title: 'Intercept requests from specific processes', + validateInput: (value: string) => { + // can be empty string, but if not, must contain space separated process names + if (value && !/^[a-zA-Z0-9\s]+$/.test(value)) { + return 'Process names can only contain alphanumeric characters and spaces'; + } + return undefined; // no error + } + }); + + processNames !== undefined && processNames.trim() !== '' + ? terminal.sendText(`${devProxyExe} --discover --watch-process-names ${processNames.trim()}`) + : terminal.sendText(`${devProxyExe} --discover`); + })); };