lndconnect: update to Zeus 0.7.1

- Generate lndconnect URLs with protocol `c-lightning-rest` for clightning.
  (Zeus now auto-detects the lightning implementation by the URL protocol.)
- Use improved QR code format (via qrencode)  .
This commit is contained in:
Erik Arvstedt 2023-01-22 21:42:05 +01:00 committed by Greg Shuflin
parent 64304b6d66
commit 05310fc02b
2 changed files with 39 additions and 13 deletions

View File

@ -143,7 +143,7 @@ The default password location is `$secretsDir/rtl-password`.
See: [Secrets dir](./configuration.md#secrets-dir) See: [Secrets dir](./configuration.md#secrets-dir)
# Use Zeus (mobile lightning wallet) via Tor # Use Zeus (mobile lightning wallet) via Tor
1. Install [Zeus](https://zeusln.app) 1. Install [Zeus](https://zeusln.app) (version ≥ 0.7.1)
2. Edit your `configuration.nix` 2. Edit your `configuration.nix`
@ -186,19 +186,16 @@ See: [Secrets dir](./configuration.md#secrets-dir)
``` ```
5. Configure Zeus 5. Configure Zeus
- Add a new node - Add a new node and scan the QR code
- Select `Scan lndconnect config` (at the bottom) and scan the QR code
- For clightning: Set `Node interface` to `c-lightning-REST`
- Click `Save node config` - Click `Save node config`
- Start sending and stacking sats privately - Start sending and stacking sats privately
### Additional lndconnect features ### Additional lndconnect features
- Create plain text URLs or QR code images - Create a plain text URL:
```bash ```bash
lndconnect --url lndconnect --url
lndconnect --image
``` ```
- Set a custom host. By default, `lndconnect` detects the system's external IP and uses it as the host. - Set a custom host. By default, `lndconnect` detects the system's external IP and uses it as the host.
```bash ```bash
lndconnect --host myhost lndconnect --host myhost
``` ```

View File

@ -82,6 +82,7 @@ let
mkLndconnect = { mkLndconnect = {
name, name,
shebang ? "#!${pkgs.stdenv.shell} -e", shebang ? "#!${pkgs.stdenv.shell} -e",
isClightning ? false,
port, port,
macaroonPath, macaroonPath,
enableOnion, enableOnion,
@ -93,12 +94,39 @@ let
# https://github.com/LN-Zap/lndconnect/issues/25 # https://github.com/LN-Zap/lndconnect/issues/25
pkgs.hiPrio (pkgs.writeScriptBin name '' pkgs.hiPrio (pkgs.writeScriptBin name ''
${shebang} ${shebang}
exec ${config.nix-bitcoin.pkgs.lndconnect}/bin/lndconnect \ url=$(
${optionalString enableOnion "--host=$(cat ${config.nix-bitcoin.onionAddresses.dataDir}/${onionService})"} \ ${getExe config.nix-bitcoin.pkgs.lndconnect} --url \
--port=${toString port} \ ${optionalString enableOnion "--host=$(cat ${config.nix-bitcoin.onionAddresses.dataDir}/${onionService})"} \
${if enableOnion || certPath == null then "--nocert" else "--tlscertpath='${certPath}'"} \ --port=${toString port} \
--adminmacaroonpath='${macaroonPath}' \ ${if enableOnion || certPath == null then "--nocert" else "--tlscertpath='${certPath}'"} \
--configfile=/dev/null "$@" --adminmacaroonpath='${macaroonPath}' \
--configfile=/dev/null "$@"
)
${optionalString isClightning
# - Change URL procotcol to c-lightning-rest
# - Encode macaroon as hex (in uppercase) instead of base 64.
# Because `macaroon` is always the last URL fragment, the
# sed replacement below works correctly.
''
macaroonHex=$(${getExe pkgs.xxd} -p -u -c 99999 '${macaroonPath}')
url=$(
echo "$url" | ${getExe pkgs.gnused} "
s|^lndconnect|c-lightning-rest|
s|macaroon=.*|macaroon=$macaroonHex|
";
)
''
}
# If --url is in args
if [[ " $* " =~ " --url " ]]; then
echo "$url"
else
# This UTF-8 encoding yields a smaller, more convenient output format
# compared to the native lndconnect output
echo -n "$url" | ${getExe pkgs.qrencode} -t UTF8 -o -
fi
''); '');
operatorName = config.nix-bitcoin.operator.name; operatorName = config.nix-bitcoin.operator.name;
@ -144,6 +172,7 @@ in {
environment.systemPackages = [( environment.systemPackages = [(
mkLndconnect { mkLndconnect {
name = "lndconnect-clightning"; name = "lndconnect-clightning";
isClightning = true;
enableOnion = clightning-rest.lndconnect.onion; enableOnion = clightning-rest.lndconnect.onion;
onionService = "${operatorName}/clightning-rest"; onionService = "${operatorName}/clightning-rest";
port = clightning-rest.port; port = clightning-rest.port;