@vibelord/lanes 1.0.4 → 1.1.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.
Files changed (37) hide show
  1. package/README.md +52 -15
  2. package/bin/lanes-install.mjs +8 -2
  3. package/lib/plan.mjs +34 -1
  4. package/package.json +2 -2
  5. package/payload/lanes/README.md +39 -18
  6. package/payload/lanes/VERSION +1 -1
  7. package/payload/lanes/bin/lanes +994 -49
  8. package/payload/lanes/client/lanes-launch +160 -14
  9. package/payload/lanes/client/ssh.stanza.in +11 -2
  10. package/payload/lanes/docs/ARCHITECTURE.md +86 -2
  11. package/payload/lanes/docs/INSTALL.md +296 -43
  12. package/payload/lanes/docs/RUNBOOK.md +453 -27
  13. package/payload/lanes/docs/USERGUIDE.md +449 -76
  14. package/payload/lanes/install/enable-phone.sh +8 -20
  15. package/payload/lanes/install/enable-web.sh +2 -2
  16. package/payload/lanes/install/host-install.sh +6 -0
  17. package/payload/lanes/install.sh +888 -52
  18. package/payload/lanes/libexec/enrol.py +695 -0
  19. package/payload/lanes/libexec/enrold.py +1264 -0
  20. package/payload/lanes/libexec/keys.py +644 -0
  21. package/payload/lanes/libexec/lanes_lib.py +14 -6
  22. package/payload/lanes/libexec/members.py +297 -0
  23. package/payload/lanes/libexec/notify.py +146 -21
  24. package/payload/lanes/libexec/qr.py +217 -0
  25. package/payload/lanes/libexec/site_edit.py +237 -0
  26. package/payload/lanes/libexec/web_tokens.py +315 -0
  27. package/payload/lanes/site/README.md +13 -1
  28. package/payload/lanes/site/beyondwork/site.conf +3 -0
  29. package/payload/lanes/site/site.example.conf +5 -0
  30. package/payload/lanes/sudo/one-time-root.sh +1 -1
  31. package/payload/lanes/systemd/lanes-enrold.service +22 -0
  32. package/payload/lanes/systemd/lanes-notify.service +4 -4
  33. package/payload/lanes/systemd/lanes-web.service +4 -0
  34. package/payload/lanes/web/Caddyfile +10 -0
  35. package/payload/lanes/web/README.md +8 -2
  36. package/payload/lanes/workspaces.example/README.md +6 -1
  37. package/payload/manifest.json +7 -4
@@ -1,5 +1,7 @@
1
1
  #!/bin/sh
2
- # Key-authenticated client entry point and local server setup. Tokens stay in the caller's terminal.
2
+ # Key-authenticated client entry point for a phone or browser view; on the server a thin wrapper over
3
+ # `lanes web <device> <layout> --token`, which prepares the view, enables the loopback web services, makes Tailscale
4
+ # Serve forward https:8443 to them and shows a login token. Tokens stay in the caller's terminal.
3
5
  set -eu
4
6
  repo=$(cd "$(dirname "$0")/.." && pwd)
5
7
  host= device= local=0 named=0 layout=
@@ -12,7 +14,8 @@ while [ "$#" -gt 0 ]; do
12
14
  layout=$1 ;;
13
15
  -h|--help)
14
16
  echo 'usage: enable-phone.sh [--host SSH_ALIAS | --local] [--desktop|--mobile] [device]'
15
- echo 'Client: --host lanes uses the SSH key from ./install.sh. Server: --local.'
17
+ echo 'Client: --host lanes uses the SSH key from ./install.sh. Server: --local runs'
18
+ echo '`lanes web <device> <layout> --token` (view, web services, Tailscale Serve, login token).'
16
19
  echo 'Mobile (phone lane pickers, device phone) is the default; --desktop serves the desktop sidebar layout'
17
20
  echo '(device browser) for a laptop or tablet browser. A running view of the other layout is refused.'
18
21
  exit 0 ;;
@@ -32,21 +35,6 @@ if [ -n "$host" ]; then
32
35
  exec ssh -t -o BatchMode=yes -o PreferredAuthentications=publickey -o ForwardAgent=no "$host" \
33
36
  "exec sh \"\$HOME/.local/share/lanes/current/install/enable-phone.sh\" --local '$device'$suffix"
34
37
  fi
