cli-tunnel 1.3.1-beta.0 → 1.3.1-beta.1
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/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -189,6 +189,7 @@ setInterval(() => {
|
|
|
189
189
|
// ─── Bridge server ──────────────────────────────────────────
|
|
190
190
|
const acpEventLog = [];
|
|
191
191
|
const connections = new Map();
|
|
192
|
+
let localResizeAt = 0; // Timestamp of last local terminal resize
|
|
192
193
|
// #10: Session TTL enforcement — periodically close expired connections
|
|
193
194
|
setInterval(() => {
|
|
194
195
|
if (Date.now() - sessionCreatedAt > SESSION_TTL) {
|
|
@@ -557,11 +558,12 @@ wss.on('connection', (ws, req) => {
|
|
|
557
558
|
ptyProcess.write(msg.data);
|
|
558
559
|
}
|
|
559
560
|
}
|
|
560
|
-
// #7: NaN guard on pty_resize
|
|
561
|
+
// #7: NaN guard on pty_resize — remote resize only if local hasn't resized recently
|
|
561
562
|
if (msg.type === 'pty_resize') {
|
|
562
563
|
const cols = Number(msg.cols);
|
|
563
564
|
const rows = Number(msg.rows);
|
|
564
|
-
|
|
565
|
+
const localRecentlyResized = Date.now() - localResizeAt < 2000;
|
|
566
|
+
if (Number.isFinite(cols) && Number.isFinite(rows) && ptyProcess && !localRecentlyResized) {
|
|
565
567
|
ptyProcess.resize(Math.max(1, Math.min(500, cols)), Math.max(1, Math.min(200, rows)));
|
|
566
568
|
}
|
|
567
569
|
}
|
|
@@ -814,6 +816,8 @@ async function main() {
|
|
|
814
816
|
});
|
|
815
817
|
}
|
|
816
818
|
console.log(` ${DIM}Starting ${command}...${RESET}\n`);
|
|
819
|
+
// Clear screen before PTY takes over — prevents overlap with banner/QR output
|
|
820
|
+
process.stdout.write('\x1b[2J\x1b[H');
|
|
817
821
|
// Spawn PTY
|
|
818
822
|
const nodePty = await import('node-pty');
|
|
819
823
|
const cols = process.stdout.columns || 120;
|
|
@@ -902,6 +906,6 @@ async function main() {
|
|
|
902
906
|
process.stdin.setRawMode(true);
|
|
903
907
|
process.stdin.resume();
|
|
904
908
|
process.stdin.on('data', (data) => ptyProcess.write(data.toString()));
|
|
905
|
-
process.stdout.on('resize', () => ptyProcess.resize(process.stdout.columns || 120, process.stdout.rows || 30));
|
|
909
|
+
process.stdout.on('resize', () => { localResizeAt = Date.now(); ptyProcess.resize(process.stdout.columns || 120, process.stdout.rows || 30); });
|
|
906
910
|
}
|
|
907
911
|
main().catch((err) => { console.error(err); process.exit(1); });
|