@theia/remote 1.45.1 → 1.46.0-next.241

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +1 -1
  2. package/lib/electron-browser/local-backend-services.d.ts +11 -0
  3. package/lib/electron-browser/local-backend-services.d.ts.map +1 -0
  4. package/lib/electron-browser/local-backend-services.js +37 -0
  5. package/lib/electron-browser/local-backend-services.js.map +1 -0
  6. package/lib/electron-browser/port-forwarding/port-forwading-contribution.d.ts +6 -0
  7. package/lib/electron-browser/port-forwarding/port-forwading-contribution.d.ts.map +1 -0
  8. package/lib/electron-browser/port-forwarding/port-forwading-contribution.js +40 -0
  9. package/lib/electron-browser/port-forwarding/port-forwading-contribution.js.map +1 -0
  10. package/lib/electron-browser/port-forwarding/port-forwarding-service.d.ts +20 -0
  11. package/lib/electron-browser/port-forwarding/port-forwarding-service.d.ts.map +1 -0
  12. package/lib/electron-browser/port-forwarding/port-forwarding-service.js +89 -0
  13. package/lib/electron-browser/port-forwarding/port-forwarding-service.js.map +1 -0
  14. package/lib/electron-browser/port-forwarding/port-forwarding-widget.d.ts +17 -0
  15. package/lib/electron-browser/port-forwarding/port-forwarding-widget.d.ts.map +1 -0
  16. package/lib/electron-browser/port-forwarding/port-forwarding-widget.js +125 -0
  17. package/lib/electron-browser/port-forwarding/port-forwarding-widget.js.map +1 -0
  18. package/lib/electron-browser/remote-electron-file-dialog-service.js +5 -13
  19. package/lib/electron-browser/remote-electron-file-dialog-service.js.map +1 -1
  20. package/lib/electron-browser/remote-frontend-contribution.d.ts +1 -1
  21. package/lib/electron-browser/remote-frontend-contribution.d.ts.map +1 -1
  22. package/lib/electron-browser/remote-frontend-contribution.js +27 -33
  23. package/lib/electron-browser/remote-frontend-contribution.js.map +1 -1
  24. package/lib/electron-browser/remote-frontend-module.d.ts +1 -0
  25. package/lib/electron-browser/remote-frontend-module.d.ts.map +1 -1
  26. package/lib/electron-browser/remote-frontend-module.js +29 -2
  27. package/lib/electron-browser/remote-frontend-module.js.map +1 -1
  28. package/lib/electron-browser/remote-preferences.d.ts +1 -1
  29. package/lib/electron-browser/remote-preferences.d.ts.map +1 -1
  30. package/lib/electron-browser/remote-registry-contribution.d.ts +1 -1
  31. package/lib/electron-browser/remote-registry-contribution.d.ts.map +1 -1
  32. package/lib/electron-browser/remote-registry-contribution.js +11 -16
  33. package/lib/electron-browser/remote-registry-contribution.js.map +1 -1
  34. package/lib/electron-browser/remote-service.js +3 -8
  35. package/lib/electron-browser/remote-service.js.map +1 -1
  36. package/lib/electron-browser/remote-ssh-contribution.js +12 -20
  37. package/lib/electron-browser/remote-ssh-contribution.js.map +1 -1
  38. package/lib/electron-browser/remote-user-storage-provider.d.ts +21 -0
  39. package/lib/electron-browser/remote-user-storage-provider.d.ts.map +1 -0
  40. package/lib/electron-browser/remote-user-storage-provider.js +75 -0
  41. package/lib/electron-browser/remote-user-storage-provider.js.map +1 -0
  42. package/lib/electron-common/remote-port-forwarding-provider.d.ts +12 -0
  43. package/lib/electron-common/remote-port-forwarding-provider.d.ts.map +1 -0
  44. package/lib/electron-common/remote-port-forwarding-provider.js +21 -0
  45. package/lib/electron-common/remote-port-forwarding-provider.js.map +1 -0
  46. package/lib/electron-common/remote-status-service.d.ts +2 -1
  47. package/lib/electron-common/remote-status-service.d.ts.map +1 -1
  48. package/lib/electron-node/backend-remote-service-impl.d.ts +1 -1
  49. package/lib/electron-node/backend-remote-service-impl.d.ts.map +1 -1
  50. package/lib/electron-node/backend-remote-service-impl.js +4 -9
  51. package/lib/electron-node/backend-remote-service-impl.js.map +1 -1
  52. package/lib/electron-node/remote-backend-module.d.ts.map +1 -1
  53. package/lib/electron-node/remote-backend-module.js +10 -4
  54. package/lib/electron-node/remote-backend-module.js.map +1 -1
  55. package/lib/electron-node/remote-connection-service.d.ts +2 -2
  56. package/lib/electron-node/remote-connection-service.d.ts.map +1 -1
  57. package/lib/electron-node/remote-connection-service.js +17 -19
  58. package/lib/electron-node/remote-connection-service.js.map +1 -1
  59. package/lib/electron-node/remote-connection-socket-provider.js +3 -8
  60. package/lib/electron-node/remote-connection-socket-provider.js.map +1 -1
  61. package/lib/electron-node/remote-port-forwarding-provider.d.ts +19 -0
  62. package/lib/electron-node/remote-port-forwarding-provider.d.ts.map +1 -0
  63. package/lib/electron-node/remote-port-forwarding-provider.js +59 -0
  64. package/lib/electron-node/remote-port-forwarding-provider.js.map +1 -0
  65. package/lib/electron-node/remote-proxy-server-provider.js +3 -8
  66. package/lib/electron-node/remote-proxy-server-provider.js.map +1 -1
  67. package/lib/electron-node/remote-status-service.d.ts +1 -0
  68. package/lib/electron-node/remote-status-service.d.ts.map +1 -1
  69. package/lib/electron-node/remote-status-service.js +11 -13
  70. package/lib/electron-node/remote-status-service.js.map +1 -1
  71. package/lib/electron-node/remote-types.d.ts +21 -8
  72. package/lib/electron-node/remote-types.d.ts.map +1 -1
  73. package/lib/electron-node/setup/app-native-dependency-contribution.d.ts +1 -1
  74. package/lib/electron-node/setup/app-native-dependency-contribution.d.ts.map +1 -1
  75. package/lib/electron-node/setup/app-native-dependency-contribution.js +3 -8
  76. package/lib/electron-node/setup/app-native-dependency-contribution.js.map +1 -1
  77. package/lib/electron-node/setup/main-copy-contribution.d.ts +1 -1
  78. package/lib/electron-node/setup/main-copy-contribution.d.ts.map +1 -1
  79. package/lib/electron-node/setup/main-copy-contribution.js +3 -8
  80. package/lib/electron-node/setup/main-copy-contribution.js.map +1 -1
  81. package/lib/electron-node/setup/remote-copy-contribution.d.ts +3 -19
  82. package/lib/electron-node/setup/remote-copy-contribution.d.ts.map +1 -1
  83. package/lib/electron-node/setup/remote-copy-contribution.js +20 -25
  84. package/lib/electron-node/setup/remote-copy-contribution.js.map +1 -1
  85. package/lib/electron-node/setup/remote-copy-service.d.ts +5 -3
  86. package/lib/electron-node/setup/remote-copy-service.d.ts.map +1 -1
  87. package/lib/electron-node/setup/remote-copy-service.js +14 -21
  88. package/lib/electron-node/setup/remote-copy-service.js.map +1 -1
  89. package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts +2 -2
  90. package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts.map +1 -1
  91. package/lib/electron-node/setup/remote-native-dependency-contribution.js +2 -2
  92. package/lib/electron-node/setup/remote-native-dependency-contribution.js.map +1 -1
  93. package/lib/electron-node/setup/remote-native-dependency-service.d.ts +1 -1
  94. package/lib/electron-node/setup/remote-native-dependency-service.d.ts.map +1 -1
  95. package/lib/electron-node/setup/remote-native-dependency-service.js +7 -15
  96. package/lib/electron-node/setup/remote-native-dependency-service.js.map +1 -1
  97. package/lib/electron-node/setup/remote-node-setup-service.d.ts +1 -1
  98. package/lib/electron-node/setup/remote-node-setup-service.d.ts.map +1 -1
  99. package/lib/electron-node/setup/remote-node-setup-service.js +7 -15
  100. package/lib/electron-node/setup/remote-node-setup-service.js.map +1 -1
  101. package/lib/electron-node/setup/remote-setup-script-service.d.ts +1 -1
  102. package/lib/electron-node/setup/remote-setup-script-service.d.ts.map +1 -1
  103. package/lib/electron-node/setup/remote-setup-script-service.js +11 -19
  104. package/lib/electron-node/setup/remote-setup-script-service.js.map +1 -1
  105. package/lib/electron-node/setup/remote-setup-service.d.ts +9 -2
  106. package/lib/electron-node/setup/remote-setup-service.d.ts.map +1 -1
  107. package/lib/electron-node/setup/remote-setup-service.js +39 -23
  108. package/lib/electron-node/setup/remote-setup-service.js.map +1 -1
  109. package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts +1 -1
  110. package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts.map +1 -1
  111. package/lib/electron-node/ssh/remote-ssh-connection-provider.js +28 -34
  112. package/lib/electron-node/ssh/remote-ssh-connection-provider.js.map +1 -1
  113. package/lib/electron-node/ssh/ssh-identity-file-collector.js +3 -8
  114. package/lib/electron-node/ssh/ssh-identity-file-collector.js.map +1 -1
  115. package/package.json +11 -10
  116. package/src/electron-browser/local-backend-services.ts +31 -0
  117. package/src/electron-browser/port-forwarding/port-forwading-contribution.ts +33 -0
  118. package/src/electron-browser/port-forwarding/port-forwarding-service.ts +93 -0
  119. package/src/electron-browser/port-forwarding/port-forwarding-widget.tsx +140 -0
  120. package/src/electron-browser/remote-frontend-contribution.ts +9 -7
  121. package/src/electron-browser/remote-frontend-module.ts +39 -3
  122. package/src/electron-browser/remote-registry-contribution.ts +9 -6
  123. package/src/electron-browser/remote-user-storage-provider.ts +64 -0
  124. package/src/electron-browser/style/port-forwarding-widget.css +44 -0
  125. package/src/electron-common/remote-port-forwarding-provider.ts +30 -0
  126. package/src/electron-common/remote-status-service.ts +3 -1
  127. package/src/electron-node/backend-remote-service-impl.ts +1 -1
  128. package/src/electron-node/remote-backend-module.ts +10 -3
  129. package/src/electron-node/remote-connection-service.ts +9 -4
  130. package/src/electron-node/remote-port-forwarding-provider.ts +66 -0
  131. package/src/electron-node/remote-status-service.ts +7 -0
  132. package/src/electron-node/remote-types.ts +20 -7
  133. package/src/electron-node/setup/app-native-dependency-contribution.ts +1 -1
  134. package/src/electron-node/setup/main-copy-contribution.ts +1 -1
  135. package/src/electron-node/setup/remote-copy-contribution.ts +14 -30
  136. package/src/electron-node/setup/remote-copy-service.ts +6 -4
  137. package/src/electron-node/setup/remote-native-dependency-contribution.ts +1 -1
  138. package/src/electron-node/setup/remote-native-dependency-service.ts +1 -1
  139. package/src/electron-node/setup/remote-node-setup-service.ts +1 -1
  140. package/src/electron-node/setup/remote-setup-script-service.ts +1 -1
  141. package/src/electron-node/setup/remote-setup-service.ts +31 -6
  142. package/src/electron-node/ssh/remote-ssh-connection-provider.ts +10 -8
