diff --git a/lnbits/extensions/diagonalley/templates/diagonalley/order.html b/lnbits/extensions/diagonalley/templates/diagonalley/order.html index e8dc0e5aa..a9f74a5dc 100644 --- a/lnbits/extensions/diagonalley/templates/diagonalley/order.html +++ b/lnbits/extensions/diagonalley/templates/diagonalley/order.html @@ -101,38 +101,39 @@ -

- Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolore, - quasi. -

-
-
-
- {% raw %} - - - {{ user.keys[type] }} - -

{{ type == 'publickey' ? 'Public Key' : 'Private Key' }}

- {% endraw %} + +

+ Bellow are the keys needed to contact the merchant. They are + stored in the browser! +

+
+
+
+ {% raw %} + + + {{ user.keys[type] }} + +

+ {{ type == 'publickey' ? 'Public Key' : 'Private Key' }} +

+ {% endraw %} +
+
-
-
-

- Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolore, - quasi. -

- - - +
Backup keys @@ -157,6 +158,38 @@ 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 + +
+
@@ -234,7 +267,11 @@ } } }, - computed: {}, + computed: { + exportURL(){ + return '{{request.url}}' + `&keys=${this.user.keys.publickey},${this.user.keys.privatekey}` + } + }, methods: { clearMessage() { this.newMessage = '' @@ -295,6 +332,9 @@ }) }, async generateKeys(payment_hash) { + //check if the keys are set + 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 => { @@ -373,10 +413,19 @@ } }, async created() { + console.log('{{request.url}}') 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 }}')) + 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 2bf982117..63a6c18c4 100644 --- a/lnbits/extensions/diagonalley/views.py +++ b/lnbits/extensions/diagonalley/views.py @@ -95,7 +95,7 @@ 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(...) + 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,6 +112,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, "order_id": order.invoiceid, "order": [details.dict() for details in _order], "products": [product.dict() for product in products],