itwillsync 1.3.2 → 1.3.4

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 CHANGED
@@ -3457,7 +3457,7 @@ var require_websocket_server = __commonJS({
3457
3457
  socket.on("error", socketOnError);
3458
3458
  const key = req.headers["sec-websocket-key"];
3459
3459
  const upgrade = req.headers.upgrade;
3460
- const version = +req.headers["sec-websocket-version"];
3460
+ const version2 = +req.headers["sec-websocket-version"];
3461
3461
  if (req.method !== "GET") {
3462
3462
  const message = "Invalid HTTP method";
3463
3463
  abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
@@ -3473,7 +3473,7 @@ var require_websocket_server = __commonJS({
3473
3473
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
3474
3474
  return;
3475
3475
  }
3476
- if (version !== 13 && version !== 8) {
3476
+ if (version2 !== 13 && version2 !== 8) {
3477
3477
  const message = "Missing or invalid Sec-WebSocket-Version header";
3478
3478
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
3479
3479
  "Sec-WebSocket-Version": "13, 8"
@@ -3517,7 +3517,7 @@ var require_websocket_server = __commonJS({
3517
3517
  }
3518
3518
  if (this.options.verifyClient) {
3519
3519
  const info = {
3520
- origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`],
3520
+ origin: req.headers[`${version2 === 8 ? "sec-websocket-origin" : "origin"}`],
3521
3521
  secure: !!(req.socket.authorized || req.socket.encrypted),
3522
3522
  req
3523
3523
  };
@@ -4170,6 +4170,11 @@ async function runSetupWizard() {
4170
4170
  return config;
4171
4171
  }
4172
4172
 
4173
+ // src/cli-options.ts
4174
+ import { readFileSync as readFileSync3 } from "fs";
4175
+ import { fileURLToPath as fileURLToPath3 } from "url";
4176
+ import { dirname as dirname3, join as join5 } from "path";
4177
+
4173
4178
  // src/hub-client.ts
4174
4179
  import { spawn as spawn2 } from "child_process";
4175
4180
  import { readFileSync as readFileSync2, existsSync as existsSync2, unlinkSync } from "fs";
@@ -4277,8 +4282,8 @@ async function killStaleHub() {
4277
4282
  return true;
4278
4283
  }
4279
4284
  async function spawnHub() {
4280
- const __dirname = dirname2(fileURLToPath2(import.meta.url));
4281
- const hubPath = join4(__dirname, "hub", "daemon.js");
4285
+ const __dirname2 = dirname2(fileURLToPath2(import.meta.url));
4286
+ const hubPath = join4(__dirname2, "hub", "daemon.js");
4282
4287
  return new Promise((resolve, reject) => {
4283
4288
  const child = spawn2("node", [hubPath], {
4284
4289
  detached: true,
@@ -4470,6 +4475,11 @@ async function sendHeartbeat(sessionId) {
4470
4475
  }
4471
4476
 
4472
4477
  // src/cli-options.ts
4478
+ var __filename = fileURLToPath3(import.meta.url);
4479
+ var __dirname = dirname3(__filename);
4480
+ var { version } = JSON.parse(
4481
+ readFileSync3(join5(__dirname, "..", "package.json"), "utf-8")
4482
+ );
4473
4483
  var DEFAULT_PORT = SESSION_PORT_START;
4474
4484
  function parseArgs(argv) {
4475
4485
  const options = {
@@ -4531,7 +4541,7 @@ function parseArgs(argv) {
4531
4541
  printHelp();
4532
4542
  process.exit(0);
4533
4543
  } else if (arg === "--version" || arg === "-v") {
4534
- console.log("itwillsync v0.1.0");
4544
+ console.log(`itwillsync v${version}`);
4535
4545
  process.exit(0);
4536
4546
  } else {
4537
4547
  options.command = args.slice(i);
@@ -4583,8 +4593,8 @@ Hub Management:
4583
4593
  }
4584
4594
 
4585
4595
  // src/index.ts
4586
- import { fileURLToPath as fileURLToPath3 } from "url";
4587
- import { join as join5, dirname as dirname3 } from "path";
4596
+ import { fileURLToPath as fileURLToPath4 } from "url";
4597
+ import { join as join6, dirname as dirname4 } from "path";
4588
4598
  import { spawn as spawn3 } from "child_process";
4589
4599
  function preventSleep() {
4590
4600
  try {
@@ -4735,8 +4745,8 @@ async function main() {
4735
4745
  const port = await findAvailablePort(options.port);
4736
4746
  const host = options.localhost ? "127.0.0.1" : "0.0.0.0";
4737
4747
  const ip = await resolveSessionIP(networkingMode, options.localhost);
4738
- const __dirname = dirname3(fileURLToPath3(import.meta.url));
4739
- const webClientPath = join5(__dirname, "web-client");
4748
+ const __dirname2 = dirname4(fileURLToPath4(import.meta.url));
4749
+ const webClientPath = join6(__dirname2, "web-client");
4740
4750
  const ptyManager = new PtyManager(cmd, cmdArgs);
4741
4751
  const server = createSyncServer({
4742
4752
  ptyManager,
@@ -4768,12 +4778,12 @@ async function main() {
4768
4778
  }
4769
4779
  }
4770
4780
  const dashboardUrl = hubConfig ? `http://${ip}:${HUB_EXTERNAL_PORT}?token=${hubConfig.masterToken}` : null;
4771
- if (isFirstSession && dashboardUrl && !options.noQr) {
4781
+ if (dashboardUrl && !options.noQr) {
4782
+ if (!isFirstSession) {
4783
+ console.log(`
4784
+ Session "${cmd}" registered with hub.`);
4785
+ }
4772
4786
  displayQR(dashboardUrl);
4773
- console.log(` Dashboard: ${dashboardUrl}`);
4774
- } else if (isFirstSession && !options.noQr) {
4775
- const directUrl = `http://${ip}:${port}?token=${token}`;
4776
- displayQR(directUrl);
4777
4787
  } else if (dashboardUrl) {
4778
4788
  console.log(`
4779
4789
  Session "${cmd}" registered with hub.`);
@@ -4809,6 +4819,10 @@ async function main() {
4809
4819
  process.stdout.on("resize", handleResize);
4810
4820
  handleResize();
4811
4821
  async function cleanup() {
4822
+ process.stdout.write(
4823
+ "\x1B[>0u\x1B[?2004l\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?25h\x1B[?1049l"
4824
+ // Exit alternate screen buffer (if active)
4825
+ );
4812
4826
  if (process.stdin.isTTY) {
4813
4827
  process.stdin.setRawMode(false);
4814
4828
  }