From e9109b0b4952ca22513e7c6866d135ef233d87e2 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Fri, 25 Nov 2022 14:24:17 +0000 Subject: [PATCH] make format --- .../templates/diagonalley/index.html | 36 +++-- .../templates/diagonalley/order.html | 127 ++++++++++-------- lnbits/extensions/diagonalley/views.py | 9 +- 3 files changed, 96 insertions(+), 76 deletions(-) diff --git a/lnbits/extensions/diagonalley/templates/diagonalley/index.html b/lnbits/extensions/diagonalley/templates/diagonalley/index.html index 199a84e7..0e257d12 100644 --- a/lnbits/extensions/diagonalley/templates/diagonalley/index.html +++ b/lnbits/extensions/diagonalley/templates/diagonalley/index.html @@ -859,7 +859,11 @@ >
{% raw %} - + {{ keys[type] }} -

{{ type == 'pubkey' ? 'Public Key' : 'Private Key' }}
Click to copy

+

+ {{ type == 'pubkey' ? 'Public Key' : 'Private Key' }}
Click to copy +

{% endraw %}
@@ -1412,18 +1420,18 @@ }, exportKeysCSV: function () { let colls = [ - { - name: 'privatekey', - align: 'left', - label: 'Private Key', - field: 'privkey' - }, - { - name: 'publickey', - align: 'left', - label: 'Public Key', - field: 'pubkey' - }, + { + name: 'privatekey', + align: 'left', + label: 'Private Key', + field: 'privkey' + }, + { + name: 'publickey', + align: 'left', + label: 'Public Key', + field: 'pubkey' + } ] LNbits.utils.exportCSV(colls, [this.keys]) }, diff --git a/lnbits/extensions/diagonalley/templates/diagonalley/order.html b/lnbits/extensions/diagonalley/templates/diagonalley/order.html index a9f74a5d..62fb642a 100644 --- a/lnbits/extensions/diagonalley/templates/diagonalley/order.html +++ b/lnbits/extensions/diagonalley/templates/diagonalley/order.html @@ -102,10 +102,7 @@ -

Bellow are the keys needed to contact the merchant. They are stored in the browser! @@ -118,7 +115,11 @@ >

{% raw %} - +
-
- Backup keys - Download your keys - - Restore keys - Restore keys - - Delete data - Delete all data from browser - -
-
-
- -

- Export, or send, this page to another device -

-
- - - Click to copy - -
+ Backup keys + Download your keys + Restore keys + Restore keys + + Copy URL - Export, or send, this page to another device + >Delete data + Delete all data from browser
+ + +

Export, or send, this page to another device

+
+ + + Click to copy + +
+
+ Copy URL + Export, or send, this page to another device + +
+
@@ -268,8 +270,11 @@ } }, computed: { - exportURL(){ - return '{{request.url}}' + `&keys=${this.user.keys.publickey},${this.user.keys.privatekey}` + exportURL() { + return ( + '{{request.url}}' + + `&keys=${this.user.keys.publickey},${this.user.keys.privatekey}` + ) } }, methods: { @@ -333,8 +338,9 @@ }, async generateKeys(payment_hash) { //check if the keys are set - if("publickey" in this.user.keys && "privatekey" in this.user.keys) return - + if ('publickey' in this.user.keys && 'privatekey' in this.user.keys) + return + return await LNbits.api .request('GET', `/diagonalley/api/v1/keys/${payment_hash}`, null) .then(response => { @@ -417,15 +423,18 @@ let order_details = JSON.parse('{{ order | tojson }}') let products = JSON.parse('{{ products | tojson }}') let order_id = '{{ order_id }}' - let hasKeys = Boolean(JSON.parse('{{ publickey | tojson }}') && JSON.parse('{{ privatekey | tojson }}')) + let hasKeys = Boolean( + JSON.parse('{{ publickey | tojson }}') && + JSON.parse('{{ privatekey | tojson }}') + ) - if(hasKeys) { + if (hasKeys) { this.user.keys = { privatekey: '{{ privatekey }}', publickey: '{{ publickey }}' } } - + this.stall = JSON.parse('{{ stall | tojson }}') this.products = order_details.map(o => { let product = products.find(p => p.id == o.product_id) diff --git a/lnbits/extensions/diagonalley/views.py b/lnbits/extensions/diagonalley/views.py index 63a6c18c..b87d1918 100644 --- a/lnbits/extensions/diagonalley/views.py +++ b/lnbits/extensions/diagonalley/views.py @@ -95,7 +95,10 @@ async def display(request: Request, market_id): @diagonalley_ext.get("/order", response_class=HTMLResponse) async def chat_page( - request: Request, merch: str = Query(...), invoice_id: str = Query(...), keys: str = Query(None) + request: Request, + merch: str = Query(...), + invoice_id: str = Query(...), + keys: str = Query(None), ): stall = await get_diagonalley_stall(merch) order = await get_diagonalley_order_invoiceid(invoice_id) @@ -112,8 +115,8 @@ async def chat_page( "publickey": stall.publickey, "wallet": stall.wallet, }, - "publickey": keys.split(',')[0] if keys else None, - "privatekey": keys.split(',')[1] if keys else None, + "publickey": keys.split(",")[0] if keys else None, + "privatekey": keys.split(",")[1] if keys else None, "order_id": order.invoiceid, "order": [details.dict() for details in _order], "products": [product.dict() for product in products],