@@ -16,36 +16,15 @@
16
16
 
17
17
  import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
18
18
  import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { RemoteCopyRegistry, RemoteFile, RemoteCopyOptions } from '@theia/core/lib/node/remote/remote-copy-contribution';
19
20
  import { glob as globCallback } from 'glob';
20
21
  import { promisify } from 'util';
21
22
  import * as path from 'path';
22
- import { MaybePromise } from '@theia/core';
23
23
 
24
24
  const promiseGlob = promisify(globCallback);
25
25
 
26
- export const RemoteCopyContribution = Symbol('RemoteCopyContribution');
27
-
28
- export interface RemoteCopyContribution {
29
- copy(registry: RemoteCopyRegistry): MaybePromise<void>
30
- }
31
-
32
- export interface RemoteCopyOptions {
33
- /**
34
- * The mode that the file should be set to once copied to the remote.
35
- *
36
- * Only relevant for POSIX-like systems
37
- */
38
- mode?: number;
39
- }
40
-
41
- export interface RemoteFile {
42
- path: string
43
- target: string
44
- options?: RemoteCopyOptions;
45
- }
46
-
47
26
  @injectable()
48
- export class RemoteCopyRegistry {
27
+ export class RemoteCopyRegistryImpl implements RemoteCopyRegistry {
49
28
 
50
29
  @inject(ApplicationPackage)
51
30
  protected readonly applicationPackage: ApplicationPackage;
@@ -57,15 +36,16 @@ export class RemoteCopyRegistry {
57
36
  }
58
37
 
59
38
  async glob(pattern: string, target?: string): Promise<void> {
39
+ return this.doGlob(pattern, this.applicationPackage.projectPath, target);
40
+ }
41
+
42
+ async doGlob(pattern: string, cwd: string, target?: string): Promise<void> {
60
43
  const projectPath = this.applicationPackage.projectPath;
61
- const globResult = await promiseGlob(pattern, {
62
- cwd: projectPath
63
- });
64
- const relativeFiles = globResult.map(file => path.relative(projectPath, file));
65
- for (const file of relativeFiles) {
44
+ const globResult = await promiseGlob(pattern, { cwd, nodir: true });
45
+ for (const file of globResult) {
66
46
  const targetFile = this.withTarget(file, target);
67
47
  this.files.push({
68
- path: file,
48
+ path: path.relative(projectPath, path.resolve(cwd, file)),
69
49
  target: targetFile
70
50
  });
71
51
  }
@@ -81,7 +61,11 @@ export class RemoteCopyRegistry {
81
61
  }
82
62
 
83
63
  async directory(dir: string, target?: string): Promise<void> {
84
- return this.glob(dir + '/**', target);
64
+ let absoluteDir = dir;
65
+ if (!path.isAbsolute(absoluteDir)) {
66
+ absoluteDir = path.join(this.applicationPackage.projectPath, dir);
67
+ }
68
+ return this.doGlob('**/*', absoluteDir, target ?? dir);
85
69
  }
86
70
 
87
71
  protected withTarget(file: string, target?: string): string {
@@ -20,10 +20,12 @@ import * as fs from 'fs';
20
20
  import * as os from 'os';
21
21
  import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
22
22
  import { inject, injectable, named } from '@theia/core/shared/inversify';
23
- import { RemoteConnection, RemotePlatform } from '../remote-types';
23
+ import { RemoteConnection } from '../remote-types';
24
+ import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
24
25
  import { RemoteNativeDependencyService } from './remote-native-dependency-service';
25
26
  import { ContributionProvider } from '@theia/core';
26
- import { RemoteCopyContribution, RemoteCopyRegistry, RemoteFile } from './remote-copy-contribution';
27
+ import { RemoteCopyRegistryImpl } from './remote-copy-contribution';
28
+ import { RemoteCopyContribution, RemoteFile } from '@theia/core/lib/node/remote/remote-copy-contribution';
27
29
 
28
30
  @injectable()
29
31
  export class RemoteCopyService {
@@ -31,8 +33,8 @@ export class RemoteCopyService {
31
33
  @inject(ApplicationPackage)
32
34
  protected readonly applicationPackage: ApplicationPackage;
33
35
 
34
- @inject(RemoteCopyRegistry)
35
- protected readonly copyRegistry: RemoteCopyRegistry;
36
+ @inject(RemoteCopyRegistryImpl)
37
+ protected readonly copyRegistry: RemoteCopyRegistryImpl;
36
38
 
37
39
  @inject(RemoteNativeDependencyService)
38
40
  protected readonly nativeDependencyService: RemoteNativeDependencyService;
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { isObject } from '@theia/core';
18
18
  import { RequestOptions } from '@theia/core/shared/@theia/request';
19
- import { RemotePlatform } from '../remote-types';
19
+ import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
20
20
 
21
21
  export interface FileDependencyResult {
22
22
  path: string;
@@ -21,7 +21,7 @@ import * as decompress from 'decompress';
21
21
  import * as path from 'path';
22
22
  import * as fs from 'fs/promises';
23
23
  import { DependencyDownload, DirectoryDependencyDownload, RemoteNativeDependencyContribution } from './remote-native-dependency-contribution';
24
- import { RemotePlatform } from '../remote-types';
24
+ import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
25
25
 
26
26
  const decompressTar = require('decompress-tar');
27
27
  const decompressTargz = require('decompress-targz');
@@ -21,7 +21,7 @@ import * as os from 'os';
21
21
  import { inject, injectable } from '@theia/core/shared/inversify';
22
22
  import { RequestService } from '@theia/core/shared/@theia/request';
23
23
  import { RemoteSetupScriptService } from './remote-setup-script-service';
24
- import { RemotePlatform } from '../remote-types';
24
+ import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
25
25
  import { OS } from '@theia/core';
26
26
 
27
27
  /**
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { OS } from '@theia/core';
18
18
  import { inject, injectable } from '@theia/core/shared/inversify';
19
- import { RemotePlatform } from '../remote-types';
19
+ import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
20
20
 
21
21
  export interface RemoteScriptStrategy {
22
22
  exec(): string;
@@ -14,12 +14,13 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import { RemoteConnection, RemoteExecResult, RemotePlatform, RemoteStatusReport } from '../remote-types';
17
+ import { inject, injectable, named } from '@theia/core/shared/inversify';
18
+ import { RemoteConnection, RemoteExecResult, RemoteStatusReport } from '../remote-types';
19
+ import { RemoteCliContext, RemoteCliContribution, RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
19
20
  import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
20
21
  import { RemoteCopyService } from './remote-copy-service';
21
22
  import { RemoteNativeDependencyService } from './remote-native-dependency-service';
22
- import { OS, THEIA_VERSION } from '@theia/core';
23
+ import { ContributionProvider, OS, THEIA_VERSION } from '@theia/core';
23
24
  import { RemoteNodeSetupService } from './remote-node-setup-service';
24
25
  import { RemoteSetupScriptService } from './remote-setup-script-service';
25
26
 
@@ -29,6 +30,11 @@ export interface RemoteSetupOptions {
29
30
  nodeDownloadTemplate?: string;
30
31
  }
31
32
 
33
+ export interface RemoteSetupResult {
34
+ applicationDirectory: string;
35
+ nodeDirectory: string;
36
+ }
37
+
32
38
  @injectable()
33
39
  export class RemoteSetupService {
34
40
 
@@ -47,7 +53,10 @@ export class RemoteSetupService {
47
53
  @inject(ApplicationPackage)
48
54
  protected readonly applicationPackage: ApplicationPackage;
49
55
 
50
- async setup(options: RemoteSetupOptions): Promise<void> {
56
+ @inject(ContributionProvider) @named(RemoteCliContribution)
57
+ protected readonly cliContributions: ContributionProvider<RemoteCliContribution>;
58
+
59
+ async setup(options: RemoteSetupOptions): Promise<RemoteSetupResult> {
51
60
  const {
52
61
  connection,
53
62
  report,
@@ -86,22 +95,36 @@ export class RemoteSetupService {
86
95
  report('Starting application on remote...');
87
96
  const port = await this.startApplication(connection, platform, applicationDirectory, remoteNodeDirectory);
88
97
  connection.remotePort = port;
98
+ return {
99
+ applicationDirectory: libDir,
100
+ nodeDirectory: remoteNodeDirectory
101
+ };
89
102
  }
90
103
 
91
104
  protected async startApplication(connection: RemoteConnection, platform: RemotePlatform, remotePath: string, nodeDir: string): Promise<number> {
92
105
  const nodeExecutable = this.scriptService.joinPath(platform, nodeDir, ...(platform.os === OS.Type.Windows ? ['node.exe'] : ['bin', 'node']));
93
106
  const mainJsFile = this.scriptService.joinPath(platform, remotePath, 'lib', 'backend', 'main.js');
94
- const localAddressRegex = /listening on http:\/\/127.0.0.1:(\d+)/;
107
+ const localAddressRegex = /listening on http:\/\/0.0.0.0:(\d+)/;
95
108
  let prefix = '';
96
109
  if (platform.os === OS.Type.Windows) {
97
110
  // We might to switch to PowerShell beforehand on Windows
98
111
  prefix = this.scriptService.exec(platform) + ' ';
99
112
  }
113
+ const remoteContext: RemoteCliContext = {
114
+ platform,
115
+ directory: remotePath
116
+ };
117
+ const args: string[] = ['--hostname=0.0.0.0', `--port=${connection.remotePort ?? 0}`, '--remote'];
118
+ for (const cli of this.cliContributions.getContributions()) {
119
+ if (cli.enhanceArgs) {
120
+ args.push(...await cli.enhanceArgs(remoteContext));
121
+ }
122
+ }
100
123
  // Change to the remote application path and start a node process with the copied main.js file
101
124
  // This way, our current working directory is set as expected
102
125
  const result = await connection.execPartial(`${prefix}cd "${remotePath}";${nodeExecutable}`,
103
126
  stdout => localAddressRegex.test(stdout),
104
- [mainJsFile, '--hostname=127.0.0.1', '--port=0', '--remote']);
127
+ [mainJsFile, ...args]);
105
128
 
106
129
  const match = localAddressRegex.exec(result.stdout);
107
130
  if (!match) {
@@ -144,6 +167,8 @@ export class RemoteSetupService {
144
167
  arch = 'x64';
145
168
  } else if (archResult.match(/i\d83/)) { // i386, i483, i683
146
169
  arch = 'x86';
170
+ } else if (archResult.includes('aarch64')) {
171
+ arch = 'arm64';
147
172
  } else {
148
173
  arch = archResult.trim();
149
174
  }
@@ -27,7 +27,7 @@ import { RemoteConnection, RemoteExecOptions, RemoteExecResult, RemoteExecTester
27
27
  import { Deferred, timeout } from '@theia/core/lib/common/promise-util';
28
28
  import { SSHIdentityFileCollector, SSHKey } from './ssh-identity-file-collector';
29
29
  import { RemoteSetupService } from '../setup/remote-setup-service';
30
- import { v4 } from 'uuid';
30
+ import { generateUuid } from '@theia/core/lib/common/uuid';
31
31
 
32
32
  @injectable()
33
33
  export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvider {
@@ -86,13 +86,14 @@ export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvi
86
86
  const deferred = new Deferred<RemoteSSHConnection>();
87
87
  const sshClient = new ssh2.Client();
88
88
  const identityFiles = await this.identityFileCollector.gatherIdentityFiles();
89
- const sshAuthHandler = this.getAuthHandler(user, host, identityFiles);
89
+ const hostUrl = new URL(`ssh://${host}`);
90
+ const sshAuthHandler = this.getAuthHandler(user, hostUrl.hostname, identityFiles);
90
91
  sshClient
91
92
  .on('ready', async () => {
92
93
  const connection = new RemoteSSHConnection({
93
94
  client: sshClient,
94
- id: v4(),
95
- name: host,
95
+ id: generateUuid(),
96
+ name: hostUrl.hostname,
96
97
  type: 'SSH'
97
98
  });
98
99
  try {
@@ -102,11 +103,12 @@ export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvi
102
103
  deferred.reject(err);
103
104
  }
104
105
  }).on('end', () => {
105
- console.log(`Ended remote connection to host '${user}@${host}'`);
106
+ console.log(`Ended remote connection to host '${user}@${hostUrl.hostname}'`);
106
107
  }).on('error', err => {
107
108
  deferred.reject(err);
108
109
  }).connect({
109
- host: host,
110
+ host: hostUrl.hostname,
111
+ port: hostUrl.port ? parseInt(hostUrl.port, 10) : undefined,
110
112
  username: user,
111
113
  authHandler: (methodsLeft, successes, callback) => (sshAuthHandler(methodsLeft, successes, callback), undefined)
112
114
  });
@@ -276,8 +278,8 @@ export class RemoteSSHConnection implements RemoteConnection {
276
278
  return sftpClient;
277
279
  }
278
280
 
279
- forwardOut(socket: net.Socket): void {
280
- this.client.forwardOut(socket.localAddress!, socket.localPort!, '127.0.0.1', this.remotePort, (err, stream) => {
281
+ forwardOut(socket: net.Socket, port?: number): void {
282
+ this.client.forwardOut(socket.localAddress!, socket.localPort!, '127.0.0.1', port ?? this.remotePort, (err, stream) => {
281
283
  if (err) {
282
284
  console.debug('Proxy message rejected', err);
283
285
  } else {