@theia/remote 1.43.0
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 -0
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts +14 -0
- package/lib/electron-browser/remote-electron-file-dialog-service.d.ts.map +1 -0
- package/lib/electron-browser/remote-electron-file-dialog-service.js +58 -0
- package/lib/electron-browser/remote-electron-file-dialog-service.js.map +1 -0
- package/lib/electron-browser/remote-frontend-contribution.d.ts +26 -0
- package/lib/electron-browser/remote-frontend-contribution.d.ts.map +1 -0
- package/lib/electron-browser/remote-frontend-contribution.js +165 -0
- package/lib/electron-browser/remote-frontend-contribution.js.map +1 -0
- package/lib/electron-browser/remote-frontend-module.d.ts +4 -0
- package/lib/electron-browser/remote-frontend-module.d.ts.map +1 -0
- package/lib/electron-browser/remote-frontend-module.js +43 -0
- package/lib/electron-browser/remote-frontend-module.js.map +1 -0
- package/lib/electron-browser/remote-preferences.d.ts +11 -0
- package/lib/electron-browser/remote-preferences.d.ts.map +1 -0
- package/lib/electron-browser/remote-preferences.js +49 -0
- package/lib/electron-browser/remote-preferences.js.map +1 -0
- package/lib/electron-browser/remote-registry-contribution.d.ts +19 -0
- package/lib/electron-browser/remote-registry-contribution.d.ts.map +1 -0
- package/lib/electron-browser/remote-registry-contribution.js +75 -0
- package/lib/electron-browser/remote-registry-contribution.js.map +1 -0
- package/lib/electron-browser/remote-service.d.ts +6 -0
- package/lib/electron-browser/remote-service.d.ts.map +1 -0
- package/lib/electron-browser/remote-service.js +38 -0
- package/lib/electron-browser/remote-service.js.map +1 -0
- package/lib/electron-browser/remote-ssh-contribution.d.ts +18 -0
- package/lib/electron-browser/remote-ssh-contribution.d.ts.map +1 -0
- package/lib/electron-browser/remote-ssh-contribution.js +118 -0
- package/lib/electron-browser/remote-ssh-contribution.js.map +1 -0
- package/lib/electron-common/remote-ssh-connection-provider.d.ts +11 -0
- package/lib/electron-common/remote-ssh-connection-provider.d.ts.map +1 -0
- package/lib/electron-common/remote-ssh-connection-provider.js +21 -0
- package/lib/electron-common/remote-ssh-connection-provider.js.map +1 -0
- package/lib/electron-common/remote-status-service.d.ts +15 -0
- package/lib/electron-common/remote-status-service.d.ts.map +1 -0
- package/lib/electron-common/remote-status-service.js +21 -0
- package/lib/electron-common/remote-status-service.js.map +1 -0
- package/lib/electron-node/backend-remote-service-impl.d.ts +12 -0
- package/lib/electron-node/backend-remote-service-impl.d.ts.map +1 -0
- package/lib/electron-node/backend-remote-service-impl.js +51 -0
- package/lib/electron-node/backend-remote-service-impl.js.map +1 -0
- package/lib/electron-node/remote-backend-module.d.ts +5 -0
- package/lib/electron-node/remote-backend-module.d.ts.map +1 -0
- package/lib/electron-node/remote-backend-module.js +75 -0
- package/lib/electron-node/remote-backend-module.js.map +1 -0
- package/lib/electron-node/remote-connection-service.d.ts +15 -0
- package/lib/electron-node/remote-connection-service.d.ts.map +1 -0
- package/lib/electron-node/remote-connection-service.js +66 -0
- package/lib/electron-node/remote-connection-service.js.map +1 -0
- package/lib/electron-node/remote-connection-socket-provider.d.ts +9 -0
- package/lib/electron-node/remote-connection-socket-provider.d.ts.map +1 -0
- package/lib/electron-node/remote-connection-socket-provider.js +38 -0
- package/lib/electron-node/remote-connection-socket-provider.js.map +1 -0
- package/lib/electron-node/remote-proxy-server-provider.d.ts +6 -0
- package/lib/electron-node/remote-proxy-server-provider.d.ts.map +1 -0
- package/lib/electron-node/remote-proxy-server-provider.js +44 -0
- package/lib/electron-node/remote-proxy-server-provider.js.map +1 -0
- package/lib/electron-node/remote-status-service.d.ts +7 -0
- package/lib/electron-node/remote-status-service.d.ts.map +1 -0
- package/lib/electron-node/remote-status-service.js +55 -0
- package/lib/electron-node/remote-status-service.js.map +1 -0
- package/lib/electron-node/remote-types.d.ts +35 -0
- package/lib/electron-node/remote-types.d.ts.map +1 -0
- package/lib/electron-node/remote-types.js +18 -0
- package/lib/electron-node/remote-types.js.map +1 -0
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts +8 -0
- package/lib/electron-node/setup/app-native-dependency-contribution.d.ts.map +1 -0
- package/lib/electron-node/setup/app-native-dependency-contribution.js +58 -0
- package/lib/electron-node/setup/app-native-dependency-contribution.js.map +1 -0
- package/lib/electron-node/setup/main-copy-contribution.d.ts +5 -0
- package/lib/electron-node/setup/main-copy-contribution.d.ts.map +1 -0
- package/lib/electron-node/setup/main-copy-contribution.js +38 -0
- package/lib/electron-node/setup/main-copy-contribution.js.map +1 -0
- package/lib/electron-node/setup/remote-copy-contribution.d.ts +29 -0
- package/lib/electron-node/setup/remote-copy-contribution.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-copy-contribution.js +79 -0
- package/lib/electron-node/setup/remote-copy-contribution.js.map +1 -0
- package/lib/electron-node/setup/remote-copy-service.d.ts +19 -0
- package/lib/electron-node/setup/remote-copy-service.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-copy-service.js +127 -0
- package/lib/electron-node/setup/remote-copy-service.js.map +1 -0
- package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts +35 -0
- package/lib/electron-node/setup/remote-native-dependency-contribution.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-native-dependency-contribution.js +35 -0
- package/lib/electron-node/setup/remote-native-dependency-contribution.js.map +1 -0
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts +24 -0
- package/lib/electron-node/setup/remote-native-dependency-service.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-native-dependency-service.js +119 -0
- package/lib/electron-node/setup/remote-native-dependency-service.js.map +1 -0
- package/lib/electron-node/setup/remote-node-setup-service.d.ts +23 -0
- package/lib/electron-node/setup/remote-node-setup-service.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-node-setup-service.js +133 -0
- package/lib/electron-node/setup/remote-node-setup-service.js.map +1 -0
- package/lib/electron-node/setup/remote-setup-script-service.d.ts +41 -0
- package/lib/electron-node/setup/remote-setup-script-service.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-setup-script-service.js +133 -0
- package/lib/electron-node/setup/remote-setup-script-service.js.map +1 -0
- package/lib/electron-node/setup/remote-setup-service.d.ts +29 -0
- package/lib/electron-node/setup/remote-setup-service.d.ts.map +1 -0
- package/lib/electron-node/setup/remote-setup-service.js +199 -0
- package/lib/electron-node/setup/remote-setup-service.js.map +1 -0
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts +56 -0
- package/lib/electron-node/ssh/remote-ssh-connection-provider.d.ts.map +1 -0
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js +343 -0
- package/lib/electron-node/ssh/remote-ssh-connection-provider.js.map +1 -0
- package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts +13 -0
- package/lib/electron-node/ssh/ssh-identity-file-collector.d.ts.map +1 -0
- package/lib/electron-node/ssh/ssh-identity-file-collector.js +132 -0
- package/lib/electron-node/ssh/ssh-identity-file-collector.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +26 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +67 -0
- package/src/electron-browser/remote-electron-file-dialog-service.ts +47 -0
- package/src/electron-browser/remote-frontend-contribution.ts +145 -0
- package/src/electron-browser/remote-frontend-module.ts +49 -0
- package/src/electron-browser/remote-preferences.ts +62 -0
- package/src/electron-browser/remote-registry-contribution.ts +70 -0
- package/src/electron-browser/remote-service.ts +31 -0
- package/src/electron-browser/remote-ssh-contribution.ts +102 -0
- package/src/electron-common/remote-ssh-connection-provider.ts +29 -0
- package/src/electron-common/remote-status-service.ts +35 -0
- package/src/electron-node/backend-remote-service-impl.ts +45 -0
- package/src/electron-node/remote-backend-module.ts +80 -0
- package/src/electron-node/remote-connection-service.ts +55 -0
- package/src/electron-node/remote-connection-socket-provider.ts +34 -0
- package/src/electron-node/remote-proxy-server-provider.ts +37 -0
- package/src/electron-node/remote-status-service.ts +41 -0
- package/src/electron-node/remote-types.ts +56 -0
- package/src/electron-node/setup/app-native-dependency-contribution.ts +48 -0
- package/src/electron-node/setup/main-copy-contribution.ts +28 -0
- package/src/electron-node/setup/remote-copy-contribution.ts +90 -0
- package/src/electron-node/setup/remote-copy-service.ts +114 -0
- package/src/electron-node/setup/remote-native-dependency-contribution.ts +63 -0
- package/src/electron-node/setup/remote-native-dependency-service.ts +111 -0
- package/src/electron-node/setup/remote-node-setup-service.ts +123 -0
- package/src/electron-node/setup/remote-setup-script-service.ts +146 -0
- package/src/electron-node/setup/remote-setup-service.ts +197 -0
- package/src/electron-node/ssh/remote-ssh-connection-provider.ts +356 -0
- package/src/electron-node/ssh/ssh-identity-file-collector.ts +137 -0
- package/src/package.spec.ts +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-identity-file-collector.d.ts","sourceRoot":"","sources":["../../../src/electron-node/ssh/ssh-identity-file-collector.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAIjC,MAAM,WAAW,MAAM;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qBACa,wBAAwB;IAEjC,SAAS,CAAC,uBAAuB,IAAI,MAAM,EAAE;IAqBvC,mBAAmB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAgFtE"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2023 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.SSHIdentityFileCollector = void 0;
|
|
25
|
+
const fs = require("@theia/core/shared/fs-extra");
|
|
26
|
+
const os = require("os");
|
|
27
|
+
const path = require("path");
|
|
28
|
+
const crypto = require("crypto");
|
|
29
|
+
const ssh2 = require("ssh2");
|
|
30
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
+
let SSHIdentityFileCollector = class SSHIdentityFileCollector {
|
|
32
|
+
getDefaultIdentityFiles() {
|
|
33
|
+
const homeDir = os.homedir();
|
|
34
|
+
const PATH_SSH_CLIENT_ID_DSA = path.join(homeDir, '.ssh', '/id_dsa');
|
|
35
|
+
const PATH_SSH_CLIENT_ID_ECDSA = path.join(homeDir, '.ssh', '/id_ecdsa');
|
|
36
|
+
const PATH_SSH_CLIENT_ID_RSA = path.join(homeDir, '.ssh', '/id_rsa');
|
|
37
|
+
const PATH_SSH_CLIENT_ID_ED25519 = path.join(homeDir, '.ssh', '/id_ed25519');
|
|
38
|
+
const PATH_SSH_CLIENT_ID_XMSS = path.join(homeDir, '.ssh', '/id_xmss');
|
|
39
|
+
const PATH_SSH_CLIENT_ID_ECDSA_SK = path.join(homeDir, '.ssh', '/id_ecdsa_sk');
|
|
40
|
+
const PATH_SSH_CLIENT_ID_ED25519_SK = path.join(homeDir, '.ssh', '/id_ed25519_sk');
|
|
41
|
+
return [
|
|
42
|
+
PATH_SSH_CLIENT_ID_DSA,
|
|
43
|
+
PATH_SSH_CLIENT_ID_ECDSA,
|
|
44
|
+
PATH_SSH_CLIENT_ID_ECDSA_SK,
|
|
45
|
+
PATH_SSH_CLIENT_ID_ED25519,
|
|
46
|
+
PATH_SSH_CLIENT_ID_ED25519_SK,
|
|
47
|
+
PATH_SSH_CLIENT_ID_RSA,
|
|
48
|
+
PATH_SSH_CLIENT_ID_XMSS
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
async gatherIdentityFiles(sshAgentSock) {
|
|
52
|
+
const identityFiles = this.getDefaultIdentityFiles();
|
|
53
|
+
const identityFileContentsResult = await Promise.allSettled(identityFiles.map(async (keyPath) => {
|
|
54
|
+
keyPath = await fs.pathExists(keyPath + '.pub') ? keyPath + '.pub' : keyPath;
|
|
55
|
+
return fs.promises.readFile(keyPath);
|
|
56
|
+
}));
|
|
57
|
+
const fileKeys = identityFileContentsResult.map((result, i) => {
|
|
58
|
+
if (result.status === 'rejected') {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const parsedResult = ssh2.utils.parseKey(result.value);
|
|
62
|
+
if (parsedResult instanceof Error || !parsedResult) {
|
|
63
|
+
console.log(`Error while parsing SSH public key ${identityFiles[i]}:`, parsedResult);
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const parsedKey = Array.isArray(parsedResult) ? parsedResult[0] : parsedResult;
|
|
67
|
+
const fingerprint = crypto.createHash('sha256').update(parsedKey.getPublicSSH()).digest('base64');
|
|
68
|
+
return {
|
|
69
|
+
filename: identityFiles[i],
|
|
70
|
+
parsedKey,
|
|
71
|
+
fingerprint
|
|
72
|
+
};
|
|
73
|
+
}).filter((v) => !!v);
|
|
74
|
+
let sshAgentParsedKeys = [];
|
|
75
|
+
if (sshAgentSock) {
|
|
76
|
+
sshAgentParsedKeys = await new Promise((resolve, reject) => {
|
|
77
|
+
const sshAgent = new ssh2.OpenSSHAgent(sshAgentSock);
|
|
78
|
+
sshAgent.getIdentities((err, publicKeys) => {
|
|
79
|
+
if (err) {
|
|
80
|
+
reject(err);
|
|
81
|
+
}
|
|
82
|
+
else if (publicKeys) {
|
|
83
|
+
resolve(publicKeys.map(key => {
|
|
84
|
+
if ('pubKey' in key) {
|
|
85
|
+
const pubKey = key.pubKey;
|
|
86
|
+
if ('pubKey' in pubKey) {
|
|
87
|
+
return pubKey.pubKey;
|
|
88
|
+
}
|
|
89
|
+
return pubKey;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return key;
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
resolve([]);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const sshAgentKeys = sshAgentParsedKeys.map(parsedKey => {
|
|
103
|
+
const fingerprint = crypto.createHash('sha256').update(parsedKey.getPublicSSH()).digest('base64');
|
|
104
|
+
return {
|
|
105
|
+
filename: parsedKey.comment,
|
|
106
|
+
parsedKey,
|
|
107
|
+
fingerprint,
|
|
108
|
+
agentSupport: true
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
const agentKeys = [];
|
|
112
|
+
const preferredIdentityKeys = [];
|
|
113
|
+
for (const agentKey of sshAgentKeys) {
|
|
114
|
+
const foundIdx = fileKeys.findIndex(k => agentKey.parsedKey.type === k.parsedKey.type && agentKey.fingerprint === k.fingerprint);
|
|
115
|
+
if (foundIdx >= 0) {
|
|
116
|
+
preferredIdentityKeys.push({ ...fileKeys[foundIdx], agentSupport: true });
|
|
117
|
+
fileKeys.splice(foundIdx, 1);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
agentKeys.push(agentKey);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
preferredIdentityKeys.push(...agentKeys);
|
|
124
|
+
preferredIdentityKeys.push(...fileKeys);
|
|
125
|
+
return preferredIdentityKeys;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
SSHIdentityFileCollector = __decorate([
|
|
129
|
+
(0, inversify_1.injectable)()
|
|
130
|
+
], SSHIdentityFileCollector);
|
|
131
|
+
exports.SSHIdentityFileCollector = SSHIdentityFileCollector;
|
|
132
|
+
//# sourceMappingURL=ssh-identity-file-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-identity-file-collector.js","sourceRoot":"","sources":["../../../src/electron-node/ssh/ssh-identity-file-collector.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;;;;;AAEhF,kDAAkD;AAClD,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AAEjC,6BAA6B;AAC7B,4DAA0D;AAW1D,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IAEvB,uBAAuB;QAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACrE,MAAM,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,WA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AM;gBACH,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC5B;SACJ;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACzC,qBAAqB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QAExC,OAAO,qBAAqB,CAAC;IACjC,CAAC;CACJ,CAAA;AAvGY,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAuGpC;AAvGY,4DAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
/* note: this bogus test file is required so that
|
|
17
|
+
we are able to run mocha unit tests on this
|
|
18
|
+
package, without having any actual unit tests in it.
|
|
19
|
+
This way a coverage report will be generated,
|
|
20
|
+
showing 0% coverage, instead of no report.
|
|
21
|
+
This file can be removed once we have real unit
|
|
22
|
+
tests in place. */
|
|
23
|
+
describe('remote package', () => {
|
|
24
|
+
it('support code coverage statistics', () => true);
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=package.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF;;;;;;qBAMqB;AAErB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAE5B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAEvD,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@theia/remote",
|
|
3
|
+
"version": "1.43.0",
|
|
4
|
+
"description": "Theia - Remote",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@theia/core": "1.43.0",
|
|
7
|
+
"@theia/filesystem": "1.43.0",
|
|
8
|
+
"archiver": "^5.3.1",
|
|
9
|
+
"decompress": "^4.2.1",
|
|
10
|
+
"decompress-tar": "^4.0.0",
|
|
11
|
+
"decompress-targz": "^4.0.0",
|
|
12
|
+
"decompress-unzip": "^4.0.1",
|
|
13
|
+
"express-http-proxy": "^1.6.3",
|
|
14
|
+
"glob": "^8.1.0",
|
|
15
|
+
"socket.io": "^4.5.3",
|
|
16
|
+
"socket.io-client": "^4.5.3",
|
|
17
|
+
"ssh2": "^1.12.0",
|
|
18
|
+
"ssh2-sftp-client": "^9.1.0",
|
|
19
|
+
"uuid": "^8.0.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"theiaExtensions": [
|
|
25
|
+
{
|
|
26
|
+
"frontendElectron": "lib/electron-browser/remote-frontend-module",
|
|
27
|
+
"backendElectron": "lib/electron-node/remote-backend-module"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"theia-extension"
|
|
32
|
+
],
|
|
33
|
+
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/theia-ide/theia.git"
|
|
37
|
+
},
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/theia-ide/theia/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/theia-ide/theia",
|
|
42
|
+
"files": [
|
|
43
|
+
"lib",
|
|
44
|
+
"src"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "theiaext build",
|
|
48
|
+
"clean": "theiaext clean",
|
|
49
|
+
"compile": "theiaext compile",
|
|
50
|
+
"lint": "theiaext lint",
|
|
51
|
+
"test": "theiaext test",
|
|
52
|
+
"watch": "theiaext watch"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@theia/ext-scripts": "1.43.0",
|
|
56
|
+
"@types/archiver": "^5.3.2",
|
|
57
|
+
"@types/decompress": "^4.2.4",
|
|
58
|
+
"@types/express-http-proxy": "^1.6.3",
|
|
59
|
+
"@types/glob": "^8.1.0",
|
|
60
|
+
"@types/ssh2": "^1.11.11",
|
|
61
|
+
"@types/ssh2-sftp-client": "^9.0.0"
|
|
62
|
+
},
|
|
63
|
+
"nyc": {
|
|
64
|
+
"extends": "../../configs/nyc.json"
|
|
65
|
+
},
|
|
66
|
+
"gitHead": "c94caea7fe1cc7c9f05b1c3f55afb6b5eb69bbb2"
|
|
67
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
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 { Command, CommandContribution, CommandRegistry, ContributionProvider, nls, QuickInputService, QuickPickInput } from '@theia/core';
|
|
18
|
+
import { FrontendApplicationContribution, StatusBar, StatusBarAlignment, StatusBarEntry } from '@theia/core/lib/browser';
|
|
19
|
+
import { inject, injectable, named, optional } from '@theia/core/shared/inversify';
|
|
20
|
+
import { RemoteStatus, RemoteStatusService } from '../electron-common/remote-status-service';
|
|
21
|
+
import { RemoteRegistry, RemoteRegistryContribution } from './remote-registry-contribution';
|
|
22
|
+
import { RemoteService } from './remote-service';
|
|
23
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
24
|
+
|
|
25
|
+
export namespace RemoteCommands {
|
|
26
|
+
export const REMOTE_SELECT: Command = {
|
|
27
|
+
id: 'remote.select'
|
|
28
|
+
};
|
|
29
|
+
export const REMOTE_DISCONNECT: Command = Command.toDefaultLocalizedCommand({
|
|
30
|
+
id: 'remote.disconnect',
|
|
31
|
+
label: 'Close Remote Connection',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@injectable()
|
|
36
|
+
export class RemoteFrontendContribution implements CommandContribution, FrontendApplicationContribution {
|
|
37
|
+
|
|
38
|
+
@inject(StatusBar)
|
|
39
|
+
protected readonly statusBar: StatusBar;
|
|
40
|
+
|
|
41
|
+
@inject(QuickInputService) @optional()
|
|
42
|
+
protected readonly quickInputService?: QuickInputService;
|
|
43
|
+
|
|
44
|
+
@inject(CommandRegistry)
|
|
45
|
+
protected readonly commandRegistry: CommandRegistry;
|
|
46
|
+
|
|
47
|
+
@inject(RemoteService)
|
|
48
|
+
protected readonly remoteService: RemoteService;
|
|
49
|
+
|
|
50
|
+
@inject(RemoteStatusService)
|
|
51
|
+
protected readonly remoteStatusService: RemoteStatusService;
|
|
52
|
+
|
|
53
|
+
@inject(WindowService)
|
|
54
|
+
protected readonly windowService: WindowService;
|
|
55
|
+
|
|
56
|
+
@inject(ContributionProvider) @named(RemoteRegistryContribution)
|
|
57
|
+
protected readonly remoteRegistryContributions: ContributionProvider<RemoteRegistryContribution>;
|
|
58
|
+
|
|
59
|
+
protected remoteRegistry = new RemoteRegistry();
|
|
60
|
+
|
|
61
|
+
async configure(): Promise<void> {
|
|
62
|
+
const port = new URLSearchParams(location.search).get('port');
|
|
63
|
+
if (port) {
|
|
64
|
+
const status = await this.remoteStatusService.getStatus(Number(port));
|
|
65
|
+
await this.setStatusBar(status);
|
|
66
|
+
} else {
|
|
67
|
+
await this.setStatusBar({
|
|
68
|
+
alive: false
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected async setStatusBar(info: RemoteStatus): Promise<void> {
|
|
74
|
+
this.remoteService.setConnected(info.alive);
|
|
75
|
+
const entry: StatusBarEntry = {
|
|
76
|
+
alignment: StatusBarAlignment.LEFT,
|
|
77
|
+
command: RemoteCommands.REMOTE_SELECT.id,
|
|
78
|
+
backgroundColor: 'var(--theia-statusBarItem-remoteBackground)',
|
|
79
|
+
color: 'var(--theia-statusBarItem-remoteForeground)',
|
|
80
|
+
priority: 10000,
|
|
81
|
+
...(info.alive
|
|
82
|
+
? {
|
|
83
|
+
text: `$(codicon-remote) ${info.type}: ${info.name.length > 35 ? info.name.substring(0, 32) + '...' : info.name}`,
|
|
84
|
+
tooltip: nls.localizeByDefault('Editing on {0}', info.name),
|
|
85
|
+
} : {
|
|
86
|
+
text: '$(codicon-remote)',
|
|
87
|
+
tooltip: nls.localizeByDefault('Open a Remote Window'),
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
this.statusBar.setElement('remoteStatus', entry);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
registerCommands(commands: CommandRegistry): void {
|
|
94
|
+
this.remoteRegistry.onDidRegisterCommand(([command, handler]) => {
|
|
95
|
+
commands.registerCommand(command, handler);
|
|
96
|
+
});
|
|
97
|
+
for (const contribution of this.remoteRegistryContributions.getContributions()) {
|
|
98
|
+
contribution.registerRemoteCommands(this.remoteRegistry);
|
|
99
|
+
}
|
|
100
|
+
commands.registerCommand(RemoteCommands.REMOTE_SELECT, {
|
|
101
|
+
execute: () => this.selectRemote()
|
|
102
|
+
});
|
|
103
|
+
commands.registerCommand(RemoteCommands.REMOTE_DISCONNECT, {
|
|
104
|
+
execute: () => this.disconnectRemote()
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected disconnectRemote(): void {
|
|
109
|
+
const port = new URLSearchParams(location.search).get('localPort');
|
|
110
|
+
if (port) {
|
|
111
|
+
this.windowService.reload({
|
|
112
|
+
port
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
protected async selectRemote(): Promise<void> {
|
|
118
|
+
const commands = [...this.remoteRegistry.commands];
|
|
119
|
+
if (this.remoteService.isConnected()) {
|
|
120
|
+
commands.push(RemoteCommands.REMOTE_DISCONNECT);
|
|
121
|
+
}
|
|
122
|
+
const quickPicks: QuickPickInput[] = [];
|
|
123
|
+
let previousCategory: string | undefined = undefined;
|
|
124
|
+
for (const command of commands) {
|
|
125
|
+
if (previousCategory !== command.category) {
|
|
126
|
+
quickPicks.push({
|
|
127
|
+
type: 'separator',
|
|
128
|
+
label: command.category
|
|
129
|
+
});
|
|
130
|
+
previousCategory = command.category;
|
|
131
|
+
}
|
|
132
|
+
quickPicks.push({
|
|
133
|
+
label: command.label!,
|
|
134
|
+
id: command.id
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const selection = await this.quickInputService?.showQuickPick(quickPicks, {
|
|
138
|
+
placeholder: nls.localizeByDefault('Select an option to open a Remote Window')
|
|
139
|
+
});
|
|
140
|
+
if (selection) {
|
|
141
|
+
this.commandRegistry.executeCommand(selection.id!);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { bindContributionProvider, CommandContribution } from '@theia/core';
|
|
18
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
19
|
+
import { FrontendApplicationContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser';
|
|
20
|
+
import { RemoteSSHContribution } from './remote-ssh-contribution';
|
|
21
|
+
import { RemoteSSHConnectionProvider, RemoteSSHConnectionProviderPath } from '../electron-common/remote-ssh-connection-provider';
|
|
22
|
+
import { RemoteFrontendContribution } from './remote-frontend-contribution';
|
|
23
|
+
import { RemoteRegistryContribution } from './remote-registry-contribution';
|
|
24
|
+
import { RemoteService } from './remote-service';
|
|
25
|
+
import { RemoteStatusService, RemoteStatusServicePath } from '../electron-common/remote-status-service';
|
|
26
|
+
import { ElectronFileDialogService } from '@theia/filesystem/lib/electron-browser/file-dialog/electron-file-dialog-service';
|
|
27
|
+
import { RemoteElectronFileDialogService } from './remote-electron-file-dialog-service';
|
|
28
|
+
import { bindRemotePreferences } from './remote-preferences';
|
|
29
|
+
|
|
30
|
+
export default new ContainerModule((bind, _, __, rebind) => {
|
|
31
|
+
bind(RemoteFrontendContribution).toSelf().inSingletonScope();
|
|
32
|
+
bind(FrontendApplicationContribution).toService(RemoteFrontendContribution);
|
|
33
|
+
bind(CommandContribution).toService(RemoteFrontendContribution);
|
|
34
|
+
|
|
35
|
+
bindContributionProvider(bind, RemoteRegistryContribution);
|
|
36
|
+
bind(RemoteSSHContribution).toSelf().inSingletonScope();
|
|
37
|
+
bind(RemoteRegistryContribution).toService(RemoteSSHContribution);
|
|
38
|
+
|
|
39
|
+
bindRemotePreferences(bind);
|
|
40
|
+
|
|
41
|
+
rebind(ElectronFileDialogService).to(RemoteElectronFileDialogService).inSingletonScope();
|
|
42
|
+
|
|
43
|
+
bind(RemoteService).toSelf().inSingletonScope();
|
|
44
|
+
|
|
45
|
+
bind(RemoteSSHConnectionProvider).toDynamicValue(ctx =>
|
|
46
|
+
WebSocketConnectionProvider.createLocalProxy<RemoteSSHConnectionProvider>(ctx.container, RemoteSSHConnectionProviderPath)).inSingletonScope();
|
|
47
|
+
bind(RemoteStatusService).toDynamicValue(ctx =>
|
|
48
|
+
WebSocketConnectionProvider.createLocalProxy<RemoteStatusService>(ctx.container, RemoteStatusServicePath)).inSingletonScope();
|
|
49
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
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 { interfaces } from '@theia/core/shared/inversify';
|
|
18
|
+
import {
|
|
19
|
+
PreferenceProxy,
|
|
20
|
+
PreferenceSchema,
|
|
21
|
+
PreferenceContribution
|
|
22
|
+
} from '@theia/core/lib/browser/preferences';
|
|
23
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
24
|
+
import { PreferenceProxyFactory } from '@theia/core/lib/browser/preferences/injectable-preference-proxy';
|
|
25
|
+
|
|
26
|
+
const nodeDownloadTemplateParts = [
|
|
27
|
+
nls.localize('theia/remote/nodeDownloadTemplateVersion', '`{version}` for the used node version'),
|
|
28
|
+
nls.localize('theia/remote/nodeDownloadTemplateOS', '`{os}` for the remote operating system. Either `win`, `linux` or `darwin`.'),
|
|
29
|
+
nls.localize('theia/remote/nodeDownloadTemplateArch', '`{arch}` for the remote system architecture.'),
|
|
30
|
+
nls.localize('theia/remote/nodeDownloadTemplateExt', '`{ext}` for the file extension. Either `zip`, `tar.xz` or `tar.xz`, depending on the operating system.')
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const RemotePreferenceSchema: PreferenceSchema = {
|
|
34
|
+
'type': 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
'remote.nodeDownloadTemplate': {
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: '',
|
|
39
|
+
markdownDescription: nls.localize(
|
|
40
|
+
'theia/remote/nodeDownloadTemplate',
|
|
41
|
+
'Controls the template used to download the node.js binaries for the remote backend. Points to the official node.js website by default. Uses multiple placeholders:'
|
|
42
|
+
) + '\n- ' + nodeDownloadTemplateParts.join('\n- ')
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface RemoteConfiguration {
|
|
48
|
+
'remote.nodeDownloadTemplate': string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const RemotePreferenceContribution = Symbol('RemotePreferenceContribution');
|
|
52
|
+
export const RemotePreferences = Symbol('GettingStartedPreferences');
|
|
53
|
+
export type RemotePreferences = PreferenceProxy<RemoteConfiguration>;
|
|
54
|
+
|
|
55
|
+
export function bindRemotePreferences(bind: interfaces.Bind): void {
|
|
56
|
+
bind(RemotePreferences).toDynamicValue(ctx => {
|
|
57
|
+
const factory = ctx.container.get<PreferenceProxyFactory>(PreferenceProxyFactory);
|
|
58
|
+
return factory(RemotePreferenceSchema);
|
|
59
|
+
}).inSingletonScope();
|
|
60
|
+
bind(RemotePreferenceContribution).toConstantValue({ schema: RemotePreferenceSchema });
|
|
61
|
+
bind(PreferenceContribution).toService(RemotePreferenceContribution);
|
|
62
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { Command, CommandHandler, Emitter, Event } from '@theia/core';
|
|
18
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
20
|
+
import { WindowSearchParams } from '@theia/core/lib/common/window';
|
|
21
|
+
|
|
22
|
+
export const RemoteRegistryContribution = Symbol('RemoteRegistryContribution');
|
|
23
|
+
|
|
24
|
+
export interface RemoteRegistryContribution {
|
|
25
|
+
registerRemoteCommands(registry: RemoteRegistry): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@injectable()
|
|
29
|
+
export abstract class AbstractRemoteRegistryContribution implements RemoteRegistryContribution {
|
|
30
|
+
|
|
31
|
+
@inject(WindowService)
|
|
32
|
+
protected readonly windowService: WindowService;
|
|
33
|
+
|
|
34
|
+
abstract registerRemoteCommands(registry: RemoteRegistry): void;
|
|
35
|
+
|
|
36
|
+
protected openRemote(port: string, newWindow: boolean): void {
|
|
37
|
+
const searchParams = new URLSearchParams(location.search);
|
|
38
|
+
const localPort = searchParams.get('localPort') || searchParams.get('port');
|
|
39
|
+
const options: WindowSearchParams = {
|
|
40
|
+
port
|
|
41
|
+
};
|
|
42
|
+
if (localPort) {
|
|
43
|
+
options.localPort = localPort;
|
|
44
|
+
}
|
|
45
|
+
if (newWindow) {
|
|
46
|
+
this.windowService.openNewDefaultWindow(options);
|
|
47
|
+
} else {
|
|
48
|
+
this.windowService.reload(options);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class RemoteRegistry {
|
|
54
|
+
|
|
55
|
+
protected _commands: Command[] = [];
|
|
56
|
+
protected onDidRegisterCommandEmitter = new Emitter<[Command, CommandHandler | undefined]>();
|
|
57
|
+
|
|
58
|
+
get commands(): readonly Command[] {
|
|
59
|
+
return this._commands;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get onDidRegisterCommand(): Event<[Command, CommandHandler | undefined]> {
|
|
63
|
+
return this.onDidRegisterCommandEmitter.event;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
registerCommand(command: Command, handler?: CommandHandler): void {
|
|
67
|
+
this.onDidRegisterCommandEmitter.fire([command, handler]);
|
|
68
|
+
this._commands.push(command);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
|
|
19
|
+
@injectable()
|
|
20
|
+
export class RemoteService {
|
|
21
|
+
|
|
22
|
+
protected _connected: boolean;
|
|
23
|
+
|
|
24
|
+
isConnected(): boolean {
|
|
25
|
+
return this._connected;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setConnected(value: boolean): void {
|
|
29
|
+
this._connected = value;
|
|
30
|
+
}
|
|
31
|
+
}
|