tamga-vdesktop 1.2.0 → 1.2.2

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.
Files changed (3) hide show
  1. package/dist/cli.js +64 -32
  2. package/dist/server.js +33 -12
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -578,61 +578,93 @@ function findPlaywrightManagedBrowser(chromiumRef) {
578
578
  }
579
579
  function resolvePlaywrightCliPath() {
580
580
  try {
581
- return require2.resolve("playwright-core/cli.js");
581
+ const pkgPath = require2.resolve("playwright-core/package.json");
582
+ const cliPath = path3.join(path3.dirname(pkgPath), "cli.js");
583
+ if (fs3.existsSync(cliPath)) return cliPath;
582
584
  } catch {
583
- return null;
584
585
  }
586
+ const moduleDir = path3.dirname(new URL(import.meta.url).pathname);
587
+ const candidates = [
588
+ path3.resolve(moduleDir, "..", "node_modules", "playwright-core", "cli.js"),
589
+ path3.resolve(moduleDir, "..", "..", "playwright-core", "cli.js"),
590
+ path3.resolve(process.cwd(), "node_modules", "playwright-core", "cli.js"),
591
+ "/usr/lib/node_modules/tamga-vdesktop/node_modules/playwright-core/cli.js",
592
+ "/usr/lib/node_modules/playwright-core/cli.js",
593
+ "/usr/local/lib/node_modules/tamga-vdesktop/node_modules/playwright-core/cli.js",
594
+ "/usr/local/lib/node_modules/playwright-core/cli.js"
595
+ ];
596
+ for (const candidate of candidates) {
597
+ if (fs3.existsSync(candidate)) return candidate;
598
+ }
599
+ return null;
585
600
  }
