@@ -21,6 +21,11 @@ and the output should replace `{{port}}` with port used in input url.
21
21
22
22
This also enables the forwared ports view panel by default.
23
23
24
+ Lastly, it adds a tunnelProvider so that ports are forwarded using code-server's
25
+ built-in proxy. You can test this by starting a server i.e. `python3 -m
26
+ http.server` and it should show a notification and show up in the ports panel
27
+ using the /proxy/port.
28
+
24
29
Index: code-server/lib/vscode/src/vs/base/common/product.ts
25
30
===================================================================
26
31
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
@@ -113,15 +118,16 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
113
118
===================================================================
114
119
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts
115
120
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
116
- @@ -21,6 +21,7 @@ import type { ICredentialsProvider } fro
117
- import type { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
118
- import type { IWorkbenchConstructionOptions } from 'vs/workbench/browser/web.api';
119
- import type { IWorkspace, IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService';
120
- + import { extractLocalHostUriMetaDataForPortMapping } from 'vs/platform/tunnel/common/tunnel';
121
+ @@ -17,6 +17,8 @@ import { isFolderToOpen, isWorkspaceToOp
122
+ import { create, ICredentialsProvider, IURLCallbackProvider, IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from 'vs/workbench/workbench.web.main';
123
+ import { posix } from 'vs/base/common/path';
124
+ import { ltrim } from 'vs/base/common/strings';
125
+ + import { extractLocalHostUriMetaDataForPortMapping, TunnelOptions } from 'vs/platform/tunnel/common/tunnel';
126
+ + import { TunnelCreationOptions } from 'vs/workbench/browser/web.api';
121
127
122
128
interface ICredential {
123
129
service: string;
124
- @@ -511 ,6 +512,21 @@ function doCreateUri(path: string, query
130
+ @@ -507 ,6 +509,39 @@ function doCreateUri(path: string, query
125
131
} : undefined,
126
132
workspaceProvider: WorkspaceProvider.create(config),
127
133
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),
@@ -141,6 +147,24 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
141
147
+
142
148
+ // If not localhost, return unmodified
143
149
+ return Promise.resolve(resolvedUri)
150
+ + },
151
+ + tunnelProvider: {
152
+ + tunnelFactory: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions) => {
153
+ + const onDidDispose: Emitter<void> = new Emitter();
154
+ + let isDisposed = false;
155
+ + return Promise.resolve({
156
+ + remoteAddress: tunnelOptions.remoteAddress,
157
+ + //The complete local address(ex. localhost:1234)
158
+ + localAddress: `localhost:${tunnelOptions.remoteAddress.port}`,
159
+ + onDidDispose: onDidDispose.event,
160
+ + dispose: () => {
161
+ + if (!isDisposed) {
162
+ + isDisposed = true;
163
+ + onDidDispose.fire();
164
+ + }
165
+ + }
166
+ + })
167
+ + }
144
168
+ }
145
169
});
146
170
})();
0 commit comments