Skip to content

Commit 70cf446

Browse files
authored
Merge pull request #165 from synonymdev/chore/ln-invoice-link-page
chore: add lightning link page
2 parents 889bb63 + f199289 commit 70cf446

4 files changed

Lines changed: 151 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Lightning invoice link test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- tools/ln-invoice-link/**
9+
- .github/workflows/deploy-ln-invoice-link.yml
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: false
20+
21+
jobs:
22+
deploy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Pages
29+
uses: actions/configure-pages@v5
30+
31+
- name: Upload artifact
32+
uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: tools/ln-invoice-link
35+
36+
- name: Deploy to GitHub Pages
37+
id: deployment
38+
uses: actions/deploy-pages@v4

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ docker/ # docker compose regtest based backend for Bitkit wallet
4040
test/
4141
├── specs/ # Test suites (e.g., onboarding.e2e.ts)
4242
├── helpers/ # Test helpers: selectors, setup, actions
43+
tools/ # QA utilities and small manual test tools
4344
```
4445

4546
> ℹ️ Screenshots and (optionally) videos of **failed tests** will be saved to `artifacts/`. To enable video recording, set the `RECORD_VIDEO=true` environment variable.

tools/ln-invoice-link/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Lightning invoice link test
2+
3+
Static Safari test page for opening BOLT11 invoices through the `lightning:` URL scheme.
4+
5+
## Usage
6+
7+
1. Open the published GitHub Pages URL.
8+
2. Paste a BOLT11 invoice.
9+
3. Tap **Open lightning link** in Safari.
10+
11+
The page accepts raw invoices such as `lnbcrt...`, `lntb...`, or `lnbc...`. It also accepts values already prefixed with `lightning:`.
12+
13+
## Local preview
14+
15+
```bash
16+
cd tools/ln-invoice-link
17+
python3 -m http.server 8080
18+
```
19+
20+
Open `http://localhost:8080` on the simulator, or `http://<mac-lan-ip>:8080` on a physical iPhone connected to the same network.

tools/ln-invoice-link/index.html

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Bitkit Lightning Link Test</title>
7+
<style>
8+
:root {
9+
color-scheme: light dark;
10+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
11+
line-height: 1.4;
12+
}
13+
14+
body {
15+
box-sizing: border-box;
16+
margin: 0 auto;
17+
max-width: 720px;
18+
padding: 24px;
19+
}
20+
21+
textarea {
22+
box-sizing: border-box;
23+
width: 100%;
24+
min-height: 160px;
25+
padding: 12px;
26+
border-radius: 10px;
27+
font: 14px ui-monospace, SFMono-Regular, Menlo, monospace;
28+
}
29+
30+
a {
31+
display: inline-block;
32+
margin-top: 16px;
33+
padding: 12px 16px;
34+
border-radius: 999px;
35+
background: #0a84ff;
36+
color: #fff;
37+
font: inherit;
38+
font-weight: 600;
39+
text-decoration: none;
40+
}
41+
42+
code {
43+
word-break: break-all;
44+
}
45+
46+
.muted {
47+
color: #666;
48+
}
49+
</style>
50+
</head>
51+
<body>
52+
<h1>Bitkit Lightning Link Test</h1>
53+
<p>Paste a BOLT11 invoice below, then open the generated link in Safari.</p>
54+
55+
<label for="invoice">Invoice</label>
56+
<textarea id="invoice" spellcheck="false" placeholder="lnbcrt..., lntb..., or lnbc..."></textarea>
57+
58+
<p>
59+
<a id="pay-link" href="#">Open lightning link</a>
60+
</p>
61+
62+
<p class="muted">Generated URL:</p>
63+
<code id="generated">Paste an invoice first.</code>
64+
65+
<script>
66+
const invoiceInput = document.getElementById("invoice");
67+
const payLink = document.getElementById("pay-link");
68+
const generated = document.getElementById("generated");
69+
70+
function normalizeInvoice(value) {
71+
return value.trim().replace(/^lightning:/i, "");
72+
}
73+
74+
function updateLink() {
75+
const invoice = normalizeInvoice(invoiceInput.value);
76+
77+
if (!invoice) {
78+
payLink.href = "#";
79+
generated.textContent = "Paste an invoice first.";
80+
return;
81+
}
82+
83+
const url = `lightning:${invoice}`;
84+
payLink.href = url;
85+
generated.textContent = url;
86+
}
87+
88+
invoiceInput.addEventListener("input", updateLink);
89+
updateLink();
90+
</script>
91+
</body>
92+
</html>

0 commit comments

Comments
 (0)