@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.
- package/README.md +61 -61
- package/lib/electron-node/setup/remote-setup-script-service.js +11 -11
- package/package.json +5 -5
- package/src/electron-browser/port-forwarding/port-forwading-contribution.ts +33 -33
- package/src/electron-browser/port-forwarding/port-forwarding-service.ts +92 -92
- package/src/electron-browser/port-forwarding/port-forwarding-widget.tsx +140 -140
- package/src/electron-browser/remote-electron-file-dialog-service.ts +47 -47
- package/src/electron-browser/remote-frontend-contribution.ts +143 -143
- package/src/electron-browser/remote-frontend-module.ts +68 -68
- package/src/electron-browser/remote-preferences.ts +62 -62
- package/src/electron-browser/remote-registry-contribution.ts +73 -73
- package/src/electron-browser/remote-service.ts +31 -31
- package/src/electron-browser/remote-ssh-contribution.ts +102 -102
- package/src/electron-browser/style/port-forwarding-widget.css +44 -44
- package/src/electron-common/remote-port-forwarding-provider.ts +30 -30
- package/src/electron-common/remote-ssh-connection-provider.ts +29 -29
- package/src/electron-common/remote-status-service.ts +35 -35
- package/src/electron-node/backend-remote-service-impl.ts +45 -45
- package/src/electron-node/remote-backend-module.ts +87 -87
- package/src/electron-node/remote-connection-service.ts +56 -56
- package/src/electron-node/remote-connection-socket-provider.ts +34 -34
- package/src/electron-node/remote-port-forwarding-provider.ts +66 -66
- package/src/electron-node/remote-proxy-server-provider.ts +37 -37
- package/src/electron-node/remote-status-service.ts +41 -41
- package/src/electron-node/remote-types.ts +64 -64
- package/src/electron-node/setup/app-native-dependency-contribution.ts +48 -48
- package/src/electron-node/setup/main-copy-contribution.ts +28 -28
- package/src/electron-node/setup/remote-copy-contribution.ts +74 -74
- package/src/electron-node/setup/remote-copy-service.ts +116 -116
- package/src/electron-node/setup/remote-native-dependency-contribution.ts +63 -63
- package/src/electron-node/setup/remote-native-dependency-service.ts +111 -111
- package/src/electron-node/setup/remote-node-setup-service.ts +123 -123
- package/src/electron-node/setup/remote-setup-script-service.ts +146 -146
- package/src/electron-node/setup/remote-setup-service.ts +220 -220
- package/src/electron-node/ssh/remote-ssh-connection-provider.ts +358 -358
- package/src/electron-node/ssh/ssh-identity-file-collector.ts +137 -137
- package/src/package.spec.ts +29 -29
|
@@ -1,66 +1,66 @@
|
|
|
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 { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ForwardedPort, RemotePortForwardingProvider } from '../electron-common/remote-port-forwarding-provider';
|
|
19
|
-
import { createServer, Server } from 'net';
|
|
20
|
-
import { RemoteConnectionService } from './remote-connection-service';
|
|
21
|
-
import { RemoteConnection } from './remote-types';
|
|
22
|
-
|
|
23
|
-
interface ForwardInfo {
|
|
24
|
-
connection: RemoteConnection
|
|
25
|
-
port: ForwardedPort
|
|
26
|
-
server: Server
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@injectable()
|
|
30
|
-
export class RemotePortForwardingProviderImpl implements RemotePortForwardingProvider {
|
|
31
|
-
|
|
32
|
-
@inject(RemoteConnectionService)
|
|
33
|
-
protected readonly connectionService: RemoteConnectionService;
|
|
34
|
-
|
|
35
|
-
protected static forwardedPorts: ForwardInfo[] = [];
|
|
36
|
-
|
|
37
|
-
async forwardPort(connectionPort: number, portToForward: ForwardedPort): Promise<void> {
|
|
38
|
-
const currentConnection = this.connectionService.getConnectionFromPort(connectionPort);
|
|
39
|
-
if (!currentConnection) {
|
|
40
|
-
throw new Error(`No connection found for port ${connectionPort}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const server = createServer(socket => {
|
|
44
|
-
currentConnection?.forwardOut(socket, portToForward.port);
|
|
45
|
-
}).listen(portToForward.port, portToForward.address);
|
|
46
|
-
|
|
47
|
-
currentConnection.onDidDisconnect(() => {
|
|
48
|
-
this.portRemoved(portToForward);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
RemotePortForwardingProviderImpl.forwardedPorts.push({ connection: currentConnection, port: portToForward, server });
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async portRemoved(forwardedPort: ForwardedPort): Promise<void> {
|
|
55
|
-
const forwardInfo = RemotePortForwardingProviderImpl.forwardedPorts.find(info => info.port.port === forwardedPort.port);
|
|
56
|
-
if (forwardInfo) {
|
|
57
|
-
forwardInfo.server.close();
|
|
58
|
-
RemotePortForwardingProviderImpl.forwardedPorts.splice(RemotePortForwardingProviderImpl.forwardedPorts.indexOf(forwardInfo), 1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async getForwardedPorts(): Promise<ForwardedPort[]> {
|
|
63
|
-
return Array.from(RemotePortForwardingProviderImpl.forwardedPorts)
|
|
64
|
-
.map(forwardInfo => ({ ...forwardInfo.port, editing: false }));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
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 { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ForwardedPort, RemotePortForwardingProvider } from '../electron-common/remote-port-forwarding-provider';
|
|
19
|
+
import { createServer, Server } from 'net';
|
|
20
|
+
import { RemoteConnectionService } from './remote-connection-service';
|
|
21
|
+
import { RemoteConnection } from './remote-types';
|
|
22
|
+
|
|
23
|
+
interface ForwardInfo {
|
|
24
|
+
connection: RemoteConnection
|
|
25
|
+
port: ForwardedPort
|
|
26
|
+
server: Server
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@injectable()
|
|
30
|
+
export class RemotePortForwardingProviderImpl implements RemotePortForwardingProvider {
|
|
31
|
+
|
|
32
|
+
@inject(RemoteConnectionService)
|
|
33
|
+
protected readonly connectionService: RemoteConnectionService;
|
|
34
|
+
|
|
35
|
+
protected static forwardedPorts: ForwardInfo[] = [];
|
|
36
|
+
|
|
37
|
+
async forwardPort(connectionPort: number, portToForward: ForwardedPort): Promise<void> {
|
|
38
|
+
const currentConnection = this.connectionService.getConnectionFromPort(connectionPort);
|
|
39
|
+
if (!currentConnection) {
|
|
40
|
+
throw new Error(`No connection found for port ${connectionPort}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const server = createServer(socket => {
|
|
44
|
+
currentConnection?.forwardOut(socket, portToForward.port);
|
|
45
|
+
}).listen(portToForward.port, portToForward.address);
|
|
46
|
+
|
|
47
|
+
currentConnection.onDidDisconnect(() => {
|
|
48
|
+
this.portRemoved(portToForward);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
RemotePortForwardingProviderImpl.forwardedPorts.push({ connection: currentConnection, port: portToForward, server });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async portRemoved(forwardedPort: ForwardedPort): Promise<void> {
|
|
55
|
+
const forwardInfo = RemotePortForwardingProviderImpl.forwardedPorts.find(info => info.port.port === forwardedPort.port);
|
|
56
|
+
if (forwardInfo) {
|
|
57
|
+
forwardInfo.server.close();
|
|
58
|
+
RemotePortForwardingProviderImpl.forwardedPorts.splice(RemotePortForwardingProviderImpl.forwardedPorts.indexOf(forwardInfo), 1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async getForwardedPorts(): Promise<ForwardedPort[]> {
|
|
63
|
+
return Array.from(RemotePortForwardingProviderImpl.forwardedPorts)
|
|
64
|
+
.map(forwardInfo => ({ ...forwardInfo.port, editing: false }));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
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 { Deferred } from '@theia/core/lib/common/promise-util';
|
|
18
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
-
import * as net from 'net';
|
|
20
|
-
|
|
21
|
-
@injectable()
|
|
22
|
-
export class RemoteProxyServerProvider {
|
|
23
|
-
|
|
24
|
-
async getProxyServer(callback?: (socket: net.Socket) => void): Promise<net.Server> {
|
|
25
|
-
const deferred = new Deferred();
|
|
26
|
-
|
|
27
|
-
const proxy = net.createServer(socket => {
|
|
28
|
-
callback?.(socket);
|
|
29
|
-
}).listen(0, () => {
|
|
30
|
-
deferred.resolve();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
await deferred.promise;
|
|
34
|
-
return proxy;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
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 { Deferred } from '@theia/core/lib/common/promise-util';
|
|
18
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import * as net from 'net';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class RemoteProxyServerProvider {
|
|
23
|
+
|
|
24
|
+
async getProxyServer(callback?: (socket: net.Socket) => void): Promise<net.Server> {
|
|
25
|
+
const deferred = new Deferred();
|
|
26
|
+
|
|
27
|
+
const proxy = net.createServer(socket => {
|
|
28
|
+
callback?.(socket);
|
|
29
|
+
}).listen(0, () => {
|
|
30
|
+
deferred.resolve();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await deferred.promise;
|
|
34
|
+
return proxy;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
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 { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { RemoteStatus, RemoteStatusService } from '../electron-common/remote-status-service';
|
|
19
|
-
import { RemoteConnectionService } from './remote-connection-service';
|
|
20
|
-
|
|
21
|
-
@injectable()
|
|
22
|
-
export class RemoteStatusServiceImpl implements RemoteStatusService {
|
|
23
|
-
|
|
24
|
-
@inject(RemoteConnectionService)
|
|
25
|
-
protected remoteConnectionService: RemoteConnectionService;
|
|
26
|
-
|
|
27
|
-
async getStatus(localPort: number): Promise<RemoteStatus> {
|
|
28
|
-
const connection = this.remoteConnectionService.getConnectionFromPort(localPort);
|
|
29
|
-
if (connection) {
|
|
30
|
-
return {
|
|
31
|
-
alive: true,
|
|
32
|
-
name: connection.name,
|
|
33
|
-
type: connection.type
|
|
34
|
-
};
|
|
35
|
-
} else {
|
|
36
|
-
return {
|
|
37
|
-
alive: false
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
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 { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { RemoteStatus, RemoteStatusService } from '../electron-common/remote-status-service';
|
|
19
|
+
import { RemoteConnectionService } from './remote-connection-service';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class RemoteStatusServiceImpl implements RemoteStatusService {
|
|
23
|
+
|
|
24
|
+
@inject(RemoteConnectionService)
|
|
25
|
+
protected remoteConnectionService: RemoteConnectionService;
|
|
26
|
+
|
|
27
|
+
async getStatus(localPort: number): Promise<RemoteStatus> {
|
|
28
|
+
const connection = this.remoteConnectionService.getConnectionFromPort(localPort);
|
|
29
|
+
if (connection) {
|
|
30
|
+
return {
|
|
31
|
+
alive: true,
|
|
32
|
+
name: connection.name,
|
|
33
|
+
type: connection.type
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
return {
|
|
37
|
+
alive: false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
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 { Disposable, Event } from '@theia/core';
|
|
18
|
-
import * as net from 'net';
|
|
19
|
-
|
|
20
|
-
export type RemoteStatusReport = (message: string) => void;
|
|
21
|
-
|
|
22
|
-
export interface ExpressLayer {
|
|
23
|
-
name: string
|
|
24
|
-
regexp: RegExp
|
|
25
|
-
handle: Function
|
|
26
|
-
path?: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface RemoteExecOptions {
|
|
30
|
-
env?: NodeJS.ProcessEnv;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface RemoteExecResult {
|
|
34
|
-
stdout: string;
|
|
35
|
-
stderr: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type RemoteExecTester = (stdout: string, stderr: string) => boolean;
|
|
39
|
-
|
|
40
|
-
export interface RemoteConnection extends Disposable {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
type: string;
|
|
44
|
-
localPort: number;
|
|
45
|
-
remotePort: number;
|
|
46
|
-
onDidDisconnect: Event<void>;
|
|
47
|
-
forwardOut(socket: net.Socket, port?: number): void;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* execute a single command on the remote machine
|
|
51
|
-
*/
|
|
52
|
-
exec(cmd: string, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* execute a command on the remote machine and wait for a specific output
|
|
56
|
-
* @param tester function which returns true if the output is as expected
|
|
57
|
-
*/
|
|
58
|
-
execPartial(cmd: string, tester: RemoteExecTester, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* copy files from local to remote
|
|
62
|
-
*/
|
|
63
|
-
copy(localPath: string | Buffer | NodeJS.ReadableStream, remotePath: string): Promise<void>;
|
|
64
|
-
}
|
|
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 { Disposable, Event } from '@theia/core';
|
|
18
|
+
import * as net from 'net';
|
|
19
|
+
|
|
20
|
+
export type RemoteStatusReport = (message: string) => void;
|
|
21
|
+
|
|
22
|
+
export interface ExpressLayer {
|
|
23
|
+
name: string
|
|
24
|
+
regexp: RegExp
|
|
25
|
+
handle: Function
|
|
26
|
+
path?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface RemoteExecOptions {
|
|
30
|
+
env?: NodeJS.ProcessEnv;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface RemoteExecResult {
|
|
34
|
+
stdout: string;
|
|
35
|
+
stderr: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type RemoteExecTester = (stdout: string, stderr: string) => boolean;
|
|
39
|
+
|
|
40
|
+
export interface RemoteConnection extends Disposable {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
localPort: number;
|
|
45
|
+
remotePort: number;
|
|
46
|
+
onDidDisconnect: Event<void>;
|
|
47
|
+
forwardOut(socket: net.Socket, port?: number): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* execute a single command on the remote machine
|
|
51
|
+
*/
|
|
52
|
+
exec(cmd: string, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* execute a command on the remote machine and wait for a specific output
|
|
56
|
+
* @param tester function which returns true if the output is as expected
|
|
57
|
+
*/
|
|
58
|
+
execPartial(cmd: string, tester: RemoteExecTester, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* copy files from local to remote
|
|
62
|
+
*/
|
|
63
|
+
copy(localPath: string | Buffer | NodeJS.ReadableStream, remotePath: string): Promise<void>;
|
|
64
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
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 { injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { RemoteNativeDependencyContribution, DownloadOptions, DependencyDownload } from './remote-native-dependency-contribution';
|
|
19
|
-
import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
20
|
-
import { OS } from '@theia/core';
|
|
21
|
-
|
|
22
|
-
@injectable()
|
|
23
|
-
export class AppNativeDependencyContribution implements RemoteNativeDependencyContribution {
|
|
24
|
-
|
|
25
|
-
appDownloadUrlBase = 'https://github.com/eclipse-theia/theia/releases/download';
|
|
26
|
-
|
|
27
|
-
protected getDefaultURLForFile(remotePlatform: RemotePlatform, theiaVersion: string): string {
|
|
28
|
-
if (remotePlatform.arch !== 'x64') {
|
|
29
|
-
throw new Error(`Unsupported remote architecture '${remotePlatform.arch}'. Remote support is only available for x64 architectures.`);
|
|
30
|
-
}
|
|
31
|
-
let platform: string;
|
|
32
|
-
if (remotePlatform.os === OS.Type.Windows) {
|
|
33
|
-
platform = 'win32';
|
|
34
|
-
} else if (remotePlatform.os === OS.Type.OSX) {
|
|
35
|
-
platform = 'darwin';
|
|
36
|
-
} else {
|
|
37
|
-
platform = 'linux';
|
|
38
|
-
}
|
|
39
|
-
return `${this.appDownloadUrlBase}/v${theiaVersion}/native-dependencies-${platform}-${remotePlatform.arch}.zip`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async download(options: DownloadOptions): Promise<DependencyDownload> {
|
|
43
|
-
return {
|
|
44
|
-
buffer: await options.download(this.getDefaultURLForFile(options.remotePlatform, options.theiaVersion)),
|
|
45
|
-
archive: 'zip'
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
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 { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { RemoteNativeDependencyContribution, DownloadOptions, DependencyDownload } from './remote-native-dependency-contribution';
|
|
19
|
+
import { RemotePlatform } from '@theia/core/lib/node/remote/remote-cli-contribution';
|
|
20
|
+
import { OS } from '@theia/core';
|
|
21
|
+
|
|
22
|
+
@injectable()
|
|
23
|
+
export class AppNativeDependencyContribution implements RemoteNativeDependencyContribution {
|
|
24
|
+
|
|
25
|
+
appDownloadUrlBase = 'https://github.com/eclipse-theia/theia/releases/download';
|
|
26
|
+
|
|
27
|
+
protected getDefaultURLForFile(remotePlatform: RemotePlatform, theiaVersion: string): string {
|
|
28
|
+
if (remotePlatform.arch !== 'x64') {
|
|
29
|
+
throw new Error(`Unsupported remote architecture '${remotePlatform.arch}'. Remote support is only available for x64 architectures.`);
|
|
30
|
+
}
|
|
31
|
+
let platform: string;
|
|
32
|
+
if (remotePlatform.os === OS.Type.Windows) {
|
|
33
|
+
platform = 'win32';
|
|
34
|
+
} else if (remotePlatform.os === OS.Type.OSX) {
|
|
35
|
+
platform = 'darwin';
|
|
36
|
+
} else {
|
|
37
|
+
platform = 'linux';
|
|
38
|
+
}
|
|
39
|
+
return `${this.appDownloadUrlBase}/v${theiaVersion}/native-dependencies-${platform}-${remotePlatform.arch}.zip`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async download(options: DownloadOptions): Promise<DependencyDownload> {
|
|
43
|
+
return {
|
|
44
|
+
buffer: await options.download(this.getDefaultURLForFile(options.remotePlatform, options.theiaVersion)),
|
|
45
|
+
archive: 'zip'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
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 { injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { RemoteCopyContribution, RemoteCopyRegistry } from '@theia/core/lib/node/remote/remote-copy-contribution';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class MainCopyContribution implements RemoteCopyContribution {
|
|
22
|
-
async copy(registry: RemoteCopyRegistry): Promise<void> {
|
|
23
|
-
registry.file('package.json');
|
|
24
|
-
await registry.glob('lib/backend/**/*.js');
|
|
25
|
-
await registry.directory('lib/frontend');
|
|
26
|
-
await registry.directory('lib/webview');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
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 { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { RemoteCopyContribution, RemoteCopyRegistry } from '@theia/core/lib/node/remote/remote-copy-contribution';
|
|
19
|
+
|
|
20
|
+
@injectable()
|
|
21
|
+
export class MainCopyContribution implements RemoteCopyContribution {
|
|
22
|
+
async copy(registry: RemoteCopyRegistry): Promise<void> {
|
|
23
|
+
registry.file('package.json');
|
|
24
|
+
await registry.glob('lib/backend/**/*.js');
|
|
25
|
+
await registry.directory('lib/frontend');
|
|
26
|
+
await registry.directory('lib/webview');
|
|
27
|
+
}
|
|
28
|
+
}
|