From fb7dfb3a32d22997908d71ce5ac8324c7e1f62a7 Mon Sep 17 00:00:00 2001 From: Eneko Illarramendi Date: Sun, 5 Apr 2020 12:19:25 +0200 Subject: [PATCH] chore: minor fixes --- lnbits/core/crud.py | 2 +- lnbits/core/templates/core/_api_docs.html | 51 +++++ lnbits/core/templates/core/wallet.html | 61 +---- lnbits/static/css/base.css | 24 +- lnbits/static/js/base.js | 8 +- lnbits/static/scss/base.scss | 18 +- lnbits/templates/wallet.html | 265 ---------------------- 7 files changed, 93 insertions(+), 336 deletions(-) create mode 100644 lnbits/core/templates/core/_api_docs.html delete mode 100644 lnbits/templates/wallet.html diff --git a/lnbits/core/crud.py b/lnbits/core/crud.py index 2331a48b..1bd8ad3b 100644 --- a/lnbits/core/crud.py +++ b/lnbits/core/crud.py @@ -1,8 +1,8 @@ from uuid import uuid4 +from typing import List, Optional from lnbits.db import open_db from lnbits.settings import DEFAULT_WALLET_NAME, FEE_RESERVE -from typing import List, Optional from .models import User, Wallet, Payment diff --git a/lnbits/core/templates/core/_api_docs.html b/lnbits/core/templates/core/_api_docs.html new file mode 100644 index 00000000..746d2e1b --- /dev/null +++ b/lnbits/core/templates/core/_api_docs.html @@ -0,0 +1,51 @@ + + + + + POST /api/v1/payments +
Headers
+ {"Grpc-Metadata-macaroon": "{{ wallet.inkey }}"}
+
Body (application/json)
+ {"out": false, "amount": <int>, "memo": <string>} +
Returns 201 CREATED (application/json)
+ {"checking_id": <string>, "payment_request": <string>} +
Curl example
+ curl -X POST http://127.0.0.1:5000/api/v1/payments -d '{"out": false, "amount": <int>, "memo": <string>}' -H "Grpc-Metadata-macaroon: {{ wallet.inkey }}" -H "Content-type: application/json" +
+
+
+ + + + POST /api/v1/payments +
Headers
+ {"Grpc-Metadata-macaroon": "{{ wallet.adminkey }}"} +
Body (application/json)
+ {"out": true, "bolt11": <string>} +
Returns 201 CREATED (application/json)
+ {"checking_id": <string>} +
Curl example
+ curl -X POST http://127.0.0.1:5000/api/v1/payments -d '{"out": true, "bolt11": <string>}' -H "Grpc-Metadata-macaroon: {{ wallet.adminkey }}" -H "Content-type: application/json" +
+
+
+ + + + GET /api/v1/payments/<checking_id> +
Headers
+ {"Grpc-Metadata-macaroon": "{{ wallet.inkey }}"} +
Returns 200 OK (application/json)
+ {"paid": <bool>} +
Curl example
+ curl -X GET http://127.0.0.1:5000/api/v1/payments/<checking_id> -H "Grpc-Metadata-macaroon: {{ wallet.inkey }}" -H "Content-type: application/json" +
+
+
+
diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html index 69304029..75f8f4d8 100644 --- a/lnbits/core/templates/core/wallet.html +++ b/lnbits/core/templates/core/wallet.html @@ -108,6 +108,7 @@
+
LNbits wallet
Wallet name: {{ wallet.name }}
Wallet ID: {{ wallet.id }}
Admin key: {{ wallet.adminkey }}
@@ -116,57 +117,7 @@ - - - - - POST /api/v1/payments -
Headers
- {"Grpc-Metadata-macaroon": "{{ wallet.inkey }}"}
-
Body (application/json)
- {"out": false, "amount": <int>, "memo": <string>} -
Returns 201 CREATED (application/json)
- {"checking_id": <string>, "payment_request": <string>} -
Curl example
- curl -X POST http://127.0.0.1:5000/api/v1/payments -d '{"out": false, "amount": <int>, "memo": <string>}' -H "Grpc-Metadata-macaroon: {{ wallet.inkey }}" -H "Content-type: application/json" -
-
-
- - - - POST /api/v1/payments -
Headers
- {"Grpc-Metadata-macaroon": "{{ wallet.adminkey }}"} -
Body (application/json)
- {"out": true, "bolt11": <string>} -
Returns 201 CREATED (application/json)
- {"checking_id": <string>} -
Curl example
- curl -X POST http://127.0.0.1:5000/api/v1/payments -d '{"out": true, "bolt11": <string>}' -H "Grpc-Metadata-macaroon: {{ wallet.adminkey }}" -H "Content-type: application/json" -
-
-
- - - - GET /api/v1/payments/<checking_id> -
Headers
- {"Grpc-Metadata-macaroon": "{{ wallet.inkey }}"} -
Returns 200 OK (application/json)
- {"paid": <bool>} -
Curl example
- curl -X GET http://127.0.0.1:5000/api/v1/payments/<checking_id> -H "Grpc-Metadata-macaroon: {{ wallet.inkey }}" -H "Content-type: application/json" -
-
-
-
+ {% include "core/_api_docs.html" %} - +
@@ -226,11 +177,11 @@ - +
diff --git a/lnbits/static/css/base.css b/lnbits/static/css/base.css index e1513e43..3fe859bf 100644 --- a/lnbits/static/css/base.css +++ b/lnbits/static/css/base.css @@ -20,17 +20,21 @@ body.body--dark .q-field--error .q-field__messages { color: yellow !important; } -.lnbits__q-table__icon-td { - padding-left: 5px !important; } +.lnbits-drawer__q-list .q-item { + padding-top: 5px !important; + padding-bottom: 5px !important; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; } + .lnbits-drawer__q-list .q-item.q-item--active { + color: inherit; + font-weight: bold; } - .lnbits-drawer__q-list .q-item { - padding-top: 5px !important; - padding-bottom: 5px !important; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; } - .lnbits-drawer__q-list .q-item.q-item--active { - color: inherit; - font-weight: bold; } +.q-table--dense th:first-child, .q-table--dense td:first-child, +.q-table--dense .q-table__bottom { + padding-left: 6px !important; } + .q-table--dense th:last-child, .q-table--dense td:last-child, + .q-table--dense .q-table__bottom { + padding-right: 6px !important; } video { border-radius: 3px; } diff --git a/lnbits/static/js/base.js b/lnbits/static/js/base.js index 55d8c267..2dca1eb5 100644 --- a/lnbits/static/js/base.js +++ b/lnbits/static/js/base.js @@ -57,6 +57,12 @@ var LNbits = { }).sort(function (a, b) { return a.name.localeCompare(b.name); }); + obj.walletOptions = obj.wallets.map(function (obj) { + return { + label: [obj.name, ' (', obj.id , ')'].join(''), + value: obj.id + }; + }); return obj; }, wallet: function (data) { @@ -158,7 +164,7 @@ var windowMixin = { copyText: function (text, message) { var notify = this.$q.notify; Quasar.utils.copyToClipboard(text).then(function () { - notify({message: 'Copied to clipboard!'}); + notify({message: message || 'Copied to clipboard!'}); }); } }, diff --git a/lnbits/static/scss/base.scss b/lnbits/static/scss/base.scss index dd800b1c..c5035c7c 100644 --- a/lnbits/static/scss/base.scss +++ b/lnbits/static/scss/base.scss @@ -36,10 +36,6 @@ body.body--dark .q-field--error { } } -.lnbits__q-table__icon-td { - padding-left: 5px !important; -} - .lnbits-drawer__q-list .q-item { padding-top: 5px !important; padding-bottom: 5px !important; @@ -52,6 +48,20 @@ body.body--dark .q-field--error { } } +.q-table--dense { + th:first-child, + td:first-child, + .q-table__bottom { + padding-left: 6px !important; + } + + th:last-child, + td:last-child, + .q-table__bottom { + padding-right: 6px !important; + } +} + // QR video video { diff --git a/lnbits/templates/wallet.html b/lnbits/templates/wallet.html deleted file mode 100644 index 000b42bc..00000000 --- a/lnbits/templates/wallet.html +++ /dev/null @@ -1,265 +0,0 @@ - - -{% extends "legacy.html" %} {% block messages %} - - - ! - - -{% endblock %} - - -{% block menuitems %} -
  • - - Wallets - - - -
  • -
  • - - Extensions - - -
      - {% for extension in EXTENSIONS %} - {% if extension.code in user_ext %} -
    • - {{ extension.name }} -
    • - {% endif %} - {% endfor %} -
    • - Manager
    • -
    -
  • -{% endblock %} - -{% block body %} - -
    - -
    -

    - Wallet - Control panel -
    -

    - -

    -
    -
    -
    -

    - Wallet in BETA, use with caution. -

    -
    -
    -
    - - -
    - -
    -
    - -
    -
    -

    -

    {{ wallet.name }}

    -
    -
    - -
    -
    -
    -
    - - - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Transactions (Export to CSV)

    -
    - -
    - - - - - - - -
    Memodateamount
    -
    - -
    - -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - -
    - - -
    - -
    - - -
    -
    -
    - -
    - -
    -
    - - -
    - - -
    -{% endblock %}