pinggy 0.6.10 → 0.7.0

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
@@ -13,7 +13,7 @@ import {
13
13
  restorableTunnelCount,
14
14
  runDaemonChild,
15
15
  startRemoteManagement
16
- } from "./chunk-G3NF35JY.js";
16
+ } from "./chunk-ZSED6OIR.js";
17
17
  import "./chunk-VD5ZFCZW.js";
18
18
  import "./chunk-P54K7NPF.js";
19
19
  import {
@@ -33,7 +33,7 @@ import {
33
33
  validateName,
34
34
  validateNameForStorage,
35
35
  validateNameStrict
36
- } from "./chunk-3IPMFCEF.js";
36
+ } from "./chunk-QUVQ7ODD.js";
37
37
  import "./chunk-XZ64ZAGO.js";
38
38
  import {
39
39
  TunnelManager
@@ -44,7 +44,7 @@ import {
44
44
  isDaemonRunning,
45
45
  removeDeadDaemonFiles,
46
46
  setDaemonLauncher
47
- } from "./chunk-AYU3GM4D.js";
47
+ } from "./chunk-2IPBK3RG.js";
48
48
  import {
49
49
  DaemonHost,
50
50
  DeviceAgentState
@@ -155,7 +155,7 @@ async function verifyAndLoad() {
155
155
  process.exit(1);
156
156
  }
157
157
  }
158
- await import("./main-3D7R75PR.js");
158
+ await import("./main-M4BTDE2A.js");
159
159
  }
160
160
  verifyAndLoad().catch((err) => {
161
161
  printer_default.fatal(`Failed to start CLI:, ${err}`);
@@ -6,10 +6,10 @@ import {
6
6
  getRemoteManagementState,
7
7
  initiateRemoteManagement,
8
8
  runDaemonChild
9
- } from "./chunk-G3NF35JY.js";
9
+ } from "./chunk-ZSED6OIR.js";
10
10
  import "./chunk-VD5ZFCZW.js";
11
11
  import "./chunk-P54K7NPF.js";
12
- import "./chunk-3IPMFCEF.js";
12
+ import "./chunk-QUVQ7ODD.js";
13
13
  import "./chunk-XZ64ZAGO.js";
14
14
  import {
15
15
  TunnelManager
@@ -21,7 +21,7 @@ import {
21
21
  getDaemonInfo,
22
22
  getInProcessDaemonHandle,
23
23
  isDaemonRunning
24
- } from "./chunk-AYU3GM4D.js";
24
+ } from "./chunk-2IPBK3RG.js";
25
25
  import {
26
26
  DaemonHost
27
27
  } from "./chunk-MKGD2QAI.js";
@@ -28,7 +28,7 @@ import {
28
28
  unixLayoutPaths,
29
29
  versionFromTag,
30
30
  writeUpdateState
31
- } from "./chunk-AYU3GM4D.js";
31
+ } from "./chunk-2IPBK3RG.js";
32
32
  import "./chunk-MKGD2QAI.js";
