Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions donations/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
## Installation

You need [uv](https://docs.astral.sh/uv/getting-started/installation/) to run this
plugin like a binary. After `uv` is installed you can simply run

```
lightning-cli plugin start /path/to/donations.py
```

For general plugin installation instructions see the repos main
[README.md](https://github.com/lightningd/plugins/blob/master/README.md#Installation)

# Invoice Service (for Donations) plugin

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

Therefor people can query for an invoice which they can use to pay. The plugin
can be started with `lightningd` by adding the following `--plugin` option
(adjusting the path to wherever the plugins are actually stored):

```
lightningd --plugin=/path/to/plugins/donations.py
```
Therefor people can query for an invoice which they can use to pay.

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

Expand Down
18 changes: 16 additions & 2 deletions donations/donations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run --script

# /// script
# requires-python = ">=3.9.2"
# dependencies = [
# "qrcode>=7.4.2",
# "flask>=2.3.3",
# "pyln-client>=24.11",
# "flask-bootstrap>=3.3.7.1",
# "flask-wtf>=1.2.1",
# "werkzeug>=3.0.6",
# "wtforms>=3.1.2",
# ]
# ///

"""A small donation service so that users can request ln invoices

This plugin spins up a small flask server that provides a form to
Expand Down Expand Up @@ -113,7 +127,7 @@ def donation_form():


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