35
- command -v tailscale >/dev/null 2>&1 || { echo 'Install and connect Tailscale on the server first.' >&2; exit 1; }
36
- sh "$repo/install/enable-web.sh" "$device" "$layout"
37
- if ! tailscale serve --bg --https=8443 http://127.0.0.1:8083; then
38
- echo 'The server admin must allow this account to manage Tailscale Serve:' >&2
39
- printf ' sudo tailscale set --operator=%s\n' "$(id -un)" >&2
40
- echo 'Then run this command again. See docs/INSTALL.md for HTTPS setup.' >&2
41
- exit 1
42
- fi
43
- dns=$(tailscale status --json | python3 -c 'import json,sys; print(json.load(sys.stdin)["Self"]["DNSName"].rstrip("."))')
44
- [ -n "$dns" ] || { echo 'This node needs Tailscale MagicDNS and HTTPS enabled.' >&2; exit 1; }
45
- if [ -n "$suffix" ]; then where='In a browser on your laptop or tablet'; else where='On your phone'; fi
46
- printf '\n%s, connect Tailscale and open:\n\n https://%s:8443/%s\n\n' "$where" "$dns" "$device"
47
- printf 'The last line is NAME: TOKEN. Paste only TOKEN into the sign-in screen.\n'
48
- [ -n "$suffix" ] || printf 'In Safari, Share > Add to Home Screen installs the app.\n'
49
- printf '\n'
50
- # Zellij 0.45.1 requires --create-token by itself; --token-name cannot accompany it.
51
- exec "${LANES_SHARE:-$HOME/.local/share/lanes}/bin/zellij-0.45.1" \
52
- --config-dir "$repo/zellij" --config "$repo/zellij/config.kdl" web --create-token
38
+ # Exit codes are lanes web's: 0, 1 (an error line), 64 (Tailscale Serve refused, or the running lanes-web reads
39
+ # another token database: the operator step is printed).
40
+ exec "$repo/bin/lanes" web "$device" "$layout" --token
@@ -16,7 +16,7 @@ while [ "$#" -gt 0 ]; do
16
16
  esac
17
17
  shift
18
18
  done
19
- if [ "$layout" = --desktop ]; then device=${device:-browser} suffix=' --desktop'; else layout=--mobile device=${device:-phone} suffix=; fi
19
+ if [ "$layout" = --desktop ]; then device=${device:-browser}; else layout=--mobile device=${device:-phone}; fi
20
20
  case "$device" in -*|*[!A-Za-z0-9_.-]*) echo 'invalid device name' >&2; exit 2 ;; esac
21
21
  command -v caddy >/dev/null 2>&1 || { echo 'Install Caddy first (see docs/INSTALL.md).' >&2; exit 1; }
22
22
  export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}
@@ -26,4 +26,4 @@ systemctl --user daemon-reload
26
26
  systemctl --user enable --now lanes-web.service lanes-mobile.service
27
27
  systemctl --user is-active --quiet lanes-web.service lanes-mobile.service
28
28
  printf '\nWeb frontend: 127.0.0.1:8083; Zellij: 127.0.0.1:8082 (loopback only).\n'
29
- printf 'For private HTTPS and a login token, run in your terminal:\n sh "%s/install/enable-phone.sh" --local %s%s\n' "$repo" "$device" "$suffix"
29
+ printf 'For private HTTPS (Tailscale Serve) and a login token, run in your own terminal:\n lanes web %s %s --token\n' "$device" "$layout"
@@ -77,6 +77,12 @@ if [ "$start" = 1 ]; then
77
77
  systemctl --user daemon-reload
78
78
  "$repo/bin/lanes" sync
79
79
  systemctl --user enable --now lanes-statusd.service lanes-sync.timer lanes-ensure.timer lanes-gc.timer
80
+ # The enrolment service (libexec/enrold.py) runs the code of THIS install: enable, then (re)start it.
81
+ systemctl --user enable lanes-enrold.service
82
+ systemctl --user restart lanes-enrold.service
83
+ # A running web frontend reads the Caddyfile of the tree it was started from; an npm update stages a new tree,
84
+ # so a reload would keep the old routes (/enrol/ included): restart it, only when it runs. Clients reconnect.
85
+ systemctl --user try-restart lanes-mobile.service
80
86
  fi
81
87
  printf '\nServer installed from %s\n' "$repo"
82
88
  echo 'Configure boards in ~/.config/lanes/workspaces/; see workspaces.example/README.md.'