Skip to content

Commit 1cdfaf2

Browse files
authored
remove hardcoded remote tunnels extension (microsoft#167071)
1 parent c0ae2f6 commit 1cdfaf2

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.74.0",
4-
"distro": "bb29bde154b2858044ba263f32d63d3fe38b35e7",
4+
"distro": "221540098c17ef4e6f2f2bf40dfcf234a2e83c44",
55
"author": {
66
"name": "Microsoft Corporation"
77
},
@@ -237,4 +237,4 @@
237237
"elliptic": "^6.5.3",
238238
"nwmatcher": "^1.4.4"
239239
}
240-
}
240+
}

src/vs/base/common/product.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ export interface IProductConfiguration {
133133
readonly serverDataFolderName?: string;
134134

135135
readonly tunnelApplicationName?: string;
136-
readonly tunnelApplicationConfig?: {
137-
authenticationProviders: IStringDictionary<{ scopes: string[] }>;
138-
editorWebUrl: string;
139-
};
136+
readonly tunnelApplicationConfig?: ITunnelApplicationConfig;
140137

141138
readonly npsSurveyUrl?: string;
142139
readonly cesSurveyUrl?: string;
@@ -169,6 +166,12 @@ export interface IProductConfiguration {
169166
readonly enableSyncingProfiles?: boolean;
170167
}
171168

169+
export interface ITunnelApplicationConfig {
170+
authenticationProviders: IStringDictionary<{ scopes: string[] }>;
171+
editorWebUrl: string;
172+
extension: IRemoteExtensionTip;
173+
}
174+
172175
export type ImportantExtensionTip = { name: string; languages?: string[]; pattern?: string; isExtensionPack?: boolean; whenNotInstalled?: string[] };
173176

174177
export interface IAppCenterConfiguration {

src/vs/platform/remoteTunnel/common/remoteTunnel.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export interface ConnectionInfo {
5656
link: string;
5757
domain: string;
5858
hostName: string;
59-
extensionId: string;
6059
}
6160

6261
export const CONFIGURATION_KEY_PREFIX = 'remote.tunnels.access';

src/vs/platform/remoteTunnel/electron-browser/remoteTunnelService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class RemoteTunnelService extends Disposable implements IRemoteTunnelServ
191191
}
192192
const m = message.match(/^\s*Open this link in your browser (https:\/\/([^\/\s]+)\/([^\/\s]+)\/([^\/\s]+))/);
193193
if (m) {
194-
const info: ConnectionInfo = { link: m[1], domain: m[2], extensionId: 'ms-vscode.remote-server', hostName: m[4] };
194+
const info: ConnectionInfo = { link: m[1], domain: m[2], hostName: m[4] };
195195
this.setTunnelStatus(TunnelStates.connected(info));
196196
} else if (message.match(/error refreshing token/)) {
197197
serveCommand.cancel();

src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { IStorageService, IStorageValueChangeEvent, StorageScope, StorageTarget
1919
import { ILogger, ILoggerService, ILogService } from 'vs/platform/log/common/log';
2020
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
2121
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
22-
import { IStringDictionary } from 'vs/base/common/collections';
2322
import { IQuickInputService, IQuickPickItem, IQuickPickSeparator, QuickPickItem } from 'vs/platform/quickinput/common/quickInput';
2423
import { IOutputService, registerLogChannel } from 'vs/workbench/services/output/common/output';
2524
import { IFileService } from 'vs/platform/files/common/files';
@@ -37,6 +36,7 @@ import { Schemas } from 'vs/base/common/network';
3736
import { URI } from 'vs/base/common/uri';
3837
import { joinPath } from 'vs/base/common/resources';
3938
import { join } from 'vs/base/common/path';
39+
import { ITunnelApplicationConfig } from 'vs/base/common/product';
4040

4141
export const REMOTE_TUNNEL_CATEGORY: ILocalizedString = {
4242
original: 'Remote Tunnels',
@@ -80,7 +80,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
8080

8181
private readonly connectionStateContext: IContextKey<CONTEXT_KEY_STATES>;
8282

83-
private readonly serverConfiguration: { authenticationProviders: IStringDictionary<{ scopes: string[] }> };
83+
private readonly serverConfiguration: ITunnelApplicationConfig;
8484

8585
#authenticationSessionId: string | undefined;
8686
private connectionInfo: ConnectionInfo | undefined;
@@ -115,7 +115,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
115115
const serverConfiguration = productService.tunnelApplicationConfig;
116116
if (!serverConfiguration || !productService.tunnelApplicationName) {
117117
this.logger.error('Missing \'tunnelApplicationConfig\' or \'tunnelApplicationName\' in product.json. Remote tunneling is not available.');
118-
this.serverConfiguration = { authenticationProviders: {} };
118+
this.serverConfiguration = { authenticationProviders: {}, editorWebUrl: '', extension: { extensionId: '', friendlyName: '' } };
119119
return;
120120
}
121121
this.serverConfiguration = serverConfiguration;
@@ -422,16 +422,23 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
422422
const connectionInfo = await that.startTunnel(false);
423423
if (connectionInfo) {
424424
const linkToOpen = that.getLinkToOpen(connectionInfo);
425+
const remoteExtension = that.serverConfiguration.extension;
425426
await notificationService.notify({
426427
severity: Severity.Info,
427-
message: localize({ key: 'progress.turnOn.final', comment: ['{0} will be a host name, {1} will the link address to the web UI. [label](command:commandId) is a markdown lionk. Only translate label, never change the format'] },
428-
"Remote tunnel access is enabled for [{0}](command:{4}). To access from a different machine, open [{1}]({2}) or use the Remote - Tunnels extension. Use the Account menu to [configure](command:{3}) or [turn off](command:{5}).",
429-
connectionInfo.hostName, connectionInfo.domain, linkToOpen, RemoteTunnelCommandIds.manage, RemoteTunnelCommandIds.configure, RemoteTunnelCommandIds.turnOff),
428+
message:
429+
localize(
430+
{
431+
key: 'progress.turnOn.final',
432+
comment: ['{0} will be a host name, {1} will the link address to the web UI, {6} an extesnion name. [label](command:commandId) is a markdown link. Only translate the label, do not modify the format']
433+
},
434+
"Remote tunnel access is enabled for [{0}](command:{4}). To access from a different machine, open [{1}]({2}) or use the {6} extension. Use the Account menu to [configure](command:{3}) or [turn off](command:{5}).",
435+
connectionInfo.hostName, connectionInfo.domain, linkToOpen, RemoteTunnelCommandIds.manage, RemoteTunnelCommandIds.configure, RemoteTunnelCommandIds.turnOff, remoteExtension.friendlyName
436+
),
430437
actions: {
431438
primary: [
432439
new Action('copyToClipboard', localize('action.copyToClipboard', "Copy Browser Link to Clipboard"), undefined, true, () => clipboardService.writeText(linkToOpen)),
433440
new Action('showExtension', localize('action.showExtension', "Show Extension"), undefined, true, () => {
434-
return commandService.executeCommand('workbench.extensions.action.showExtensionsWithIds', ['ms-vscode.remote-server']);
441+
return commandService.executeCommand('workbench.extensions.action.showExtensionsWithIds', [remoteExtension.extensionId]);
435442
})
436443
]
437444
}
@@ -440,7 +447,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
440447
await notificationService.notify({
441448
severity: Severity.Info,
442449
message: localize('progress.turnOn.failed',
443-
"Unable to turn on the remote tunnel access. Check the Remote Tunnel log for details."),
450+
"Unable to turn on the remote tunnel access. Check the Remote Tunnel Service log for details."),
444451
});
445452
await commandService.executeCommand(RemoteTunnelCommandIds.showLog);
446453
}
@@ -622,7 +629,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
622629
items.push({ id: RemoteTunnelCommandIds.learnMore, label: RemoteTunnelCommandLabels.learnMore });
623630
if (this.connectionInfo && account) {
624631
quickPick.title = localize(
625-
{ key: 'manage.title.on', comment: ['{0} will be a user account name, {1} the provider name (e.g. Github), {2} is the machine name'] },
632+
{ key: 'manage.title.on', comment: ['{0} will be a user account name, {1} the provider name (e.g. Github), {2} is the host name'] },
626633
'Remote Machine Access enabled for {0}({1}) as {2}', account.label, account.description, this.connectionInfo.hostName);
627634
items.push({ id: RemoteTunnelCommandIds.copyToClipboard, label: RemoteTunnelCommandLabels.copyToClipboard, description: this.connectionInfo.domain });
628635
} else {

0 commit comments

Comments
 (0)