make format

This commit is contained in:
Tiago Vasconcelos 2022-11-25 14:24:17 +00:00
parent 78e94df9c5
commit e9109b0b49
3 changed files with 96 additions and 76 deletions

View file

@ -859,7 +859,11 @@
> >
<div class="text-center q-mb-lg"> <div class="text-center q-mb-lg">
{% raw %} {% raw %}
<q-responsive :ratio="1" class="q-mx-xl" @click="copyText(keys[type])"> <q-responsive
:ratio="1"
class="q-mx-xl"
@click="copyText(keys[type])"
>
<qrcode <qrcode
:value="keys[type]" :value="keys[type]"
:options="{width: 250}" :options="{width: 250}"
@ -867,7 +871,11 @@
></qrcode> ></qrcode>
<q-tooltip>{{ keys[type] }}</q-tooltip> <q-tooltip>{{ keys[type] }}</q-tooltip>
</q-responsive> </q-responsive>
<p>{{ type == 'pubkey' ? 'Public Key' : 'Private Key' }}<br /><small>Click to copy</small></p> <p>
{{ type == 'pubkey' ? 'Public Key' : 'Private Key' }}<br /><small
>Click to copy</small
>
</p>
{% endraw %} {% endraw %}
</div> </div>
</div> </div>
@ -1423,7 +1431,7 @@
align: 'left', align: 'left',
label: 'Public Key', label: 'Public Key',
field: 'pubkey' field: 'pubkey'
}, }
] ]
LNbits.utils.exportCSV(colls, [this.keys]) LNbits.utils.exportCSV(colls, [this.keys])
}, },

View file

@ -102,10 +102,7 @@
<q-card-section> <q-card-section>
<q-separator></q-separator> <q-separator></q-separator>
<q-list> <q-list>
<q-expansion-item <q-expansion-item group="extras" icon="vpn_key" label="Keys"
group="extras"
icon="vpn_key"
label="Keys"
><p> ><p>
Bellow are the keys needed to contact the merchant. They are Bellow are the keys needed to contact the merchant. They are
stored in the browser! stored in the browser!
@ -118,7 +115,11 @@
> >
<div class="text-center q-mb-lg"> <div class="text-center q-mb-lg">
{% raw %} {% raw %}
<q-responsive :ratio="1" class="q-mx-auto" style="max-width: 250px;"> <q-responsive
:ratio="1"
class="q-mx-auto"
style="max-width: 250px"
>
<qrcode <qrcode
:value="user.keys[type]" :value="user.keys[type]"
:options="{width: 500}" :options="{width: 500}"
@ -158,18 +159,17 @@
<q-tooltip>Delete all data from browser</q-tooltip> <q-tooltip>Delete all data from browser</q-tooltip>
</q-btn> </q-btn>
</div> </div>
</q-expansion-item </q-expansion-item>
>
</q-list> </q-list>
<q-expansion-item <q-expansion-item icon="qr_code" label="Export page">
icon="qr_code" <p>Export, or send, this page to another device</p>
label="Export page"
>
<p>
Export, or send, this page to another device
</p>
<div class="text-center q-mb-lg"> <div class="text-center q-mb-lg">
<q-responsive :ratio="1" class="q-my-xl q-mx-auto" style="max-width: 250px;" @click="copyText(exportURL)"> <q-responsive
:ratio="1"
class="q-my-xl q-mx-auto"
style="max-width: 250px"
@click="copyText(exportURL)"
>
<qrcode <qrcode
:value="exportURL" :value="exportURL"
:options="{width: 500}" :options="{width: 500}"
@ -186,7 +186,9 @@
color="grey" color="grey"
class="q-ml-auto" class="q-ml-auto"
>Copy URL >Copy URL
<q-tooltip>Export, or send, this page to another device</q-tooltip> <q-tooltip
>Export, or send, this page to another device</q-tooltip
>
</q-btn> </q-btn>
</div> </div>
</q-expansion-item> </q-expansion-item>
@ -268,8 +270,11 @@
} }
}, },
computed: { computed: {
exportURL(){ exportURL() {
return '{{request.url}}' + `&keys=${this.user.keys.publickey},${this.user.keys.privatekey}` return (
'{{request.url}}' +
`&keys=${this.user.keys.publickey},${this.user.keys.privatekey}`
)
} }
}, },
methods: { methods: {
@ -333,7 +338,8 @@
}, },
async generateKeys(payment_hash) { async generateKeys(payment_hash) {
//check if the keys are set //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 return await LNbits.api
.request('GET', `/diagonalley/api/v1/keys/${payment_hash}`, null) .request('GET', `/diagonalley/api/v1/keys/${payment_hash}`, null)
@ -417,9 +423,12 @@
let order_details = JSON.parse('{{ order | tojson }}') let order_details = JSON.parse('{{ order | tojson }}')
let products = JSON.parse('{{ products | tojson }}') let products = JSON.parse('{{ products | tojson }}')
let order_id = '{{ order_id }}' 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 = { this.user.keys = {
privatekey: '{{ privatekey }}', privatekey: '{{ privatekey }}',
publickey: '{{ publickey }}' publickey: '{{ publickey }}'

View file

@ -95,7 +95,10 @@ async def display(request: Request, market_id):
@diagonalley_ext.get("/order", response_class=HTMLResponse) @diagonalley_ext.get("/order", response_class=HTMLResponse)
async def chat_page( 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) stall = await get_diagonalley_stall(merch)
order = await get_diagonalley_order_invoiceid(invoice_id) order = await get_diagonalley_order_invoiceid(invoice_id)
@ -112,8 +115,8 @@ async def chat_page(
"publickey": stall.publickey, "publickey": stall.publickey,
"wallet": stall.wallet, "wallet": stall.wallet,
}, },
"publickey": keys.split(',')[0] if keys else None, "publickey": keys.split(",")[0] if keys else None,
"privatekey": keys.split(',')[1] if keys else None, "privatekey": keys.split(",")[1] if keys else None,
"order_id": order.invoiceid, "order_id": order.invoiceid,
"order": [details.dict() for details in _order], "order": [details.dict() for details in _order],
"products": [product.dict() for product in products], "products": [product.dict() for product in products],