586
601
  function installPlaywrightBrowserSync(opts) {
587
602
  const existing = findPlaywrightManagedBrowser();
588
- if (existing) return true;
603
+ if (existing && !opts?.withDeps) return true;
589
604
  const cliPath = resolvePlaywrightCliPath();
590
605
  if (!cliPath) {
606
+ if (existing) return true;
591
607
  if (!opts?.quiet) {
592
608
  console.error("[TamgaVDesktop] playwright-core/cli.js bulunamad\u0131.");
593
609
  }
594
610
  return false;
595
611
  }
596
- const args = [cliPath, "install", "chromium-headless-shell"];
597
- if (opts?.withDeps && process.platform === "linux" && typeof process.getuid === "function" && process.getuid() === 0) {
598
- args.push("--with-deps");
599
- }
600
- if (opts?.quiet) {
601
- args.push("--no-progress");
602
- }
612
+ const shouldWithDeps = Boolean(
613
+ opts?.withDeps && process.platform === "linux" && typeof process.getuid === "function" && process.getuid() === 0
614
+ );
615
+ const hosts = process.env.PLAYWRIGHT_DOWNLOAD_HOST ? [process.env.PLAYWRIGHT_DOWNLOAD_HOST] : ["", "https://cdn.npmmirror.com/binaries/playwright"];
603
616
  if (!opts?.quiet) {
604
617
  console.log("[TamgaVDesktop] Yerle\u015Fik Playwright Chromium taray\u0131c\u0131s\u0131 kuruluyor...");
605
618
  }
606
- const res = spawnSync(process.execPath, args, {
607
- stdio: opts?.quiet ? "ignore" : "inherit",
608
- env: {
619
+ for (let i = 0; i < hosts.length; i++) {
620
+ const host = hosts[i];
621
+ const args = [cliPath, "install", "chromium-headless-shell"];
622
+ if (i === 0 && shouldWithDeps) args.push("--with-deps");
623
+ if (opts?.quiet) args.push("--no-progress");
624
+ const env = {
609
625
  ...process.env,
610
626
  PLAYWRIGHT_SKIP_BROWSER_GC: "1"
627
+ };
628
+ if (host) env.PLAYWRIGHT_DOWNLOAD_HOST = host;
629
+ const res = spawnSync(process.execPath, args, {
630
+ stdio: opts?.quiet ? "ignore" : "inherit",
631
+ env
632
+ });
633
+ if (res.status === 0 && findPlaywrightManagedBrowser()) {
634
+ return true;
635
+ }
636
+ const fallbackArgs = [cliPath, "install", "--only-shell", "chromium"];
637
+ if (i === 0 && shouldWithDeps) fallbackArgs.push("--with-deps");
638
+ if (opts?.quiet) fallbackArgs.push("--no-progress");
639
+ const res2 = spawnSync(process.execPath, fallbackArgs, {
640
+ stdio: opts?.quiet ? "ignore" : "inherit",
641
+ env
642
+ });
643
+ if (res2.status === 0 && findPlaywrightManagedBrowser()) {
644
+ return true;
611
645
  }
612
- });
613
- if (res.status === 0 && findPlaywrightManagedBrowser()) {
614
- return true;
615
646
  }
616
- const fallbackArgs = [cliPath, "install", "--only-shell", "chromium"];
617
- if (opts?.quiet) fallbackArgs.push("--no-progress");
618
- const res2 = spawnSync(process.execPath, fallbackArgs, {
619
- stdio: opts?.quiet ? "ignore" : "inherit"
620
- });
621
- return res2.status === 0 && Boolean(findPlaywrightManagedBrowser());
647
+ return Boolean(findPlaywrightManagedBrowser());
622
648
  }
623
649
  async function installPlaywrightBrowserAsync() {
624
650
  if (findPlaywrightManagedBrowser()) return;
625
651
  const cliPath = resolvePlaywrightCliPath();
626
652
  if (!cliPath) return;
627
- await new Promise((resolve) => {
628
- const child = spawn2(
629
- process.execPath,
630
- [cliPath, "install", "chromium-headless-shell", "--no-progress"],
631
- { stdio: "ignore" }
632
- );
633
- child.on("exit", () => resolve());
634
- child.on("error", () => resolve());
635
- });
653
+ const hosts = process.env.PLAYWRIGHT_DOWNLOAD_HOST ? [process.env.PLAYWRIGHT_DOWNLOAD_HOST] : ["", "https://cdn.npmmirror.com/binaries/playwright"];
654
+ for (const host of hosts) {
655
+ if (findPlaywrightManagedBrowser()) return;
656
+ const env = { ...process.env, PLAYWRIGHT_SKIP_BROWSER_GC: "1" };
657
+ if (host) env.PLAYWRIGHT_DOWNLOAD_HOST = host;
658
+ await new Promise((resolve) => {
659
+ const child = spawn2(
660
+ process.execPath,
661
+ [cliPath, "install", "chromium-headless-shell", "--no-progress"],
662
+ { stdio: "ignore", env }
663
+ );
664
+ child.on("exit", () => resolve());
665
+ child.on("error", () => resolve());
666
+ });
667
+ }
636
668
  }
637
669
  function normalizeUserUrl(rawInput) {
638
670
  const trimmed = rawInput.trim();
@@ -3739,7 +3771,7 @@ var VSCodeServerManager = class {
3739
3771
  };
3740
3772
 
3741
3773
  // server/index.ts
3742
- var TAMGA_VERSION = "1.2.0";
3774
+ var TAMGA_VERSION = "1.2.2";
3743
3775
  var MIME_MAP = {
3744
3776
  html: "text/html; charset=utf-8",
3745
3777
  htm: "text/html; charset=utf-8",
package/dist/server.js CHANGED
@@ -859,24 +859,45 @@ function findPlaywrightManagedBrowser(chromiumRef) {
859
859
  }
860
860
  function resolvePlaywrightCliPath() {
861
861
  try {
862
- return require2.resolve("playwright-core/cli.js");
862
+ const pkgPath = require2.resolve("playwright-core/package.json");
863
+ const cliPath = path2.join(path2.dirname(pkgPath), "cli.js");
864
+ if (fs2.existsSync(cliPath)) return cliPath;
863
865
  } catch {
864
- return null;
865
866
  }
867
+ const moduleDir = path2.dirname(new URL(import.meta.url).pathname);
868
+ const candidates = [
869
+ path2.resolve(moduleDir, "..", "node_modules", "playwright-core", "cli.js"),
870
+ path2.resolve(moduleDir, "..", "..", "playwright-core", "cli.js"),
871
+ path2.resolve(process.cwd(), "node_modules", "playwright-core", "cli.js"),
872
+ "/usr/lib/node_modules/tamga-vdesktop/node_modules/playwright-core/cli.js",
873
+ "/usr/lib/node_modules/playwright-core/cli.js",
874
+ "/usr/local/lib/node_modules/tamga-vdesktop/node_modules/playwright-core/cli.js",
875
+ "/usr/local/lib/node_modules/playwright-core/cli.js"
876
+ ];
877
+ for (const candidate of candidates) {
878
+ if (fs2.existsSync(candidate)) return candidate;
879
+ }
880
+ return null;
866
881
  }
867
882
  async function installPlaywrightBrowserAsync() {
868
883
  if (findPlaywrightManagedBrowser()) return;
869
884
  const cliPath = resolvePlaywrightCliPath();
870
885
  if (!cliPath) return;
871
- await new Promise((resolve) => {
872
- const child = spawn(
873
- process.execPath,
874
- [cliPath, "install", "chromium-headless-shell", "--no-progress"],
875
- { stdio: "ignore" }
876
- );
877
- child.on("exit", () => resolve());
878
- child.on("error", () => resolve());
879
- });
886
+ const hosts = process.env.PLAYWRIGHT_DOWNLOAD_HOST ? [process.env.PLAYWRIGHT_DOWNLOAD_HOST] : ["", "https://cdn.npmmirror.com/binaries/playwright"];
887
+ for (const host of hosts) {
888
+ if (findPlaywrightManagedBrowser()) return;
889
+ const env = { ...process.env, PLAYWRIGHT_SKIP_BROWSER_GC: "1" };
890
+ if (host) env.PLAYWRIGHT_DOWNLOAD_HOST = host;
891
+ await new Promise((resolve) => {
892
+ const child = spawn(
893
+ process.execPath,
894
+ [cliPath, "install", "chromium-headless-shell", "--no-progress"],
895
+ { stdio: "ignore", env }
896
+ );
897
+ child.on("exit", () => resolve());
898
+ child.on("error", () => resolve());
899
+ });
900
+ }
880
901
  }
881
902
  function normalizeUserUrl(rawInput) {
882
903
  const trimmed = rawInput.trim();
@@ -3693,7 +3714,7 @@ var VSCodeServerManager = class {
3693
3714
  };
3694
3715
 
3695
3716
  // server/index.ts
3696
- var TAMGA_VERSION = "1.2.0";
3717
+ var TAMGA_VERSION = "1.2.2";
3697
3718
  var MIME_MAP = {
3698
3719
  html: "text/html; charset=utf-8",
3699
3720
  htm: "text/html; charset=utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamga-vdesktop",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "TamgaVDesktop — Self-hostable Linux Virtual Desktop OS platform with native web shell, real Linux terminal, built-in HiDPI Playwright Chromium browser, and seamless native Linux GUI apps.",