@theia/remote 1.45.0 → 1.46.0-next.72
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-browser/remote-electron-file-dialog-service.d.ts +13 -13
- package/lib/electron-browser/remote-electron-file-dialog-service.js +57 -57
- package/lib/electron-browser/remote-frontend-contribution.d.ts +25 -25
- package/lib/electron-browser/remote-frontend-contribution.js +164 -164
- package/lib/electron-browser/remote-frontend-module.d.ts +3 -3
- package/lib/electron-browser/remote-frontend-module.js +42 -42
- package/lib/electron-browser/remote-preferences.d.ts +10 -10
- package/lib/electron-browser/remote-preferences.js +48 -48
- package/lib/electron-browser/remote-registry-contribution.d.ts +18 -18
- package/lib/electron-browser/remote-registry-contribution.js +74 -74
- package/lib/electron-browser/remote-service.d.ts +5 -5
- package/lib/electron-browser/remote-service.js +37 -37
- package/lib/electron-browser/remote-ssh-contribution.d.ts +17 -17
- package/lib/electron-browser/remote-ssh-contribution.js +117 -117
- package/lib/electron-common/remote-ssh-connection-provider.d.ts +10 -10
- package/lib/electron-common/remote-ssh-connection-provider.js +20 -20
- package/lib/electron-common/remote-status-service.d.ts +14 -14
- package/lib/electron-common/remote-status-service.js +20 -20
- package/lib/electron-node/backend-remote-service-impl.d.ts +11 -11
- package/lib/electron-node/backend-remote-service-impl.js +50 -50
- package/lib/electron-node/remote-backend-module.d.ts +4 -4
- package/lib/electron-node/remote-backend-module.js +74 -74
- package/lib/electron-node/remote-connection-service.d.ts +14 -14
- package/lib/electron-node/remote-connection-service.js +65 -65
- package/lib/electron-node/remote-connection-socket-provider.d.ts +8 -8
- package/lib/electron-node/remote-connection-socket-provider.js +37 -37
- package/lib/electron-node/remote-proxy-server-provider.d.ts +5 -5
- package/lib/electron-node/remote-proxy-server-provider.js +43 -43
- package/lib/electron-node/remote-status-service.d.ts +6 -6
- package/lib/electron-node/remote-status-service.js +54 -54
- package/lib/electron-node/remote-types.d.ts +34 -34
- package/lib/electron-node/remote-types.js +17 -17
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts +7 -7
- package/lib/electron-node/setup/app-native-dependency-contribution.js +57 -57
- package/lib/electron-node/setup/main-copy-contribution.d.ts +4 -4
- package/lib/electron-node/setup/main-copy-contribution.js +37 -37
- package/lib/electron-node/setup/remote-copy-contribution.d.ts +28 -28
- package/lib/electron-node/setup/remote-copy-contribution.js +78 -78
- package/lib/electron-node/setup/remote-copy-service.d.ts +18 -18
- package/lib/electron-node/setup/remote-copy-service.js +126 -126
- package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts +34 -34
- package/lib/electron-node/setup/remote-native-dependency-contribution.js +34 -34
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts +23 -23
- package/lib/electron-node/setup/remote-native-dependency-service.js +118 -118
- package/lib/electron-node/setup/remote-node-setup-service.d.ts +22 -22
- package/lib/electron-node/setup/remote-node-setup-service.js +132 -132
- package/lib/electron-node/setup/remote-setup-script-service.d.ts +40 -40
- package/lib/electron-node/setup/remote-setup-script-service.js +132 -132
- package/lib/electron-node/setup/remote-setup-service.d.ts +28 -28
- package/lib/electron-node/setup/remote-setup-service.js +198 -198
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts +55 -55
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts.map +1 -1
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js +344 -342
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js.map +1 -1
- package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts +12 -12
- package/lib/electron-node/ssh/ssh-identity-file-collector.js +131 -131
- package/lib/package.spec.js +25 -25
- package/package.json +6 -7
- package/src/electron-browser/remote-electron-file-dialog-service.ts +47 -47
- package/src/electron-browser/remote-frontend-contribution.ts +145 -145
- package/src/electron-browser/remote-frontend-module.ts +49 -49
- package/src/electron-browser/remote-preferences.ts +62 -62
- package/src/electron-browser/remote-registry-contribution.ts +70 -70
- package/src/electron-browser/remote-service.ts +31 -31
- package/src/electron-browser/remote-ssh-contribution.ts +102 -102
- 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 +80 -80
- package/src/electron-node/remote-connection-service.ts +55 -55
- package/src/electron-node/remote-connection-socket-provider.ts +34 -34
- 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 +56 -56
- 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 +90 -90
- package/src/electron-node/setup/remote-copy-service.ts +114 -114
- 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 +197 -197
- package/src/electron-node/ssh/remote-ssh-connection-provider.ts +358 -356
- package/src/electron-node/ssh/ssh-identity-file-collector.ts +137 -137
- package/src/package.spec.ts +29 -29
|
@@ -1,80 +1,80 @@
|
|
|
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 { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
-
import { BackendApplicationContribution, CliContribution } from '@theia/core/lib/node';
|
|
19
|
-
import { RemoteConnectionService } from './remote-connection-service';
|
|
20
|
-
import { RemoteProxyServerProvider } from './remote-proxy-server-provider';
|
|
21
|
-
import { RemoteConnectionSocketProvider } from './remote-connection-socket-provider';
|
|
22
|
-
import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module';
|
|
23
|
-
import { RemoteSSHConnectionProvider, RemoteSSHConnectionProviderPath } from '../electron-common/remote-ssh-connection-provider';
|
|
24
|
-
import { RemoteSSHConnectionProviderImpl } from './ssh/remote-ssh-connection-provider';
|
|
25
|
-
import { SSHIdentityFileCollector } from './ssh/ssh-identity-file-collector';
|
|
26
|
-
import { RemoteCopyService } from './setup/remote-copy-service';
|
|
27
|
-
import { RemoteSetupService } from './setup/remote-setup-service';
|
|
28
|
-
import { RemoteNativeDependencyService } from './setup/remote-native-dependency-service';
|
|
29
|
-
import { BackendRemoteServiceImpl } from './backend-remote-service-impl';
|
|
30
|
-
import { BackendRemoteService } from '@theia/core/lib/node/backend-remote-service';
|
|
31
|
-
import { RemoteNodeSetupService } from './setup/remote-node-setup-service';
|
|
32
|
-
import { RemotePosixScriptStrategy, RemoteSetupScriptService, RemoteWindowsScriptStrategy } from './setup/remote-setup-script-service';
|
|
33
|
-
import { RemoteStatusService, RemoteStatusServicePath } from '../electron-common/remote-status-service';
|
|
34
|
-
import { RemoteStatusServiceImpl } from './remote-status-service';
|
|
35
|
-
import { ConnectionHandler, RpcConnectionHandler, bindContributionProvider } from '@theia/core';
|
|
36
|
-
import { RemoteCopyContribution, RemoteCopyRegistry } from './setup/remote-copy-contribution';
|
|
37
|
-
import { MainCopyContribution } from './setup/main-copy-contribution';
|
|
38
|
-
import { RemoteNativeDependencyContribution } from './setup/remote-native-dependency-contribution';
|
|
39
|
-
import { AppNativeDependencyContribution } from './setup/app-native-dependency-contribution';
|
|
40
|
-
|
|
41
|
-
export const remoteConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService }) => {
|
|
42
|
-
bind(RemoteSSHConnectionProviderImpl).toSelf().inSingletonScope();
|
|
43
|
-
bind(RemoteSSHConnectionProvider).toService(RemoteSSHConnectionProviderImpl);
|
|
44
|
-
bindBackendService(RemoteSSHConnectionProviderPath, RemoteSSHConnectionProvider);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
|
|
48
|
-
bind(RemoteProxyServerProvider).toSelf().inSingletonScope();
|
|
49
|
-
bind(RemoteConnectionSocketProvider).toSelf().inSingletonScope();
|
|
50
|
-
bind(RemoteConnectionService).toSelf().inSingletonScope();
|
|
51
|
-
bind(BackendApplicationContribution).toService(RemoteConnectionService);
|
|
52
|
-
bind(RemoteStatusServiceImpl).toSelf().inSingletonScope();
|
|
53
|
-
bind(RemoteStatusService).toService(RemoteStatusServiceImpl);
|
|
54
|
-
bind(ConnectionHandler).toDynamicValue(
|
|
55
|
-
ctx => new RpcConnectionHandler(RemoteStatusServicePath, () => ctx.container.get(RemoteStatusService))
|
|
56
|
-
).inSingletonScope();
|
|
57
|
-
|
|
58
|
-
bind(RemoteCopyService).toSelf().inSingletonScope();
|
|
59
|
-
bind(RemoteSetupService).toSelf().inSingletonScope();
|
|
60
|
-
bind(RemoteNodeSetupService).toSelf().inSingletonScope();
|
|
61
|
-
bind(RemoteWindowsScriptStrategy).toSelf().inSingletonScope();
|
|
62
|
-
bind(RemotePosixScriptStrategy).toSelf().inSingletonScope();
|
|
63
|
-
bind(RemoteSetupScriptService).toSelf().inSingletonScope();
|
|
64
|
-
bind(RemoteNativeDependencyService).toSelf().inSingletonScope();
|
|
65
|
-
bind(RemoteCopyRegistry).toSelf().inSingletonScope();
|
|
66
|
-
bindContributionProvider(bind, RemoteCopyContribution);
|
|
67
|
-
bindContributionProvider(bind, RemoteNativeDependencyContribution);
|
|
68
|
-
bind(MainCopyContribution).toSelf().inSingletonScope();
|
|
69
|
-
bind(RemoteCopyContribution).toService(MainCopyContribution);
|
|
70
|
-
bind(AppNativeDependencyContribution).toSelf().inSingletonScope();
|
|
71
|
-
bind(RemoteNativeDependencyContribution).toService(AppNativeDependencyContribution);
|
|
72
|
-
|
|
73
|
-
bind(ConnectionContainerModule).toConstantValue(remoteConnectionModule);
|
|
74
|
-
|
|
75
|
-
bind(BackendRemoteServiceImpl).toSelf().inSingletonScope();
|
|
76
|
-
rebind(BackendRemoteService).toService(BackendRemoteServiceImpl);
|
|
77
|
-
bind(CliContribution).toService(BackendRemoteServiceImpl);
|
|
78
|
-
|
|
79
|
-
bind(SSHIdentityFileCollector).toSelf().inSingletonScope();
|
|
80
|
-
});
|
|
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 { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
+
import { BackendApplicationContribution, CliContribution } from '@theia/core/lib/node';
|
|
19
|
+
import { RemoteConnectionService } from './remote-connection-service';
|
|
20
|
+
import { RemoteProxyServerProvider } from './remote-proxy-server-provider';
|
|
21
|
+
import { RemoteConnectionSocketProvider } from './remote-connection-socket-provider';
|
|
22
|
+
import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module';
|
|
23
|
+
import { RemoteSSHConnectionProvider, RemoteSSHConnectionProviderPath } from '../electron-common/remote-ssh-connection-provider';
|
|
24
|
+
import { RemoteSSHConnectionProviderImpl } from './ssh/remote-ssh-connection-provider';
|
|
25
|
+
import { SSHIdentityFileCollector } from './ssh/ssh-identity-file-collector';
|
|
26
|
+
import { RemoteCopyService } from './setup/remote-copy-service';
|
|
27
|
+
import { RemoteSetupService } from './setup/remote-setup-service';
|
|
28
|
+
import { RemoteNativeDependencyService } from './setup/remote-native-dependency-service';
|
|
29
|
+
import { BackendRemoteServiceImpl } from './backend-remote-service-impl';
|
|
30
|
+
import { BackendRemoteService } from '@theia/core/lib/node/backend-remote-service';
|
|
31
|
+
import { RemoteNodeSetupService } from './setup/remote-node-setup-service';
|
|
32
|
+
import { RemotePosixScriptStrategy, RemoteSetupScriptService, RemoteWindowsScriptStrategy } from './setup/remote-setup-script-service';
|
|
33
|
+
import { RemoteStatusService, RemoteStatusServicePath } from '../electron-common/remote-status-service';
|
|
34
|
+
import { RemoteStatusServiceImpl } from './remote-status-service';
|
|
35
|
+
import { ConnectionHandler, RpcConnectionHandler, bindContributionProvider } from '@theia/core';
|
|
36
|
+
import { RemoteCopyContribution, RemoteCopyRegistry } from './setup/remote-copy-contribution';
|
|
37
|
+
import { MainCopyContribution } from './setup/main-copy-contribution';
|
|
38
|
+
import { RemoteNativeDependencyContribution } from './setup/remote-native-dependency-contribution';
|
|
39
|
+
import { AppNativeDependencyContribution } from './setup/app-native-dependency-contribution';
|
|
40
|
+
|
|
41
|
+
export const remoteConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService }) => {
|
|
42
|
+
bind(RemoteSSHConnectionProviderImpl).toSelf().inSingletonScope();
|
|
43
|
+
bind(RemoteSSHConnectionProvider).toService(RemoteSSHConnectionProviderImpl);
|
|
44
|
+
bindBackendService(RemoteSSHConnectionProviderPath, RemoteSSHConnectionProvider);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
|
|
48
|
+
bind(RemoteProxyServerProvider).toSelf().inSingletonScope();
|
|
49
|
+
bind(RemoteConnectionSocketProvider).toSelf().inSingletonScope();
|
|
50
|
+
bind(RemoteConnectionService).toSelf().inSingletonScope();
|
|
51
|
+
bind(BackendApplicationContribution).toService(RemoteConnectionService);
|
|
52
|
+
bind(RemoteStatusServiceImpl).toSelf().inSingletonScope();
|
|
53
|
+
bind(RemoteStatusService).toService(RemoteStatusServiceImpl);
|
|
54
|
+
bind(ConnectionHandler).toDynamicValue(
|
|
55
|
+
ctx => new RpcConnectionHandler(RemoteStatusServicePath, () => ctx.container.get(RemoteStatusService))
|
|
56
|
+
).inSingletonScope();
|
|
57
|
+
|
|
58
|
+
bind(RemoteCopyService).toSelf().inSingletonScope();
|
|
59
|
+
bind(RemoteSetupService).toSelf().inSingletonScope();
|
|
60
|
+
bind(RemoteNodeSetupService).toSelf().inSingletonScope();
|
|
61
|
+
bind(RemoteWindowsScriptStrategy).toSelf().inSingletonScope();
|
|
62
|
+
bind(RemotePosixScriptStrategy).toSelf().inSingletonScope();
|
|
63
|
+
bind(RemoteSetupScriptService).toSelf().inSingletonScope();
|
|
64
|
+
bind(RemoteNativeDependencyService).toSelf().inSingletonScope();
|
|
65
|
+
bind(RemoteCopyRegistry).toSelf().inSingletonScope();
|
|
66
|
+
bindContributionProvider(bind, RemoteCopyContribution);
|
|
67
|
+
bindContributionProvider(bind, RemoteNativeDependencyContribution);
|
|
68
|
+
bind(MainCopyContribution).toSelf().inSingletonScope();
|
|
69
|
+
bind(RemoteCopyContribution).toService(MainCopyContribution);
|
|
70
|
+
bind(AppNativeDependencyContribution).toSelf().inSingletonScope();
|
|
71
|
+
bind(RemoteNativeDependencyContribution).toService(AppNativeDependencyContribution);
|
|
72
|
+
|
|
73
|
+
bind(ConnectionContainerModule).toConstantValue(remoteConnectionModule);
|
|
74
|
+
|
|
75
|
+
bind(BackendRemoteServiceImpl).toSelf().inSingletonScope();
|
|
76
|
+
rebind(BackendRemoteService).toService(BackendRemoteServiceImpl);
|
|
77
|
+
bind(CliContribution).toService(BackendRemoteServiceImpl);
|
|
78
|
+
|
|
79
|
+
bind(SSHIdentityFileCollector).toSelf().inSingletonScope();
|
|
80
|
+
});
|
|
@@ -1,55 +1,55 @@
|
|
|
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 { RemoteConnection } from './remote-types';
|
|
19
|
-
import { Disposable } from '@theia/core';
|
|
20
|
-
import { RemoteCopyService } from './setup/remote-copy-service';
|
|
21
|
-
import { RemoteNativeDependencyService } from './setup/remote-native-dependency-service';
|
|
22
|
-
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
23
|
-
|
|
24
|
-
@injectable()
|
|
25
|
-
export class RemoteConnectionService implements BackendApplicationContribution {
|
|
26
|
-
|
|
27
|
-
@inject(RemoteCopyService)
|
|
28
|
-
protected readonly copyService: RemoteCopyService;
|
|
29
|
-
|
|
30
|
-
@inject(RemoteNativeDependencyService)
|
|
31
|
-
protected readonly nativeDependencyService: RemoteNativeDependencyService;
|
|
32
|
-
|
|
33
|
-
protected readonly connections = new Map<string, RemoteConnection>();
|
|
34
|
-
|
|
35
|
-
getConnection(id: string): RemoteConnection | undefined {
|
|
36
|
-
return this.connections.get(id);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getConnectionFromPort(port: number): RemoteConnection | undefined {
|
|
40
|
-
return Array.from(this.connections.values()).find(connection => connection.localPort === port);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
register(connection: RemoteConnection): Disposable {
|
|
44
|
-
this.connections.set(connection.id, connection);
|
|
45
|
-
return Disposable.create(() => {
|
|
46
|
-
this.connections.delete(connection.id);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onStop(): void {
|
|
51
|
-
for (const connection of this.connections.values()) {
|
|
52
|
-
connection.dispose();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
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 { RemoteConnection } from './remote-types';
|
|
19
|
+
import { Disposable } from '@theia/core';
|
|
20
|
+
import { RemoteCopyService } from './setup/remote-copy-service';
|
|
21
|
+
import { RemoteNativeDependencyService } from './setup/remote-native-dependency-service';
|
|
22
|
+
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class RemoteConnectionService implements BackendApplicationContribution {
|
|
26
|
+
|
|
27
|
+
@inject(RemoteCopyService)
|
|
28
|
+
protected readonly copyService: RemoteCopyService;
|
|
29
|
+
|
|
30
|
+
@inject(RemoteNativeDependencyService)
|
|
31
|
+
protected readonly nativeDependencyService: RemoteNativeDependencyService;
|
|
32
|
+
|
|
33
|
+
protected readonly connections = new Map<string, RemoteConnection>();
|
|
34
|
+
|
|
35
|
+
getConnection(id: string): RemoteConnection | undefined {
|
|
36
|
+
return this.connections.get(id);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getConnectionFromPort(port: number): RemoteConnection | undefined {
|
|
40
|
+
return Array.from(this.connections.values()).find(connection => connection.localPort === port);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
register(connection: RemoteConnection): Disposable {
|
|
44
|
+
this.connections.set(connection.id, connection);
|
|
45
|
+
return Disposable.create(() => {
|
|
46
|
+
this.connections.delete(connection.id);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onStop(): void {
|
|
51
|
+
for (const connection of this.connections.values()) {
|
|
52
|
+
connection.dispose();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
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 { io, Socket } from 'socket.io-client';
|
|
19
|
-
|
|
20
|
-
export interface RemoteProxySocketProviderOptions {
|
|
21
|
-
port: number;
|
|
22
|
-
path: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@injectable()
|
|
26
|
-
export class RemoteConnectionSocketProvider {
|
|
27
|
-
|
|
28
|
-
getProxySocket(options: RemoteProxySocketProviderOptions): Socket {
|
|
29
|
-
const socket = io(`ws://localhost:${options.port}${options.path}`);
|
|
30
|
-
socket.connect();
|
|
31
|
-
return socket;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
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 { io, Socket } from 'socket.io-client';
|
|
19
|
+
|
|
20
|
+
export interface RemoteProxySocketProviderOptions {
|
|
21
|
+
port: number;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@injectable()
|
|
26
|
+
export class RemoteConnectionSocketProvider {
|
|
27
|
+
|
|
28
|
+
getProxySocket(options: RemoteProxySocketProviderOptions): Socket {
|
|
29
|
+
const socket = io(`ws://localhost:${options.port}${options.path}`);
|
|
30
|
+
socket.connect();
|
|
31
|
+
return socket;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -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,56 +1,56 @@
|
|
|
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, OS } from '@theia/core';
|
|
18
|
-
import * as net from 'net';
|
|
19
|
-
|
|
20
|
-
export interface RemotePlatform {
|
|
21
|
-
os: OS.Type
|
|
22
|
-
arch: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type RemoteStatusReport = (message: string) => void;
|
|
26
|
-
|
|
27
|
-
export interface ExpressLayer {
|
|
28
|
-
name: string
|
|
29
|
-
regexp: RegExp
|
|
30
|
-
handle: Function
|
|
31
|
-
path?: string
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface RemoteExecOptions {
|
|
35
|
-
env?: NodeJS.ProcessEnv;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface RemoteExecResult {
|
|
39
|
-
stdout: string;
|
|
40
|
-
stderr: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type RemoteExecTester = (stdout: string, stderr: string) => boolean;
|
|
44
|
-
|
|
45
|
-
export interface RemoteConnection extends Disposable {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
type: string;
|
|
49
|
-
localPort: number;
|
|
50
|
-
remotePort: number;
|
|
51
|
-
onDidDisconnect: Event<void>;
|
|
52
|
-
forwardOut(socket: net.Socket): void;
|
|
53
|
-
exec(cmd: string, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
54
|
-
execPartial(cmd: string, tester: RemoteExecTester, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
55
|
-
copy(localPath: string | Buffer | NodeJS.ReadableStream, remotePath: string): Promise<void>;
|
|
56
|
-
}
|
|
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, OS } from '@theia/core';
|
|
18
|
+
import * as net from 'net';
|
|
19
|
+
|
|
20
|
+
export interface RemotePlatform {
|
|
21
|
+
os: OS.Type
|
|
22
|
+
arch: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type RemoteStatusReport = (message: string) => void;
|
|
26
|
+
|
|
27
|
+
export interface ExpressLayer {
|
|
28
|
+
name: string
|
|
29
|
+
regexp: RegExp
|
|
30
|
+
handle: Function
|
|
31
|
+
path?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface RemoteExecOptions {
|
|
35
|
+
env?: NodeJS.ProcessEnv;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface RemoteExecResult {
|
|
39
|
+
stdout: string;
|
|
40
|
+
stderr: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type RemoteExecTester = (stdout: string, stderr: string) => boolean;
|
|
44
|
+
|
|
45
|
+
export interface RemoteConnection extends Disposable {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
type: string;
|
|
49
|
+
localPort: number;
|
|
50
|
+
remotePort: number;
|
|
51
|
+
onDidDisconnect: Event<void>;
|
|
52
|
+
forwardOut(socket: net.Socket): void;
|
|
53
|
+
exec(cmd: string, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
54
|
+
execPartial(cmd: string, tester: RemoteExecTester, args?: string[], options?: RemoteExecOptions): Promise<RemoteExecResult>;
|
|
55
|
+
copy(localPath: string | Buffer | NodeJS.ReadableStream, remotePath: string): Promise<void>;
|
|
56
|
+
}
|