Skip to content

Conversation

@PatMulligan
Copy link
Contributor

@PatMulligan PatMulligan commented Dec 26, 2025

Summary

  • Fix display page and QR code dialog to use server-generated LNURL URLs
  • Add lnurl_url field to API responses for proper unique voucher support
  • Restores correct URL generation for unique voucher withdraw links

Fixes #64

Problem

Commit 10a4caf (feat: add lud17 support) introduced a regression where both the display page and the index page QR code dialog construct LNURL URLs client-side using only the unique_hash.

For unique voucher links (is_unique=True), the URL must include both unique_hash AND id_unique_hash in the path:

  • ❌ Broken: /api/v1/lnurl/{unique_hash}
  • ✅ Correct: /api/v1/lnurl/{unique_hash}/{id_unique_hash}

This caused unique voucher links (created via "Quick vouchers" or with the unique checkbox enabled) to return:

{"status":"ERROR","reason":"This link requires an id_unique_hash."}

Solution

  • views.py: Generate LNURL server-side for display page using create_lnurl()
  • views_api.py: Add lnurl_url field to all API responses
  • models.py: Add lnurl_url field to WithdrawLink model
  • index.js: Use lnurl_url from API instead of client-side URL construction
  • display.html: Use server-provided lnurl_url

The create_lnurl() helper already handled unique links correctly - the fix ensures all UI code paths use it.

Test plan

  • Create a regular (non-unique) withdraw link and verify both the display page and QR dialog show working LNURLs
  • Create a unique voucher via "Quick vouchers" and verify the QR code works
  • Create a unique voucher via "Advanced" with the unique checkbox and verify the QR code works
  • Verify QR codes can be scanned and redeemed in a LNURL-compatible wallet

🤖 Generated with https://claude.ai/claude-code

The lud17 support commit (10a4caf) broke unique voucher withdraw links
by constructing the LNURL URL client-side using only the unique_hash.

For unique vouchers (is_unique=True), the URL must include both
unique_hash AND id_unique_hash in the path. The create_lnurl() helper
already handles this correctly, but the display page and QR code dialog
were bypassing it.

Changes:
- views.py: Generate LNURL server-side for display page
- views_api.py: Add lnurl_url field to API responses
- models.py: Add lnurl_url field to WithdrawLink model
- index.js: Use lnurl_url from API instead of client-side construction
- display.html: Use server-provided URL

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@PatMulligan PatMulligan force-pushed the fix/unique-voucher-lnurl-display branch from 847baf2 to ac5f06b Compare December 26, 2025 11:20
@PatMulligan PatMulligan marked this pull request as ready for review December 26, 2025 11:43
@dni dni merged commit 8a20df7 into lnbits:main Dec 27, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: "This link requires an id_unique_hash" with v1.3.0rc8

2 participants