unforgit 0.11.21 → 0.11.23

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
@@ -3407,6 +3407,11 @@ function assertSafeDashboardBind(host, allowNetwork = false) {
3407
3407
  );
3408
3408
  }
3409
3409
  }
3410
+ var IP_OR_LOOPBACK_HOST = /^(\d{1,3}(\.\d{1,3}){3}|localhost|.*:.*)$/i;
3411
+ function dashboardAllowedHosts(host, configured) {
3412
+ if (IP_OR_LOOPBACK_HOST.test(host)) return configured;
3413
+ return configured ? `${configured},${host}` : host;
3414
+ }
3410
3415
  function parseDashboardPort(port) {
3411
3416
  const value = port === void 0 ? 3838 : Number(port);
3412
3417
  if (!Number.isInteger(value) || value < 1 || value > 65535) {
@@ -3469,16 +3474,22 @@ Examples:
3469
3474
  if (launch.host !== "127.0.0.1" && launch.host !== "localhost") {
3470
3475
  logger.warn("Dashboard is bound to a network address. Use only on trusted private networks such as Tailscale.");
3471
3476
  }
3477
+ const env = {
3478
+ ...process.env,
3479
+ UNFORGIT_WORKSPACE: launch.workspace
3480
+ };
3481
+ const allowedHosts = dashboardAllowedHosts(
3482
+ launch.host,
3483
+ process.env.UNFORGIT_DASHBOARD_ALLOWED_HOSTS
3484
+ );
3485
+ if (allowedHosts !== void 0) env.UNFORGIT_DASHBOARD_ALLOWED_HOSTS = allowedHosts;
3472
3486
  const child = spawn2(
3473
3487
  "pnpm",
3474
3488
  ["exec", "next", "dev", "-p", String(launch.port), "-H", launch.host],
3475
3489
  {
3476
3490
  cwd: dashboardAppDir,
3477
3491
  stdio: "inherit",
3478
- env: {
3479
- ...process.env,
3480
- UNFORGIT_WORKSPACE: launch.workspace
3481
- }
3492
+ env
3482
3493
  }
3483
3494
  );
3484
3495
  child.on("error", (err) => {