mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-27 07:59:30 +01:00
instead of multiple keys/macaroons with different permissions we request only one. if someone wants to use lnbits with an invoice macaroon they're free to do it and we will just fail on 'pay' methods, as before. this also grandfathers the previous environment variables names so everything keeps working without people having to change their setups. in the meantime some bugs with lntxbot and c-lightning were fixed and the `requests` dependency was eliminated because I can't organize myself into meaningful chunks of changes.
40 lines
993 B
Python
40 lines
993 B
Python
# views_api.py is for you API endpoints that could be hit by another service
|
|
|
|
# add your dependencies here
|
|
|
|
# import json
|
|
# import httpx
|
|
# (use httpx just like requests, except instead of response.ok there's only the
|
|
# response.is_error that is its inverse)
|
|
|
|
from quart import jsonify
|
|
from http import HTTPStatus
|
|
|
|
from lnbits.extensions.example import example_ext
|
|
|
|
|
|
# add your endpoints here
|
|
|
|
|
|
@example_ext.route("/api/v1/tools", methods=["GET"])
|
|
async def api_example():
|
|
"""Try to add descriptions for others."""
|
|
tools = [
|
|
{
|
|
"name": "Flask",
|
|
"url": "https://flask.palletsprojects.com/",
|
|
"language": "Python",
|
|
},
|
|
{
|
|
"name": "Vue.js",
|
|
"url": "https://vuejs.org/",
|
|
"language": "JavaScript",
|
|
},
|
|
{
|
|
"name": "Quasar Framework",
|
|
"url": "https://quasar.dev/",
|
|
"language": "JavaScript",
|
|
},
|
|
]
|
|
|
|
return jsonify(tools), HTTPStatus.OK
|