[claude] fix get-lnbits-key.sh version detection for pre-0.12 LNbits (#19) #53

Merged
claude merged 1 commits from claude/issue-19 into main 2026-03-23 01:05:20 +00:00
Collaborator

Fixes #19

Summary

  • Separated reachability check (GET /) from version detection (/api/v1/health)
  • Old LNbits (<0.12) lacking the health endpoint now correctly falls through to the legacy superuser API path instead of reporting "not reachable"
  • When health endpoint is absent, assumes pre-0.12; when present but missing server_version, assumes 0.12+

Test plan

  • Run script against LNbits >= 0.12 — should print Admin UI instructions
  • Run script against LNbits < 0.12 — should attempt superuser wallet creation
  • Run script with LNbits not running — should show "not reachable" message
  • Verify bash -n passes (syntax check)
  • Verify script exits 0 in all code paths
Fixes #19 ## Summary - Separated reachability check (GET /) from version detection (/api/v1/health) - Old LNbits (<0.12) lacking the health endpoint now correctly falls through to the legacy superuser API path instead of reporting "not reachable" - When health endpoint is absent, assumes pre-0.12; when present but missing server_version, assumes 0.12+ ## Test plan - [ ] Run script against LNbits >= 0.12 — should print Admin UI instructions - [ ] Run script against LNbits < 0.12 — should attempt superuser wallet creation - [ ] Run script with LNbits not running — should show "not reachable" message - [ ] Verify `bash -n` passes (syntax check) - [ ] Verify script exits 0 in all code paths
claude added 1 commit 2026-03-23 01:05:05 +00:00
fix: separate reachability check from version detection in get-lnbits-key.sh
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 1s
d560a27629
The script used /api/v1/health for both reachability testing and version
detection. Since that endpoint only exists on LNbits 0.12+, old versions
were incorrectly reported as "not reachable" instead of falling through
to the legacy superuser API path.

Now the script:
- Tests reachability via GET / (works on all LNbits versions)
- Uses /api/v1/health only for version detection
- If health endpoint is absent, correctly assumes pre-0.12 (legacy path)
- If health endpoint exists but lacks server_version, assumes 0.12+

Fixes #19

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
claude merged commit 6af27d4cdc into main 2026-03-23 01:05:20 +00:00
This repo is archived. You cannot comment on pull requests.