Skip to content

Commit 7fd9e40

Browse files
committed
donations: migrate to uv shebang, remove poetry support
1 parent 58e74f4 commit 7fd9e40

File tree

5 files changed

+1555
-1538
lines changed

5 files changed

+1555
-1538
lines changed

donations/README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1+
## Installation
2+
3+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/) to run this
4+
plugin like a binary. After `uv` is installed you can simply run
5+
6+
```
7+
lightning-cli plugin start /path/to/donations.py
8+
```
9+
10+
For general plugin installation instructions see the repos main
11+
[README.md](https://github.com/lightningd/plugins/blob/master/README.md#Installation)
12+
113
# Invoice Service (for Donations) plugin
214

315
This plugin enables c-lightning nodes to start one or several small webserver
416
via the command line on specified port. The webserver is based on flask and
517
exposes the invoice API call.
618

7-
Therefor people can query for an invoice which they can use to pay. The plugin
8-
can be started with `lightningd` by adding the following `--plugin` option
9-
(adjusting the path to wherever the plugins are actually stored):
10-
11-
```
12-
lightningd --plugin=/path/to/plugins/donations.py
13-
```
19+
Therefor people can query for an invoice which they can use to pay.
1420

1521
By default the plugin will automatically start a webserver serving the donations page on port `8088`.
1622

donations/donations.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env -S uv run --script
2+
3+
# /// script
4+
# requires-python = ">=3.9.2"
5+
# dependencies = [
6+
# "qrcode>=7.4.2",
7+
# "flask>=2.3.3",
8+
# "pyln-client>=24.11",
9+
# "flask-bootstrap>=3.3.7.1",
10+
# "flask-wtf>=1.2.1",
11+
# "werkzeug>=3.0.6",
12+
# "wtforms>=3.1.2",
13+
# ]
14+
# ///
15+
216
"""A small donation service so that users can request ln invoices
317
418
This plugin spins up a small flask server that provides a form to
@@ -113,7 +127,7 @@ def donation_form():
113127

114128

115129
def worker(port):
116-
app = Flask(__name__)
130+
app = Flask("donations")
117131
# FIXME: use hexlified hsm secret or something else
118132
app.config["SECRET_KEY"] = "you-will-never-guess-this"
119133
app.add_url_rule("/donation", "donation", donation_form, methods=["GET", "POST"])

0 commit comments

Comments
 (0)