run-spaceapp 0.1.11 → 0.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run-spaceapp",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Cross-platform Docker launcher for the SpaceApp self-hosted agent workspace",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "provenance": true
48
48
  },
49
- "gitHead": "c53e6dd08441f3a517f21f7b0ca6f82ec36a1761"
49
+ "gitHead": "55dff6314db5ded932361275b85a5a2008920128"
50
50
  }
package/src/cli.mjs CHANGED
@@ -33,7 +33,6 @@ const SETUP_STATUS_TIMEOUT_MS = 10_000;
33
33
  const trustedCommands = new Set([
34
34
  "codesign",
35
35
  "docker",
36
- "explorer.exe",
37
36
  "hdiutil",
38
37
  "open",
39
38
  "powershell.exe",
@@ -47,6 +46,7 @@ const trustedCommands = new Set([
47
46
  ]);
48
47
  const trustedEnvironmentNames = new Set([
49
48
  "SPACEAPP_DOCKER_INSTALLER_PATH",
49
+ "SPACEAPP_OPEN_URL",
50
50
  "SPACEAPP_RESUME_SCRIPT_PATH"
51
51
  ]);
52
52
 
@@ -812,7 +812,6 @@ function spawnTrustedCommand(spec, options) {
812
812
  switch (spec.command) {
813
813
  case "codesign": return spawn("codesign", args, options);
814
814
  case "docker": return spawn("docker", args, options);
815
- case "explorer.exe": return spawn("explorer.exe", args, options);
816
815
  case "hdiutil": return spawn("hdiutil", args, options);
817
816
  case "open": return spawn("open", args, options);
818
817
  case "powershell.exe":
@@ -847,7 +846,11 @@ function openBrowser(url, platform, execute, io) {
847
846
  return execute({ command: "open", args: [url] }, io);
848
847
  }
849
848
  if (platform === "win32") {
850
- return execute({ command: "explorer.exe", args: [url] }, io);
849
+ return execute({
850
+ command: "powershell.exe",
851
+ operation: "open-spaceapp-browser",
852
+ env: { SPACEAPP_OPEN_URL: url }
853
+ }, io);
851
854
  }
852
855
  return execute({ command: "xdg-open", args: [url] }, io);
853
856
  }
@@ -73,6 +73,17 @@ export function windowsPowerShellArgs(operation) {
73
73
  "$path = $env:SPACEAPP_DOCKER_DESKTOP_PATH",
74
74
  "if ([string]::IsNullOrWhiteSpace($path)) { exit 1 }",
75
75
  "Start-Process -FilePath $path"
76
+ ].join("; "),
77
+ "open-spaceapp-browser": [
78
+ "$ErrorActionPreference = 'Stop'",
79
+ "$url = $env:SPACEAPP_OPEN_URL",
80
+ "$uri = $null",
81
+ "if ([string]::IsNullOrWhiteSpace($url) -or -not [Uri]::TryCreate($url, [UriKind]::Absolute, [ref]$uri)) { exit 1 }",
82
+ "if ($uri.Scheme -ne 'http' -or @('127.0.0.1','0.0.0.0') -notcontains $uri.Host -or $uri.Port -lt 1024 -or $uri.Port -gt 65535) { exit 1 }",
83
+ "$roots = @([Environment]::GetEnvironmentVariable('ProgramFiles(x86)'), [Environment]::GetEnvironmentVariable('ProgramFiles'), [Environment]::GetEnvironmentVariable('LOCALAPPDATA')) | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }",
84
+ "$edge = $roots | ForEach-Object { Join-Path $_ 'Microsoft\\Edge\\Application\\msedge.exe' } | Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } | Select-Object -First 1",
85
+ "if ($edge) { Start-Process -FilePath $edge -ArgumentList @('--no-first-run','--no-default-browser-check',$url); exit 0 }",
86
+ "Start-Process -FilePath 'explorer.exe' -ArgumentList @($url)"
76
87
  ].join("; ")
77
88
  };
78
89
  if (!Object.hasOwn(scripts, operation)) {