itwillsync 1.3.0 → 1.3.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 +26 -3
- package/dist/index.js.map +1 -1
- package/dist/web-client/assets/{index--759FJd4.js → index-CpcOfuy-.js} +17 -16
- package/dist/web-client/assets/index-viCDtpt6.css +1 -0
- package/dist/web-client/index.html +2 -2
- package/package.json +1 -1
- package/dist/web-client/assets/index-DI3EO9qL.css +0 -1
package/dist/index.js
CHANGED
|
@@ -3683,6 +3683,14 @@ function ensureSpawnHelperPermissions() {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
var PtyManager = class {
|
|
3685
3685
|
ptyProcess;
|
|
3686
|
+
_cols = 80;
|
|
3687
|
+
_rows = 24;
|
|
3688
|
+
get cols() {
|
|
3689
|
+
return this._cols;
|
|
3690
|
+
}
|
|
3691
|
+
get rows() {
|
|
3692
|
+
return this._rows;
|
|
3693
|
+
}
|
|
3686
3694
|
/** The process ID of the spawned PTY process. */
|
|
3687
3695
|
pid;
|
|
3688
3696
|
constructor(command, args) {
|
|
@@ -3725,6 +3733,8 @@ var PtyManager = class {
|
|
|
3725
3733
|
resize(cols, rows) {
|
|
3726
3734
|
try {
|
|
3727
3735
|
this.ptyProcess.resize(cols, rows);
|
|
3736
|
+
this._cols = cols;
|
|
3737
|
+
this._rows = rows;
|
|
3728
3738
|
} catch {
|
|
3729
3739
|
}
|
|
3730
3740
|
}
|
|
@@ -3929,7 +3939,7 @@ async function serveStaticFile(webClientPath, filePath, req, res) {
|
|
|
3929
3939
|
var PING_INTERVAL_MS = 3e4;
|
|
3930
3940
|
var SCROLLBACK_BUFFER_SIZE = 5e4;
|
|
3931
3941
|
function createSyncServer(options) {
|
|
3932
|
-
const { ptyManager, token, webClientPath, host, port } = options;
|
|
3942
|
+
const { ptyManager, token, webClientPath, host, port, localTerminalOwnsResize = false } = options;
|
|
3933
3943
|
const clients = /* @__PURE__ */ new Set();
|
|
3934
3944
|
const aliveMap = /* @__PURE__ */ new WeakMap();
|
|
3935
3945
|
let scrollbackBuffer = "";
|
|
@@ -3972,6 +3982,7 @@ function createSyncServer(options) {
|
|
|
3972
3982
|
if (scrollbackBuffer.length > 0) {
|
|
3973
3983
|
ws.send(JSON.stringify({ type: "data", data: scrollbackBuffer, seq }));
|
|
3974
3984
|
}
|
|
3985
|
+
ws.send(JSON.stringify({ type: "resize", cols: ptyManager.cols, rows: ptyManager.rows }));
|
|
3975
3986
|
ws.on("pong", () => {
|
|
3976
3987
|
aliveMap.set(ws, true);
|
|
3977
3988
|
});
|
|
@@ -3981,7 +3992,9 @@ function createSyncServer(options) {
|
|
|
3981
3992
|
if (message.type === "input" && typeof message.data === "string") {
|
|
3982
3993
|
ptyManager.write(message.data);
|
|
3983
3994
|
} else if (message.type === "resize" && typeof message.cols === "number" && typeof message.rows === "number") {
|
|
3984
|
-
|
|
3995
|
+
if (!localTerminalOwnsResize) {
|
|
3996
|
+
ptyManager.resize(message.cols, message.rows);
|
|
3997
|
+
}
|
|
3985
3998
|
} else if (message.type === "resume" && typeof message.lastSeq === "number") {
|
|
3986
3999
|
const missed = seq - message.lastSeq;
|
|
3987
4000
|
if (missed > 0 && scrollbackBuffer.length > 0) {
|
|
@@ -4024,6 +4037,14 @@ function createSyncServer(options) {
|
|
|
4024
4037
|
clients.clear();
|
|
4025
4038
|
wssServer.close();
|
|
4026
4039
|
httpServer.close();
|
|
4040
|
+
},
|
|
4041
|
+
broadcastResize(cols, rows) {
|
|
4042
|
+
const msg = JSON.stringify({ type: "resize", cols, rows });
|
|
4043
|
+
for (const client of clients) {
|
|
4044
|
+
if (client.readyState === client.OPEN) {
|
|
4045
|
+
client.send(msg);
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4027
4048
|
}
|
|
4028
4049
|
};
|
|
4029
4050
|
}
|
|
@@ -4639,7 +4660,8 @@ async function main() {
|
|
|
4639
4660
|
token,
|
|
4640
4661
|
webClientPath,
|
|
4641
4662
|
host,
|
|
4642
|
-
port
|
|
4663
|
+
port,
|
|
4664
|
+
localTerminalOwnsResize: true
|
|
4643
4665
|
});
|
|
4644
4666
|
let registeredSession = null;
|
|
4645
4667
|
let heartbeatInterval = null;
|
|
@@ -4698,6 +4720,7 @@ async function main() {
|
|
|
4698
4720
|
function handleResize() {
|
|
4699
4721
|
if (process.stdout.columns && process.stdout.rows) {
|
|
4700
4722
|
ptyManager.resize(process.stdout.columns, process.stdout.rows);
|
|
4723
|
+
server.broadcastResize(process.stdout.columns, process.stdout.rows);
|
|
4701
4724
|
}
|
|
4702
4725
|
}
|
|
4703
4726
|
process.stdout.on("resize", handleResize);
|