@theia/remote 1.51.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
@@ -1,140 +1,140 @@
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 * as React from '@theia/core/shared/react';
18
- import { ReactNode } from '@theia/core/shared/react';
19
- import { OpenerService, ReactWidget } from '@theia/core/lib/browser';
20
- import { nls, URI } from '@theia/core';
21
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
22
- import { ForwardedPort, PortForwardingService } from './port-forwarding-service';
23
- import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
24
-
25
- export const PORT_FORWARDING_WIDGET_ID = 'port-forwarding-widget';
26
-
27
- @injectable()
28
- export class PortForwardingWidget extends ReactWidget {
29
-
30
- @inject(PortForwardingService)
31
- protected readonly portForwardingService: PortForwardingService;
32
-
33
- @inject(OpenerService)
34
- protected readonly openerService: OpenerService;
35
-
36
- @inject(ClipboardService)
37
- protected readonly clipboardService: ClipboardService;
38
-
39
- @postConstruct()
40
- protected init(): void {
41
- this.id = PORT_FORWARDING_WIDGET_ID;
42
- this.node.tabIndex = -1;
43
- this.title.label = nls.localizeByDefault('Ports');
44
- this.title.caption = this.title.label;
45
- this.title.closable = true;
46
- this.update();
47
-
48
- this.portForwardingService.onDidChangePorts(() => this.update());
49
- }
50
-
51
- protected render(): ReactNode {
52
- if (this.portForwardingService.forwardedPorts.length === 0) {
53
- return <div>
54
- <p style={{ marginLeft: 'calc(var(--theia-ui-padding) * 2)' }}>
55
- {nls.localizeByDefault('No forwarded ports. Forward a port to access your locally running services over the internet.\n[Forward a Port]({0})').split('\n')[0]}
56
- </p>
57
- {this.renderForwardPortButton()}
58
- </div>;
59
- }
60
-
61
- return <div>
62
- <table className='port-table'>
63
- <thead>
64
- <tr>
65
- <th className='port-table-header'>{nls.localizeByDefault('Port')}</th>
66
- <th className='port-table-header'>{nls.localizeByDefault('Address')}</th>
67
- <th className='port-table-header'>{nls.localizeByDefault('Running Process')}</th>
68
- <th className='port-table-header'>{nls.localizeByDefault('Origin')}</th>
69
- </tr>
70
- </thead>
71
- <tbody>
72
- {this.portForwardingService.forwardedPorts.map(port => (
73
- <tr key={port.localPort ?? 'editing'}>
74
- {this.renderPortColumn(port)}
75
- {this.renderAddressColumn(port)}
76
- <td></td>
77
- <td>{port.origin ? nls.localizeByDefault(port.origin) : ''}</td>
78
- </tr>
79
- ))}
80
- {!this.portForwardingService.forwardedPorts.some(port => port.editing) && <tr><td>{this.renderForwardPortButton()}</td></tr>}
81
- </tbody>
82
- </table>
83
- </div>;
84
- }
85
-
86
- protected renderForwardPortButton(): ReactNode {
87
- return <button className='theia-button' onClick={() => {
88
- this.portForwardingService.forwardNewPort('User Forwarded');
89
- this.update();
90
- }
91
- }>{nls.localizeByDefault('Forward a Port')}</button>;
92
- }
93
-
94
- protected renderAddressColumn(port: ForwardedPort): ReactNode {
95
- const address = `${port.address ?? '0.0.0.0'}:${port.localPort}`;
96
- return <td>
97
- <div className='button-cell'>
98
- <span style={{ flexGrow: 1 }} className='forwarded-address' onClick={async e => {
99
- if (e.ctrlKey) {
100
- const uri = new URI(`http://${address}`);
101
- (await this.openerService.getOpener(uri)).open(uri);
102
- }
103
- }} title={nls.localizeByDefault('Follow link') + ' (ctrl/cmd + click)'}>
104
- {port.localPort ? address : ''}
105
- </span>
106
- {
107
- port.localPort &&
108
- <span className='codicon codicon-clippy action-label' title={nls.localizeByDefault('Copy Local Address')} onClick={() => {
109
- this.clipboardService.writeText(address);
110
- }}></span>
111
- }
112
- </div>
113
- </td>;
114
- }
115
-
116
- protected renderPortColumn(port: ForwardedPort): ReactNode {
117
- return port.editing ?
118
- <td><PortEditingInput port={port} service={this.portForwardingService} /></td> :
119
- <td>
120
- <div className='button-cell'>
121
- <span style={{ flexGrow: 1 }}>{port.localPort}</span>
122
- <span className='codicon codicon-close action-label' title={nls.localizeByDefault('Stop Forwarding Port')} onClick={() => {
123
- this.portForwardingService.removePort(port);
124
- this.update();
125
- }}></span>
126
- </div>
127
- </td>;
128
- }
129
-
130
- }
131
-
132
- function PortEditingInput({ port, service }: { port: ForwardedPort, service: PortForwardingService }): React.JSX.Element {
133
- const [error, setError] = React.useState(false);
134
- return <input className={`theia-input forward-port-button${error ? ' port-edit-input-error' : ''}`} port-edit-input-error={error}
135
- autoFocus defaultValue={port.address ? `${port.address}:${port.localPort}` : port.localPort ?? ''}
136
- placeholder={nls.localizeByDefault('Port number or address (eg. 3000 or 10.10.10.10:2000).')}
137
- onKeyDown={e => e.key === 'Enter' && !error && service.updatePort(port, e.currentTarget.value)}
138
- onKeyUp={e => setError(!service.isValidAddress(e.currentTarget.value))}></input>;
139
-
140
- }
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 * as React from '@theia/core/shared/react';
18
+ import { ReactNode } from '@theia/core/shared/react';
19
+ import { OpenerService, ReactWidget } from '@theia/core/lib/browser';
20
+ import { nls, URI } from '@theia/core';
21
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
22
+ import { ForwardedPort, PortForwardingService } from './port-forwarding-service';
23
+ import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
24
+
25
+ export const PORT_FORWARDING_WIDGET_ID = 'port-forwarding-widget';
26
+
27
+ @injectable()
28
+ export class PortForwardingWidget extends ReactWidget {
29
+
30
+ @inject(PortForwardingService)
31
+ protected readonly portForwardingService: PortForwardingService;
32
+
33
+ @inject(OpenerService)
34
+ protected readonly openerService: OpenerService;
35
+
36
+ @inject(ClipboardService)
37
+ protected readonly clipboardService: ClipboardService;
38
+
39
+ @postConstruct()
40
+ protected init(): void {
41
+ this.id = PORT_FORWARDING_WIDGET_ID;
42
+ this.node.tabIndex = -1;
43
+ this.title.label = nls.localizeByDefault('Ports');
44
+ this.title.caption = this.title.label;
45
+ this.title.closable = true;
46
+ this.update();
47
+
48
+ this.portForwardingService.onDidChangePorts(() => this.update());
49
+ }
50
+
51
+ protected render(): ReactNode {
52
+ if (this.portForwardingService.forwardedPorts.length === 0) {
53
+ return <div>
54
+ <p style={{ marginLeft: 'calc(var(--theia-ui-padding) * 2)' }}>
55
+ {nls.localizeByDefault('No forwarded ports. Forward a port to access your locally running services over the internet.\n[Forward a Port]({0})').split('\n')[0]}
56
+ </p>
57
+ {this.renderForwardPortButton()}
58
+ </div>;
59
+ }
60
+
61
+ return <div>
62
+ <table className='port-table'>
63
+ <thead>
64
+ <tr>
65
+ <th className='port-table-header'>{nls.localizeByDefault('Port')}</th>
66
+ <th className='port-table-header'>{nls.localizeByDefault('Address')}</th>
67
+ <th className='port-table-header'>{nls.localizeByDefault('Running Process')}</th>
68
+ <th className='port-table-header'>{nls.localizeByDefault('Origin')}</th>
69
+ </tr>
70
+ </thead>
71
+ <tbody>
72
+ {this.portForwardingService.forwardedPorts.map(port => (
73
+ <tr key={port.localPort ?? 'editing'}>
74
+ {this.renderPortColumn(port)}
75
+ {this.renderAddressColumn(port)}
76
+ <td></td>
77
+ <td>{port.origin ? nls.localizeByDefault(port.origin) : ''}</td>
78
+ </tr>
79
+ ))}
80
+ {!this.portForwardingService.forwardedPorts.some(port => port.editing) && <tr><td>{this.renderForwardPortButton()}</td></tr>}
81
+ </tbody>
82
+ </table>
83
+ </div>;
84
+ }
85
+
86
+ protected renderForwardPortButton(): ReactNode {
87
+ return <button className='theia-button' onClick={() => {
88
+ this.portForwardingService.forwardNewPort('User Forwarded');
89
+ this.update();
90
+ }
91
+ }>{nls.localizeByDefault('Forward a Port')}</button>;
92
+ }
93
+
94
+ protected renderAddressColumn(port: ForwardedPort): ReactNode {
95
+ const address = `${port.address ?? '0.0.0.0'}:${port.localPort}`;
96
+ return <td>
97
+ <div className='button-cell'>
98
+ <span style={{ flexGrow: 1 }} className='forwarded-address' onClick={async e => {
99
+ if (e.ctrlKey) {
100
+ const uri = new URI(`http://${address}`);
101
+ (await this.openerService.getOpener(uri)).open(uri);
102
+ }
103
+ }} title={nls.localizeByDefault('Follow link') + ' (ctrl/cmd + click)'}>
104
+ {port.localPort ? address : ''}
105
+ </span>
106
+ {
107
+ port.localPort &&
108
+ <span className='codicon codicon-clippy action-label' title={nls.localizeByDefault('Copy Local Address')} onClick={() => {
109
+ this.clipboardService.writeText(address);
110
+ }}></span>
111
+ }
112
+ </div>
113
+ </td>;
114
+ }
115
+
116
+ protected renderPortColumn(port: ForwardedPort): ReactNode {
117
+ return port.editing ?
118
+ <td><PortEditingInput port={port} service={this.portForwardingService} /></td> :
119
+ <td>
120
+ <div className='button-cell'>
121
+ <span style={{ flexGrow: 1 }}>{port.localPort}</span>
122
+ <span className='codicon codicon-close action-label' title={nls.localizeByDefault('Stop Forwarding Port')} onClick={() => {
123
+ this.portForwardingService.removePort(port);
124
+ this.update();
125
+ }}></span>
126
+ </div>
127
+ </td>;
128
+ }
129
+
130
+ }
131
+
132
+ function PortEditingInput({ port, service }: { port: ForwardedPort, service: PortForwardingService }): React.JSX.Element {
133
+ const [error, setError] = React.useState(false);
134
+ return <input className={`theia-input forward-port-button${error ? ' port-edit-input-error' : ''}`} port-edit-input-error={error}
135
+ autoFocus defaultValue={port.address ? `${port.address}:${port.localPort}` : port.localPort ?? ''}
136
+ placeholder={nls.localizeByDefault('Port number or address (eg. 3000 or 10.10.10.10:2000).')}
137
+ onKeyDown={e => e.key === 'Enter' && !error && service.updatePort(port, e.currentTarget.value)}
138
+ onKeyUp={e => setError(!service.isValidAddress(e.currentTarget.value))}></input>;
139
+
140
+ }
@@ -1,47 +1,47 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 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 { MaybeArray, URI } from '@theia/core';
18
- import { inject, injectable } from '@theia/core/shared/inversify';
19
- import { OpenFileDialogProps, SaveFileDialogProps } from '@theia/filesystem/lib/browser/file-dialog';
20
- import { FileStat } from '@theia/filesystem/lib/common/files';
21
- import { DefaultFileDialogService } from '@theia/filesystem/lib/browser/file-dialog/file-dialog-service';
22
- import { ElectronFileDialogService } from '@theia/filesystem/lib/electron-browser/file-dialog/electron-file-dialog-service';
23
- import { RemoteService } from './remote-service';
24
-
25
- @injectable()
26
- export class RemoteElectronFileDialogService extends ElectronFileDialogService {
27
-
28
- @inject(RemoteService) protected readonly remoteService: RemoteService;
29
-
30
- override showOpenDialog(props: OpenFileDialogProps & { canSelectMany: true; }, folder?: FileStat | undefined): Promise<MaybeArray<URI> | undefined>;
31
- override showOpenDialog(props: OpenFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined>;
32
- override showOpenDialog(props: OpenFileDialogProps, folder?: FileStat): Promise<MaybeArray<URI> | undefined> | Promise<URI | undefined> {
33
- if (this.remoteService.isConnected()) {
34
- return DefaultFileDialogService.prototype.showOpenDialog.call(this, props, folder);
35
- } else {
36
- return super.showOpenDialog(props, folder);
37
- }
38
- }
39
-
40
- override showSaveDialog(props: SaveFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined> {
41
- if (this.remoteService.isConnected()) {
42
- return DefaultFileDialogService.prototype.showSaveDialog.call(this, props, folder);
43
- } else {
44
- return super.showSaveDialog(props, folder);
45
- }
46
- }
47
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 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 { MaybeArray, URI } from '@theia/core';
18
+ import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { OpenFileDialogProps, SaveFileDialogProps } from '@theia/filesystem/lib/browser/file-dialog';
20
+ import { FileStat } from '@theia/filesystem/lib/common/files';
21
+ import { DefaultFileDialogService } from '@theia/filesystem/lib/browser/file-dialog/file-dialog-service';
22
+ import { ElectronFileDialogService } from '@theia/filesystem/lib/electron-browser/file-dialog/electron-file-dialog-service';
23
+ import { RemoteService } from './remote-service';
24
+
25
+ @injectable()
26
+ export class RemoteElectronFileDialogService extends ElectronFileDialogService {
27
+
28
+ @inject(RemoteService) protected readonly remoteService: RemoteService;
29
+
30
+ override showOpenDialog(props: OpenFileDialogProps & { canSelectMany: true; }, folder?: FileStat | undefined): Promise<MaybeArray<URI> | undefined>;
31
+ override showOpenDialog(props: OpenFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined>;
32
+ override showOpenDialog(props: OpenFileDialogProps, folder?: FileStat): Promise<MaybeArray<URI> | undefined> | Promise<URI | undefined> {
33
+ if (this.remoteService.isConnected()) {
34
+ return DefaultFileDialogService.prototype.showOpenDialog.call(this, props, folder);
35
+ } else {
36
+ return super.showOpenDialog(props, folder);
37
+ }
38
+ }
39
+
40
+ override showSaveDialog(props: SaveFileDialogProps, folder?: FileStat | undefined): Promise<URI | undefined> {
41
+ if (this.remoteService.isConnected()) {
42
+ return DefaultFileDialogService.prototype.showSaveDialog.call(this, props, folder);
43
+ } else {
44
+ return super.showSaveDialog(props, folder);
45
+ }
46
+ }
47
+ }