itwillsync 1.0.2 → 1.0.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
@@ -3650,6 +3650,9 @@ var require_websocket_server = __commonJS({
3650
3650
 
3651
3651
  // src/pty-manager.ts
3652
3652
  import * as pty from "node-pty";
3653
+ import { chmodSync } from "fs";
3654
+ import { join, dirname } from "path";
3655
+ import { fileURLToPath } from "url";
3653
3656
  function buildEnv() {
3654
3657
  const env = {};
3655
3658
  for (const [key, value] of Object.entries(process.env)) {
@@ -3662,11 +3665,28 @@ function buildEnv() {
3662
3665
  }
3663
3666
  return env;
3664
3667
  }
3668
+ function ensureSpawnHelperPermissions() {
3669
+ if (process.platform === "win32") return;
3670
+ try {
3671
+ const ptyEntryUrl = import.meta.resolve("node-pty");
3672
+ const ptyDir = dirname(fileURLToPath(ptyEntryUrl));
3673
+ const helperPath = join(
3674
+ ptyDir,
3675
+ "..",
3676
+ "prebuilds",
3677
+ `${process.platform}-${process.arch}`,
3678
+ "spawn-helper"
3679
+ );
3680
+ chmodSync(helperPath, 493);
3681
+ } catch {
3682
+ }
3683
+ }
3665
3684
  var PtyManager = class {
3666
3685
  ptyProcess;
3667
3686
  /** The process ID of the spawned PTY process. */
3668
3687
  pid;
3669
3688
  constructor(command, args) {
3689
+ ensureSpawnHelperPermissions();
3670
3690
  const useConpty = process.platform === "win32";
3671
3691
  this.ptyProcess = pty.spawn(command, args, {
3672
3692
  name: "xterm-256color",
@@ -3775,7 +3795,7 @@ function findAvailablePort(startPort) {
3775
3795
  // src/server.ts
3776
3796
  import { createServer as createServer2 } from "http";
3777
3797
  import { readFile } from "fs/promises";
3778
- import { join, extname } from "path";
3798
+ import { join as join2, extname } from "path";
3779
3799
  import { gzipSync } from "zlib";
3780
3800
 
3781
3801
  // ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/wrapper.mjs
@@ -3798,7 +3818,7 @@ var MIME_TYPES = {
3798
3818
  var COMPRESSIBLE = /* @__PURE__ */ new Set([".html", ".js", ".css", ".json", ".svg"]);
3799
3819
  var gzipCache = /* @__PURE__ */ new Map();
3800
3820
  async function serveStaticFile(webClientPath, filePath, req, res) {
3801
- const fullPath = join(webClientPath, filePath);
3821
+ const fullPath = join2(webClientPath, filePath);
3802
3822
  const ext = extname(fullPath);
3803
3823
  const contentType = MIME_TYPES[ext] || "application/octet-stream";
3804
3824
  try {
@@ -3940,8 +3960,8 @@ function displayQR(url) {
3940
3960
  }
3941
3961
 
3942
3962
  // src/index.ts
3943
- import { fileURLToPath } from "url";
3944
- import { join as join2, dirname } from "path";
3963
+ import { fileURLToPath as fileURLToPath2 } from "url";
3964
+ import { join as join3, dirname as dirname2 } from "path";
3945
3965
  import { spawn as spawn2 } from "child_process";
3946
3966
  function preventSleep() {
3947
3967
  try {
@@ -4037,8 +4057,8 @@ async function main() {
4037
4057
  const host = options.localhost ? "127.0.0.1" : "0.0.0.0";
4038
4058
  const ip = options.localhost ? "127.0.0.1" : getLocalIP();
4039
4059
  const url = `http://${ip}:${port}?token=${token}`;
4040
- const __dirname = dirname(fileURLToPath(import.meta.url));
4041
- const webClientPath = join2(__dirname, "web-client");
4060
+ const __dirname = dirname2(fileURLToPath2(import.meta.url));
4061
+ const webClientPath = join3(__dirname, "web-client");
4042
4062
  const ptyManager = new PtyManager(cmd, cmdArgs);
4043
4063
  const server = createSyncServer({
4044
4064
  ptyManager,