peer-term 1.1.4 → 1.1.6
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/package.json +1 -1
- package/src/index.js +10 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -173,6 +173,7 @@ class Session {
|
|
|
173
173
|
|
|
174
174
|
this.ws = null;
|
|
175
175
|
this.code = null;
|
|
176
|
+
this.hostToken = null;
|
|
176
177
|
this.keyPair = null;
|
|
177
178
|
this.sharedKey = null;
|
|
178
179
|
this.ptyProcess = null;
|
|
@@ -211,12 +212,16 @@ class Session {
|
|
|
211
212
|
const config = JSON.stringify({
|
|
212
213
|
type: 'session-config',
|
|
213
214
|
readonly: this.readOnly,
|
|
214
|
-
version: '1.1.
|
|
215
|
+
version: '1.1.6',
|
|
215
216
|
shell: this.shell,
|
|
216
217
|
startPath: this.startPath,
|
|
217
218
|
});
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
try {
|
|
220
|
+
const payload = await encrypt(this.sharedKey, config);
|
|
221
|
+
this.ws.send(JSON.stringify({ type: 'data', payload }));
|
|
222
|
+
} catch (err) {
|
|
223
|
+
this.log(`Failed to send session config: ${err.message}`);
|
|
224
|
+
}
|
|
220
225
|
}
|
|
221
226
|
|
|
222
227
|
// ─── Start the session ──────────────────────────────────────────────
|
|
@@ -263,6 +268,7 @@ class Session {
|
|
|
263
268
|
switch (msg.type) {
|
|
264
269
|
case 'code': {
|
|
265
270
|
this.code = msg.code;
|
|
271
|
+
this.hostToken = msg.hostToken || null;
|
|
266
272
|
printSessionBox({
|
|
267
273
|
code: this.code,
|
|
268
274
|
expiry: formatDuration(this.expiryMs),
|
|
@@ -628,7 +634,7 @@ class Session {
|
|
|
628
634
|
this._pendingReconnectWs = newWs;
|
|
629
635
|
|
|
630
636
|
newWs.on('open', () => {
|
|
631
|
-
newWs.send(JSON.stringify({ type: 'host-rejoin', code: this.code }));
|
|
637
|
+
newWs.send(JSON.stringify({ type: 'host-rejoin', code: this.code, hostToken: this.hostToken }));
|
|
632
638
|
});
|
|
633
639
|
|
|
634
640
|
newWs.on('message', (raw) => {
|