| 1 | # Portal VSCode Extension |
| 2 | |
| 3 | Expose your local service to the internet via a [Portal](https://github.com/gosuda/portal-tunnel) relay tunnel, directly from VSCode. |
| 4 | |
| 5 | ## Features |
| 6 | |
| 7 | - `Portal: Start Tunnel` prompts only for the local host:port, then starts the tunnel with configured relay URLs or the default public registry |
| 8 | - `Portal: Start Tunnel (Advanced)` prompts for host, optional service name, relay source, and optional thumbnail |
| 9 | - `Portal: Stop Tunnel` stops the active tunnel terminal |
| 10 | - Persisted settings for relay URLs, default local host, and default service name |
| 11 | - Runs the latest Portal release installer script before starting the tunnel |
| 12 | - When no relay URL is configured, the extension can use the public registry at `https://raw.githubusercontent.com/gosuda/portal-tunnel/main/registry.json` |
| 13 | |
| 14 | ## Requirements |
| 15 | |
| 16 | - A running [Portal relay server](https://github.com/gosuda/portal-tunnel) with an `https://` URL |
| 17 | - `curl` on macOS/Linux, PowerShell on Windows |
| 18 | - GitHub release asset access for `https://github.com/gosuda/portal-tunnel/releases/latest/download/install.sh` or `install.ps1` |
| 19 | |
| 20 | ## Settings |
| 21 | |
| 22 | | Setting | Default | Description | |
| 23 | |---|---|---| |
| 24 | | `portal.relayUrls` | `[]` | Relay server URLs (`https://` only). If empty, the extension uses `https://raw.githubusercontent.com/gosuda/portal-tunnel/main/registry.json`. | |
| 25 | | `portal.defaultHost` | `"localhost:3000"` | Default local host:port shown by `Portal: Start Tunnel`. | |
| 26 | | `portal.defaultName` | `""` | Default tunnel service name suggestion. If empty, the extension omits `--name`. | |
| 27 | |
| 28 | Example `settings.json`: |
| 29 | |
| 30 | ```json |
| 31 | { |
| 32 | "portal.relayUrls": ["https://my-relay.example.com"], |
| 33 | "portal.defaultHost": "localhost:3000", |
| 34 | "portal.defaultName": "my-app" |
| 35 | } |
| 36 | ``` |
| 37 | |
| 38 | ## Usage |
| 39 | |
| 40 | 1. Open Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) |
| 41 | 2. Run `Portal: Start Tunnel` |
| 42 | 3. Enter the local host:port you want to expose |
| 43 | 4. The tunnel starts in the integrated terminal |
| 44 | |
| 45 | Use `Portal: Start Tunnel (Advanced)` when you need a different host, custom relay selection, or a thumbnail URL. |
| 46 | |
| 47 | The extension runs the platform-appropriate installer script from the latest GitHub release assets and then runs `portal expose ...` with the selected relay settings. |
| 48 | |
| 49 | To stop, run `Portal: Stop Tunnel` or close the `Portal Tunnel` terminal. |
| 50 | |
| 51 | ## Development |
| 52 | |
| 53 | ```bash |
| 54 | git clone https://github.com/gosuda/portal-tunnel |
| 55 | cd portal-tunnel/extensions/vscode |
| 56 | corepack pnpm install --frozen-lockfile |
| 57 | ``` |
| 58 | |
| 59 | Open the folder in VSCode, then press `F5` to launch the Extension Development Host. |
| 60 | |
| 61 | To test the extension locally: |
| 62 | |
| 63 | 1. Open `extensions/vscode` in VSCode. |
| 64 | 2. Press `F5` and choose `Run Extension`. |
| 65 | 3. In the new Extension Development Host window, run `Portal: Start Tunnel` or `Portal: Start Tunnel (Advanced)` from the Command Palette. |
| 66 | |
| 67 | If you want Linux behavior from WSL, open the folder with `Remote - WSL` first so the extension host runs in WSL instead of Windows. |
| 68 | |
| 69 | ## Release Notes |
| 70 | |
| 71 | ### 0.0.3 |
| 72 | |
| 73 | - Run the latest GitHub release installer script before execution |
| 74 | |
| 75 | ### 0.0.2 |
| 76 | |
| 77 | - Enforce `https://` relay URLs |
| 78 | - Prompt only for the local host in `Portal: Start Tunnel` |
| 79 | - Add `Portal: Start Tunnel (Advanced)` for host, name, relay, and thumbnail overrides |
| 80 | - Generate a stable default service name in the extension when the name is empty |