Skip to content

Commit ef15095

Browse files
authored
Add option to make port public in notification (microsoft#182190)
* Add public option to notification * Fix rebase error
1 parent 945077a commit ef15095

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/vs/workbench/contrib/remote/browser/remoteExplorer.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal
2121
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug';
2222
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
2323
import { isWeb, OperatingSystem } from 'vs/base/common/platform';
24-
import { ITunnelService, RemoteTunnel } from 'vs/platform/tunnel/common/tunnel';
24+
import { ITunnelService, RemoteTunnel, TunnelPrivacyId } from 'vs/platform/tunnel/common/tunnel';
2525
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
2626
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
2727
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
@@ -348,6 +348,10 @@ class OnAutoForwardedAction extends Disposable {
348348
choices.unshift(this.elevateChoice(tunnel));
349349
}
350350

351+
if (tunnel.privacy === TunnelPrivacyId.Private && isWeb && this.tunnelService.canChangePrivacy) {
352+
choices.push(this.makePublicChoice(tunnel));
353+
}
354+
351355
message += this.linkMessage();
352356

353357
this.lastNotification = this.notificationService.prompt(Severity.Info, message, choices, { neverShowAgain: { id: 'remote.tunnelsView.autoForwardNeverShow', isSecondary: true } });
@@ -359,6 +363,20 @@ class OnAutoForwardedAction extends Disposable {
359363
});
360364
}
361365

366+
private makePublicChoice(tunnel: RemoteTunnel): IPromptChoice {
367+
return {
368+
label: nls.localize('remote.tunnelsView.makePublic', "Make Public"),
369+
run: async () => {
370+
await this.remoteExplorerService.close({ host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort }, TunnelCloseReason.Other);
371+
return this.remoteExplorerService.forward({
372+
remote: { host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort },
373+
local: tunnel.tunnelLocalPort,
374+
privacy: TunnelPrivacyId.Public,
375+
});
376+
}
377+
};
378+
}
379+
362380
private openBrowserChoice(tunnel: RemoteTunnel): IPromptChoice {
363381
const address = makeAddress(tunnel.tunnelRemoteHost, tunnel.tunnelRemotePort);
364382
return {

0 commit comments

Comments
 (0)