@theia/remote 1.52.0 → 1.53.0-next.55

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 (37) hide show
  1. package/README.md +61 -61
  2. package/lib/electron-node/setup/remote-setup-script-service.js +11 -11
  3. package/package.json +5 -5
  4. package/src/electron-browser/port-forwarding/port-forwading-contribution.ts +33 -33
  5. package/src/electron-browser/port-forwarding/port-forwarding-service.ts +92 -92
  6. package/src/electron-browser/port-forwarding/port-forwarding-widget.tsx +140 -140
  7. package/src/electron-browser/remote-electron-file-dialog-service.ts +47 -47
  8. package/src/electron-browser/remote-frontend-contribution.ts +143 -143
  9. package/src/electron-browser/remote-frontend-module.ts +68 -68
  10. package/src/electron-browser/remote-preferences.ts +62 -62
  11. package/src/electron-browser/remote-registry-contribution.ts +73 -73
  12. package/src/electron-browser/remote-service.ts +31 -31
  13. package/src/electron-browser/remote-ssh-contribution.ts +102 -102
  14. package/src/electron-browser/style/port-forwarding-widget.css +44 -44
  15. package/src/electron-common/remote-port-forwarding-provider.ts +30 -30
  16. package/src/electron-common/remote-ssh-connection-provider.ts +29 -29
  17. package/src/electron-common/remote-status-service.ts +35 -35
  18. package/src/electron-node/backend-remote-service-impl.ts +45 -45
  19. package/src/electron-node/remote-backend-module.ts +87 -87
  20. package/src/electron-node/remote-connection-service.ts +56 -56
  21. package/src/electron-node/remote-connection-socket-provider.ts +34 -34
  22. package/src/electron-node/remote-port-forwarding-provider.ts +66 -66
  23. package/src/electron-node/remote-proxy-server-provider.ts +37 -37
  24. package/src/electron-node/remote-status-service.ts +41 -41
  25. package/src/electron-node/remote-types.ts +64 -64
  26. package/src/electron-node/setup/app-native-dependency-contribution.ts +48 -48
  27. package/src/electron-node/setup/main-copy-contribution.ts +28 -28
  28. package/src/electron-node/setup/remote-copy-contribution.ts +74 -74
  29. package/src/electron-node/setup/remote-copy-service.ts +116 -116
  30. package/src/electron-node/setup/remote-native-dependency-contribution.ts +63 -63
  31. package/src/electron-node/setup/remote-native-dependency-service.ts +111 -111
  32. package/src/electron-node/setup/remote-node-setup-service.ts +123 -123
  33. package/src/electron-node/setup/remote-setup-script-service.ts +146 -146
  34. package/src/electron-node/setup/remote-setup-service.ts +220 -220
  35. package/src/electron-node/ssh/remote-ssh-connection-provider.ts +358 -358
  36. package/src/electron-node/ssh/ssh-identity-file-collector.ts +137 -137
  37. package/src/package.spec.ts +29 -29
