mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
Allow tunnel providers to define port privacy options (#133677)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { MainThreadTunnelServiceShape, MainContext, PortAttributesProviderSelector } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import type * as vscode from 'vscode';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -295,9 +296,26 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
|
||||
}
|
||||
if (provider.tunnelFactory) {
|
||||
this._forwardPortProvider = provider.tunnelFactory;
|
||||
this._proxy.$setTunnelProvider(provider.tunnelFeatures ?? {
|
||||
elevation: false,
|
||||
public: false
|
||||
let privacyOptions = provider.tunnelFeatures?.privacyOptions ?? [];
|
||||
if (provider.tunnelFeatures?.public && (privacyOptions.length === 0)) {
|
||||
privacyOptions = [
|
||||
{
|
||||
id: 'private',
|
||||
label: nls.localize('tunnelPrivacy.private', "Private"),
|
||||
themeIcon: 'lock'
|
||||
},
|
||||
{
|
||||
id: 'public',
|
||||
label: nls.localize('tunnelPrivacy.public', "Public"),
|
||||
themeIcon: 'eye'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
this._proxy.$setTunnelProvider({
|
||||
elevation: !!provider.tunnelFeatures?.elevation,
|
||||
public: !!provider.tunnelFeatures?.public,
|
||||
privacyOptions
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user