33
33
  import {
34
34
  errorMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinggy",
3
- "version": "0.6.10",
3
+ "version": "0.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Create secure, shareable tunnels to your localhost and manage them from the command line. ",
@@ -71,6 +71,7 @@
71
71
  "@xterm/headless": "^6.0.0",
72
72
  "blessed": "^0.1.81",
73
73
  "clipboardy": "^5.0.0",
74
+ "major": "^1.0.26",
74
75
  "mime": "^4.1.0",
75
76
  "node-pty": "^1.1.0",
76
77
  "picocolors": "^1.1.1",
@@ -53,7 +53,7 @@ function Install-Pinggy {
53
53
  $npmPackage = 'pinggy'
54
54
  # The file a running daemon writes. Its path lives in src/utils/configDir.ts.
55
55
  $daemonInfoPath = Join-Path $env:APPDATA 'pinggy\daemon.json'
56
- # The task `pinggy daemon service-install` registers. Its name lives in src/daemon/lifecycle/serviceInstaller.ts.
56
+ # The task `pinggy autostart on` registers. Its name lives in src/daemon/lifecycle/serviceInstaller.ts.
57
57
  $loginTaskName = 'PinggyDaemon'
58
58
  $cpuArchitectureX64 = 9
59
59
  $cpuArchitectureArm64 = 12
@@ -390,8 +390,8 @@ function Install-Pinggy {
390
390
  }
391
391
 
392
392
  # The task counts only when it runs the binary this script installs. A task left by a pinggy elsewhere gets the
393
- # question, and service-install replaces it. Get-ScheduledTask, because schtasks prints field names in the
394
- # language of Windows.
393
+ # question, and `pinggy autostart on` replaces it. Get-ScheduledTask, because schtasks prints field names
394
+ # in the language of Windows.
395
395
  function Test-LoginTask {
396
396
  try {
397
397
  $task = Get-ScheduledTask -TaskName $loginTaskName -ErrorAction Stop
@@ -402,22 +402,23 @@ function Install-Pinggy {
402
402
  }
403
403
 
404
404
  # Asks once the device connects, so the agent starts again after a restart. Leaves a registered task as it is.
405
- # `pinggy daemon service-install` runs only from this script's binary, so another copy skips the question.
405
+ # `pinggy autostart on` writes the task only from this script's binary, so another copy skips the
406
+ # question. After `device login -b` the agent is saved, so `on` asks nothing more.
406
407
  function Invoke-LoginServiceOffer {
407
408
  if ($skipLoginService) { return }
408
409
  if (Test-LoginTask) { return }
409
410
  if (-not (Test-Interactive)) {
410
- Write-Host 'To start pinggy when this computer starts, run: pinggy daemon service-install'
411
+ Write-Host 'To start pinggy when this computer starts, run: pinggy autostart on'
411
412
  return
412
413
  }
413
414
  Write-Host ''
414
415
  if (-not (Confirm-Question 'Start pinggy automatically when this computer starts? [Y/n]')) {
415
- Write-Host 'To start pinggy when this computer starts, run: pinggy daemon service-install'
416
+ Write-Host 'To start pinggy when this computer starts, run: pinggy autostart on'
416
417
  return
417
418
  }
418
- & $installPath daemon service-install
419
+ & $installPath autostart on
419
420
  if ($LASTEXITCODE -ne 0) {
420
- Write-Host 'Could not set up the login service. To try again, run: pinggy daemon service-install'
421
+ Write-Host 'Could not turn on autostart. To try again, run: pinggy autostart on'
421
422
  }
422
423
  }
423
424
 
@@ -519,8 +520,9 @@ function Install-Pinggy {
519
520
  }
520
521
 
521
522
  # Runs $pinggyPath by its full path, with -b, as Invoke-DeviceLogin does. connect reads DEVICE_AGENT_TOKEN
522
- # from the environment it inherits, and reads no key, so it runs the same with no console. The token leaves the
523
- # environment before the service question, so no later command inherits it.
523
+ # from the environment it inherits. It reads the console for 1 question, whether the dashboard may reach this
524
+ # machine's files. With no console it asks nothing and leaves file access on. The token leaves the environment
525
+ # before the service question, so no later command inherits it.
524
526
  function Invoke-DeviceConnect {
525
527
  $connectArguments = @('device', 'connect', '-b')
526
528
  if ($env:PINGGY_MANAGE) { $connectArguments += @('--manage', $env:PINGGY_MANAGE) }
@@ -20,7 +20,8 @@
20
20
  # Setting, from the dashboard's command:
21
21
  # DEVICE_AGENT_TOKEN a device token. `pinggy device connect` runs with no email and no code. Every update question
22
22
  # is still asked, and a pinggy older than 0.6.2 ignores the token. The token reaches the CLI in
23
- # its environment, never on a command line. Set it on sh, not on curl, so curl never holds it
23
+ # its environment, never on a command line. Set it on sh, not on curl, so curl never holds it.
24
+ # In a terminal, connect asks whether the dashboard may reach this machine's files
24
25
  #
25
26
  # Overrides, for dev and tests:
26
27
  # PINGGY_VERSION a release tag, such as v0.6.1. Default: the version pinggy.io publishes, or for an npm copy the
@@ -650,9 +651,9 @@ add_link_dir_to_rc_file() {
650
651
  say "In this terminal, run: source $(shown "$rc_file")"
651
652
  }
652
653
 
653
- # The service file `pinggy daemon service-install` writes. Its paths live in src/daemon/lifecycle/serviceInstaller.ts.
654
+ # The boot entry `pinggy autostart on` writes. Its paths live in src/daemon/lifecycle/serviceInstaller.ts.
654
655
  # The service counts only when it runs the binary this script installs. A service left by a pinggy elsewhere gets the
655
- # question, and service-install replaces it.
656
+ # question, and `pinggy autostart on` replaces it.
656
657
  login_service_installed() {
657
658
  case "$os" in
658
659
  macos) service_file="$HOME/Library/LaunchAgents/$LAUNCHD_LABEL.plist" ;;
@@ -670,7 +671,8 @@ login_service_supported() {
670
671
  }
671
672
 
672
673
  # Asks once the device connects, so the agent starts again after a restart. Leaves an installed service as it is.
673
- # `pinggy daemon service-install` runs only from this script's binary, so another copy skips the question.
674
+ # `pinggy autostart on` writes the boot entry only from this script's binary, so another copy skips the
675
+ # question. After `device login -b` the agent is saved, so `on` asks nothing more with no terminal.
674
676
  offer_login_service() {
675
677
  if [ "${skip_login_service:-0}" = 1 ]; then
676
678
  return 0
@@ -679,17 +681,17 @@ offer_login_service() {
679
681
  return 0
680
682
  fi
681
683
  if ! has_terminal; then
682
- say "To start pinggy when this computer starts, run: pinggy daemon service-install"
684
+ say "To start pinggy when this computer starts, run: pinggy autostart on"
683
685
  return 0
684
686
  fi
685
687
 
686
688
  say ""
687
689
  if ! confirm "Start pinggy automatically when this computer starts? [Y/n] "; then
688
- say "To start pinggy when this computer starts, run: pinggy daemon service-install"
690
+ say "To start pinggy when this computer starts, run: pinggy autostart on"
689
691
  return 0
690
692
  fi
691
- if ! "$INSTALL_PATH" daemon service-install </dev/null; then
692
- say "Could not set up the login service. To try again, run: pinggy daemon service-install"
693
+ if ! "$INSTALL_PATH" autostart on </dev/null; then
694
+ say "Could not turn on autostart. To try again, run: pinggy autostart on"
693
695
  fi
694
696
  }
695
697
 
@@ -836,18 +838,23 @@ offer_daemon_restart() {
836
838
  }
837
839
 
838
840
  # Runs $pinggy_path, the copy this script installed, updated or kept, by its full path, so another pinggy earlier on
839
- # PATH does not answer. connect reads DEVICE_AGENT_TOKEN from the environment this script passes on, and reads no
840
- # key, so it runs the same with no terminal. -b is the default now. It is passed anyway, so an older pinggy the user
841
- # kept runs the agent in its daemon too. The token leaves the environment before the service question, so no later
842
- # command inherits it.
841
+ # PATH does not answer. connect reads DEVICE_AGENT_TOKEN from the environment this script passes on. It asks 1
842
+ # question, whether the dashboard may reach this machine's files, so it reads /dev/tty when there is one. With none it
843
+ # reads /dev/null, asks nothing, and leaves file access on. Never this script's stdin, which under `curl | sh` holds
844
+ # the rest of the script. -b is the default now. It is passed anyway, so an older pinggy the user kept runs the agent
845
+ # in its daemon too. The token leaves the environment before the service question, so no later command inherits it.
843
846
  connect_with_device_token() {
844
847
  export DEVICE_AGENT_TOKEN
845
848
  say ""
849
+ connect_input=/dev/null
850
+ if has_terminal; then
851
+ connect_input=/dev/tty
852
+ fi
846
853
  status=0
847
854
  if [ -n "${PINGGY_MANAGE:-}" ]; then
848
- "$pinggy_path" device connect -b --manage "$PINGGY_MANAGE" </dev/null || status=$?
855
+ "$pinggy_path" device connect -b --manage "$PINGGY_MANAGE" <"$connect_input" || status=$?
849
856
  else
850
- "$pinggy_path" device connect -b </dev/null || status=$?
857
+ "$pinggy_path" device connect -b <"$connect_input" || status=$?
851
858
  fi
852
859
  unset DEVICE_AGENT_TOKEN
853
860
  if [ "$status" -ne 0 ]; then