package/README.md CHANGED
@@ -1,61 +1,61 @@
1
- <div align='center'>
2
-
3
- <br />
4
-
5
- <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
-
7
- <h2>ECLIPSE THEIA - REMOTE EXTENSION</h2>
8
-
9
- <hr />
10
-
11
- </div>
12
-
13
- ## Description
14
-
15
- This package implements functionality to connect to remote systems using Theia.
16
- This facilitates features similar to the features offered by Microsoft's popular `Remote-SSH`, `Dev Containers` or `WSL` extensions for VSCode.
17
-
18
- ## Package Architecture
19
-
20
- The following explains the basic flow of any remote connection. It will be exemplified using the remote SSH feature:
21
-
22
- 1. When the user runs the `SSH: Connect to Host...` command, we send the host info to the local backend.
23
- The corresponding `RemoteSSHConnectionProvider` is scoped to the current connection and can request additional information from the user, such as SSH key passphrases.
24
- 2. Once the `RemoteSSHConnectionProvider` has every information it needs, it creates a SSH connection and registers this connection to the general `RemoteConnectionService`.
25
- Every `RemoteConnection` type implements an interface that is able to handle 3 kinds of messages to the remote system:
26
- 1. Executing commands in the shell of the remote system
27
- 2. Copying data to the remote
28
- 3. Once the connection has been established, a setup process takes place on the remote system:
29
- 1. Identifying the remote platform (i.e. Windows, MacOS or Linux). This information is needed for all the following steps.
30
- 2. Setting up various directories for storing the application and its dependencies.
31
- 3. Download and install the correct Node.js version for the remote platform.
32
- 4. Packaging, copying, and unpackaging the local backend to the remote backend.
33
- 1. Every Theia extension can register `RemoteCopyContribution` binding to copy certain files from the current system.
34
- This contribution point is used for files that are used in all operating systems.
35
- 2. They can also register `RemoteNativeDependencyContribution` bindings to download and copy native dependencies for the remote system.
36
- The downloaded files are on a per-platform basis.
37
- 5. Using the node version that was installed in step 3, we now start the `main.js` of the backend application.
38
- We start the backend with `--port=0`, so that it searches for any available port. It will print the port to the console.
39
- The setup either returns with a setup error or the port of the remote server on the remote system.
40
- 4. With the remote server/port in place, the backend sets up a local proxy server on a random port.
41
- It instructs the `RemoteConnection` object to forward any HTTP request to this proxy server to the remote server.
42
- 5. The backend will return from the initial request from (1) with a new local proxy port. The frontend sets this port in the url and reload itself.
43
- 6. The frontend is now connected to the remote backend by connecting to the local proxy port.
44
- 7. The frontend now performs its normal messaging lifecycle, establishing connections to backend services.
45
- Although these backend services live on a different remote system, the frontend handles them as if they belong to the local backend.
46
-
47
- ## Additional Information
48
-
49
- - [API documentation for `@theia/remote`](https://eclipse-theia.github.io/theia/docs/next/modules/remote.html)
50
- - [Theia - GitHub](https://github.com/eclipse-theia/theia)
51
- - [Theia - Website](https://theia-ide.org/)
52
-
53
- ## License
54
-
55
- - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
56
- - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
57
-
58
- ## Trademark
59
-
60
- "Theia" is a trademark of the Eclipse Foundation
61
- https://www.eclipse.org/theia
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - REMOTE EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ This package implements functionality to connect to remote systems using Theia.
16
+ This facilitates features similar to the features offered by Microsoft's popular `Remote-SSH`, `Dev Containers` or `WSL` extensions for VSCode.
17
+
18
+ ## Package Architecture
19
+
20
+ The following explains the basic flow of any remote connection. It will be exemplified using the remote SSH feature:
21
+
22
+ 1. When the user runs the `SSH: Connect to Host...` command, we send the host info to the local backend.
23
+ The corresponding `RemoteSSHConnectionProvider` is scoped to the current connection and can request additional information from the user, such as SSH key passphrases.
24
+ 2. Once the `RemoteSSHConnectionProvider` has every information it needs, it creates a SSH connection and registers this connection to the general `RemoteConnectionService`.
25
+ Every `RemoteConnection` type implements an interface that is able to handle 3 kinds of messages to the remote system:
26
+ 1. Executing commands in the shell of the remote system
27
+ 2. Copying data to the remote
28
+ 3. Once the connection has been established, a setup process takes place on the remote system:
29
+ 1. Identifying the remote platform (i.e. Windows, MacOS or Linux). This information is needed for all the following steps.
30
+ 2. Setting up various directories for storing the application and its dependencies.
31
+ 3. Download and install the correct Node.js version for the remote platform.
32
+ 4. Packaging, copying, and unpackaging the local backend to the remote backend.
33
+ 1. Every Theia extension can register `RemoteCopyContribution` binding to copy certain files from the current system.
34
+ This contribution point is used for files that are used in all operating systems.
35
+ 2. They can also register `RemoteNativeDependencyContribution` bindings to download and copy native dependencies for the remote system.
36
+ The downloaded files are on a per-platform basis.
37
+ 5. Using the node version that was installed in step 3, we now start the `main.js` of the backend application.
38
+ We start the backend with `--port=0`, so that it searches for any available port. It will print the port to the console.
39
+ The setup either returns with a setup error or the port of the remote server on the remote system.
40
+ 4. With the remote server/port in place, the backend sets up a local proxy server on a random port.
41
+ It instructs the `RemoteConnection` object to forward any HTTP request to this proxy server to the remote server.
42
+ 5. The backend will return from the initial request from (1) with a new local proxy port. The frontend sets this port in the url and reload itself.
43
+ 6. The frontend is now connected to the remote backend by connecting to the local proxy port.
44
+ 7. The frontend now performs its normal messaging lifecycle, establishing connections to backend services.
45
+ Although these backend services live on a different remote system, the frontend handles them as if they belong to the local backend.
46
+
47
+ ## Additional Information
48
+
49
+ - [API documentation for `@theia/remote`](https://eclipse-theia.github.io/theia/docs/next/modules/remote.html)
50
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
51
+ - [Theia - Website](https://theia-ide.org/)
52
+
53
+ ## License
54
+
55
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
56
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
57
+
58
+ ## Trademark
59
+
60
+ "Theia" is a trademark of the Eclipse Foundation
61
+ https://www.eclipse.org/theia
@@ -54,17 +54,17 @@ let RemotePosixScriptStrategy = class RemotePosixScriptStrategy {
54
54
  return 'sh -c';
55
55
  }
56
56
  downloadFile(url, output) {
57
- return `
58
- if [ "$(command -v wget)" ]; then
59
- echo "Downloading using wget"
60
- wget -O "${output}" "${url}"
61
- elif [ "$(command -v curl)" ]; then
62
- echo "Downloading using curl"
63
- curl "${url}" --output "${output}"
64
- else
65
- echo "Failed to find wget or curl."
66
- exit 1
67
- fi
57
+ return `
58
+ if [ "$(command -v wget)" ]; then
59
+ echo "Downloading using wget"
60
+ wget -O "${output}" "${url}"
61
+ elif [ "$(command -v curl)" ]; then
62
+ echo "Downloading using curl"
63
+ curl "${url}" --output "${output}"
64
+ else
65
+ echo "Failed to find wget or curl."
66
+ exit 1
67
+ fi
68
68
  `.trim();
69
69
  }
70
70
  unzip(file, directory) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@theia/remote",
3
- "version": "1.52.0",
3
+ "version": "1.53.0-next.55+d1a989a68c",
4
4
  "description": "Theia - Remote",
5
5
  "dependencies": {
6
- "@theia/core": "1.52.0",
7
- "@theia/filesystem": "1.52.0",
6
+ "@theia/core": "1.53.0-next.55+d1a989a68c",
7
+ "@theia/filesystem": "1.53.0-next.55+d1a989a68c",
8
8
  "archiver": "^5.3.1",
9
9
  "decompress": "^4.2.1",
10
10
  "decompress-tar": "^4.0.0",
@@ -52,7 +52,7 @@
52
52
  "watch": "theiaext watch"
53
53
  },
54
54
  "devDependencies": {
55
- "@theia/ext-scripts": "1.52.0",
55
+ "@theia/ext-scripts": "1.53.0",
56
56
  "@types/archiver": "^5.3.2",
57
57
  "@types/decompress": "^4.2.4",
58
58
  "@types/express-http-proxy": "^1.6.3",
@@ -63,5 +63,5 @@
63
63
  "nyc": {
64
64
  "extends": "../../configs/nyc.json"
65
65
  },
66
- "gitHead": "40ceebcd4ee75f13ec16b9dc7314e9384493c1ac"
66
+ "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
67
67
  }
@@ -1,33 +1,33 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2024 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { nls } from '@theia/core';
18
- import { AbstractViewContribution } from '@theia/core/lib/browser';
19
- import { injectable } from '@theia/core/shared/inversify';
20
- import { PortForwardingWidget, PORT_FORWARDING_WIDGET_ID } from './port-forwarding-widget';
21
-
22
- @injectable()
23
- export class PortForwardingContribution extends AbstractViewContribution<PortForwardingWidget> {
24
- constructor() {
25
- super({
26
- widgetId: PORT_FORWARDING_WIDGET_ID,
27
- widgetName: nls.localizeByDefault('Ports'),
28
- defaultWidgetOptions: {
29
- area: 'bottom'
30
- }
31
- });
32
- }
33
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { nls } from '@theia/core';
18
+ import { AbstractViewContribution } from '@theia/core/lib/browser';
19
+ import { injectable } from '@theia/core/shared/inversify';
20
+ import { PortForwardingWidget, PORT_FORWARDING_WIDGET_ID } from './port-forwarding-widget';
21
+
22
+ @injectable()
23
+ export class PortForwardingContribution extends AbstractViewContribution<PortForwardingWidget> {
24
+ constructor() {
25
+ super({
26
+ widgetId: PORT_FORWARDING_WIDGET_ID,
27
+ widgetName: nls.localizeByDefault('Ports'),
28
+ defaultWidgetOptions: {
29
+ area: 'bottom'
30
+ }
31
+ });
32
+ }
33
+ }
@@ -1,92 +1,92 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2024 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { Emitter } from '@theia/core';
18
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
19
- import { RemotePortForwardingProvider } from '../../electron-common/remote-port-forwarding-provider';
20
-
21
- export interface ForwardedPort {
22
- localPort?: number;
23
- address?: string;
24
- origin?: string;
25
- editing: boolean;
26
- }
27
-
28
- @injectable()
29
- export class PortForwardingService {
30
-
31
- @inject(RemotePortForwardingProvider)
32
- readonly provider: RemotePortForwardingProvider;
33
-
34
- protected readonly onDidChangePortsEmitter = new Emitter<void>();
35
- readonly onDidChangePorts = this.onDidChangePortsEmitter.event;
36
-
37
- forwardedPorts: ForwardedPort[] = [];
38
-
39
- @postConstruct()
40
- init(): void {
41
- this.provider.getForwardedPorts().then(ports => {
42
- this.forwardedPorts = ports.map(p => ({ address: p.address, localPort: p.port, editing: false }));
43
- this.onDidChangePortsEmitter.fire();
44
- });
45
- }
46
-
47
- forwardNewPort(origin?: string): ForwardedPort {
48
- const index = this.forwardedPorts.push({ editing: true, origin });
49
- return this.forwardedPorts[index - 1];
50
- }
51
-
52
- updatePort(port: ForwardedPort, newAdress: string): void {
53
- const connectionPort = new URLSearchParams(location.search).get('port');
54
- if (!connectionPort) {
55
- // if there is no open remote connection we can't forward a port
56
- return;
57
- }
58
-
59
- const parts = newAdress.split(':');
60
- if (parts.length === 2) {
61
- port.address = parts[0];
62
- port.localPort = parseInt(parts[1]);
63
- } else {
64
- port.localPort = parseInt(parts[0]);
65
- }
66
-
67
- port.editing = false;
68
-
69
- this.provider.forwardPort(parseInt(connectionPort), { port: port.localPort!, address: port.address });
70
- this.onDidChangePortsEmitter.fire();
71
- }
72
-
73
- removePort(port: ForwardedPort): void {
74
- const index = this.forwardedPorts.indexOf(port);
75
- if (index !== -1) {
76
- this.forwardedPorts.splice(index, 1);
77
- this.provider.portRemoved({ port: port.localPort! });
78
- this.onDidChangePortsEmitter.fire();
79
- }
80
- }
81
-
82
- isValidAddress(address: string): boolean {
83
- const match = address.match(/^(.*:)?\d+$/);
84
- if (!match) {
85
- return false;
86
- }
87
-
88
- const port = parseInt(address.includes(':') ? address.split(':')[1] : address);
89
-
90
- return !this.forwardedPorts.some(p => p.localPort === port);
91
- }
92
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Emitter } from '@theia/core';
18
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
19
+ import { RemotePortForwardingProvider } from '../../electron-common/remote-port-forwarding-provider';
20
+
21
+ export interface ForwardedPort {
22
+ localPort?: number;
23
+ address?: string;
24
+ origin?: string;
25
+ editing: boolean;
26
+ }
27
+
28
+ @injectable()
29
+ export class PortForwardingService {
30
+
31
+ @inject(RemotePortForwardingProvider)
32
+ readonly provider: RemotePortForwardingProvider;
33
+
34
+ protected readonly onDidChangePortsEmitter = new Emitter<void>();
35
+ readonly onDidChangePorts = this.onDidChangePortsEmitter.event;
36
+
37
+ forwardedPorts: ForwardedPort[] = [];
38
+
39
+ @postConstruct()
40
+ init(): void {
41
+ this.provider.getForwardedPorts().then(ports => {
42
+ this.forwardedPorts = ports.map(p => ({ address: p.address, localPort: p.port, editing: false }));
43
+ this.onDidChangePortsEmitter.fire();
44
+ });
45
+ }
46
+
47
+ forwardNewPort(origin?: string): ForwardedPort {
48
+ const index = this.forwardedPorts.push({ editing: true, origin });
49
+ return this.forwardedPorts[index - 1];
50
+ }
51
+
52
+ updatePort(port: ForwardedPort, newAdress: string): void {
53
+ const connectionPort = new URLSearchParams(location.search).get('port');
54
+ if (!connectionPort) {
55
+ // if there is no open remote connection we can't forward a port
56
+ return;
57
+ }
58
+
59
+ const parts = newAdress.split(':');
60
+ if (parts.length === 2) {
61
+ port.address = parts[0];
62
+ port.localPort = parseInt(parts[1]);
63
+ } else {
64
+ port.localPort = parseInt(parts[0]);
65
+ }
66
+
67
+ port.editing = false;
68
+
69
+ this.provider.forwardPort(parseInt(connectionPort), { port: port.localPort!, address: port.address });
70
+ this.onDidChangePortsEmitter.fire();
71
+ }
72
+
73
+ removePort(port: ForwardedPort): void {
74
+ const index = this.forwardedPorts.indexOf(port);
75
+ if (index !== -1) {
76
+ this.forwardedPorts.splice(index, 1);
77
+ this.provider.portRemoved({ port: port.localPort! });
78
+ this.onDidChangePortsEmitter.fire();
79
+ }
80
+ }
81
+
82
+ isValidAddress(address: string): boolean {
83
+ const match = address.match(/^(.*:)?\d+$/);
84
+ if (!match) {
85
+ return false;
86
+ }
87
+
88
+ const port = parseInt(address.includes(':') ? address.split(':')[1] : address);
89
+
90
+ return !this.forwardedPorts.some(p => p.localPort === port);
91
+ }
92
+ }