From 71a6d9028391161bf5fda59eb06f954d4cbac5e9 Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Wed, 21 Apr 2021 16:00:11 +0100 Subject: [PATCH] Changed permission for deleting, --- lnbits/extensions/copilot/templates/copilot/_api_docs.html | 5 ++++- lnbits/extensions/copilot/views_api.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lnbits/extensions/copilot/templates/copilot/_api_docs.html b/lnbits/extensions/copilot/templates/copilot/_api_docs.html index 048458195..d6289be9c 100644 --- a/lnbits/extensions/copilot/templates/copilot/_api_docs.html +++ b/lnbits/extensions/copilot/templates/copilot/_api_docs.html @@ -155,12 +155,15 @@ >GET /api/v1/copilot/ws/<copilot_id>/<comment>/<data> +
Headers
+ {"X-Api-Key": <admin_key>}
Returns 200
Curl example
curl -X GET {{ request.url_root }}/api/v1/copilot/ws/<string, - copilot_id>/<string, comment>/<string, gif name> + copilot_id>/<string, comment>/<string, gif name> -H + "X-Api-Key: {{ g.user.wallets[0].adminkey }}" diff --git a/lnbits/extensions/copilot/views_api.py b/lnbits/extensions/copilot/views_api.py index 2089831da..c5c2fdb91 100644 --- a/lnbits/extensions/copilot/views_api.py +++ b/lnbits/extensions/copilot/views_api.py @@ -82,7 +82,7 @@ async def api_copilot_retrieve(copilot_id): @copilot_ext.route("/api/v1/copilot/", methods=["DELETE"]) -@api_check_wallet_key("invoice") +@api_check_wallet_key("admin") async def api_copilot_delete(copilot_id): copilot = await get_copilot(copilot_id) @@ -95,11 +95,11 @@ async def api_copilot_delete(copilot_id): @copilot_ext.route("/api/v1/copilot/ws///", methods=["GET"]) +@api_check_wallet_key("admin") async def api_copilot_ws_relay(copilot_id, comment, data): copilot = await get_copilot(copilot_id) if not copilot: return jsonify({"message": "copilot does not exist"}), HTTPStatus.NOT_FOUND await updater(data, comment, copilot_id) - print(comment) return "", HTTPStatus.OK