fronte nd page working

This commit is contained in:
benarc 2024-01-17 13:26:04 +00:00
parent 044696ffce
commit 1fa7e9155c
3 changed files with 28 additions and 39 deletions

Binary file not shown.

View file

@ -7,7 +7,7 @@
<a class="text-secondary" href="lightning:{{ lnurl }}"> <a class="text-secondary" href="lightning:{{ lnurl }}">
<q-responsive :ratio="1" class="q-mx-md"> <q-responsive :ratio="1" class="q-mx-md">
<qrcode <qrcode
value="lightning:{{ lnurl }}" :value="qrValue"
:options="{width: 800}" :options="{width: 800}"
class="rounded-borders" class="rounded-borders"
></qrcode> ></qrcode>
@ -15,25 +15,36 @@
</a> </a>
</div> </div>
<div class="row q-mt-lg q-gutter-sm"> <div class="row q-mt-lg q-gutter-sm">
<q-btn outline color="grey" @click="copyText('{{ lnurl }}')" <q-btn outline color="grey" @click="copyText(qrValue)"
>Copy LNURL</q-btn >Copy LNURL </q-btn
> >
<q-btn
outline
color="grey"
icon="nfc"
@click="writeNfcTag(' {{ lnurl }} ')"
:disable="nfcTagWriting"
></q-btn>
</div> </div>
</q-card-section> </q-card-section>
<div class="row justify-start q-mt-lg">
<div class="col col-md-auto">
<q-btn outline style="color: primmary;" @click="qrValue = '{{ lnurlpay }}'">lnurlpay</q-btn>
</div>
<div class="col col-md-auto">
<q-btn outline style="color: primmary;" @click="qrValue = '{{ lnurlwithdraw }}'">lnurlwithdraw</q-btn>
</div>
</div>
</q-card> </q-card>
</div> </div>
<div class="col-12 col-sm-6 col-md-5 col-lg-4 q-gutter-y-md"> <div class="col-12 col-sm-6 col-md-5 col-lg-4 q-gutter-y-md">
<q-card> <q-card>
<q-card-section> <q-card-section>
<h6 class="text-subtitle1 q-mb-sm q-mt-none">LNbits LNURL-pay link</h6> <h6 class="text-subtitle1 q-mb-sm q-mt-none">Public page</h6>
<p class="q-my-none">Use an LNURL compatible bitcoin wallet to pay.</p> <p class="q-my-none">
Moat extensions have a public page that can be shared
(this page will still be accessible even if you have restricted
access to your LNbits install).
<br/>
In this example when a user pays the LNURLpay it triggers an event via a websocket waiting for the payment.
</p>.</p>
</q-card-section> </q-card-section>
<q-card-section class="q-pa-none"> <q-card-section class="q-pa-none">
<q-separator></q-separator> <q-separator></q-separator>
@ -51,35 +62,13 @@
mixins: [windowMixin], mixins: [windowMixin],
data: function () { data: function () {
return { return {
lnurlpay: "{{ lnurlpay|tojson }}", qrValue: ''
lnurlwithdraw: "{{ lnurlwithdraw|tojson }}",
} }
}, },
created: function () { created: function () {
if (this.g.user.wallets.length) { this.qrValue = '{{lnurlpay}}'
this.getTemps()
}
}, },
methods: { methods: {
copyText: function (text) {
var self = this
navigator.clipboard.writeText(text).then(
function () {
self.$q.notify({
message: 'LNURL copied to clipboard',
color: 'positive',
icon: 'done',
})
},
function (err) {
self.$q.notify({
message: 'LNURL copy failed',
color: 'negative',
icon: 'error',
})
}
)
},
createInvoice(walletId) { createInvoice(walletId) {
console.log(walletId) console.log(walletId)
const wallet = _.findWhere(this.g.user.wallets, { const wallet = _.findWhere(this.g.user.wallets, {

View file

@ -33,7 +33,7 @@ async def index(request: Request, user: User = Depends(check_user_exists)):
@myextension_ext.get("/{myextension_id}") @myextension_ext.get("/{myextension_id}")
async def myextension(request: Request, myextension_id): async def myextension(request: Request, myextension_id):
myextension = await get_myextension(myextension_id) myextension = await get_myextension(myextension_id, request)
if not myextension: if not myextension:
raise HTTPException( raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="MyExtension does not exist." status_code=HTTPStatus.NOT_FOUND, detail="MyExtension does not exist."
@ -43,8 +43,8 @@ async def myextension(request: Request, myextension_id):
{ {
"request": request, "request": request,
"myextension_id": myextension_id, "myextension_id": myextension_id,
"lnurlpay": myextension.lnurlpayamount, "lnurlpay": myextension.lnurlpay,
"lnurlwithdraw": myextension.lnurlwithdrawamount, "lnurlwithdraw": myextension.lnurlwithdraw,
"web_manifest": f"/myextension/manifest/{myextension_id}.webmanifest", "web_manifest": f"/myextension/manifest/{myextension_id}.webmanifest",
}, },
) )