feat: add optional domain field (#120)
* feat: add optional domain field closes #119
This commit is contained in:
parent
76c5841bc8
commit
17135b45ae
8 changed files with 107 additions and 46 deletions
|
|
@ -2,10 +2,26 @@ window.PageLnurlpPublic = {
|
|||
template: '#page-lnurlp-public',
|
||||
data() {
|
||||
return {
|
||||
url: ''
|
||||
url: '',
|
||||
payLink: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setUrl(link_id, domain) {
|
||||
this.url = `https://${domain || window.location.host}/lnurlp/${link_id}`
|
||||
},
|
||||
getPayLink() {
|
||||
this.api
|
||||
.request('GET', `/lnurlp/api/v1/links/public/${this.$route.params.id}`)
|
||||
.then(res => {
|
||||
this.payLink = res.data
|
||||
this.setUrl(this.payLink.id, this.payLink.domain)
|
||||
})
|
||||
.catch(this.utils.notifyApiError)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.url = window.location.origin + '/lnurlp/' + this.$route.params.id
|
||||
this.setUrl(this.$route.params.id)
|
||||
this.getPayLink()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@ window.PageLnurlp = {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
lnaddress(link) {
|
||||
const domain = link.domain || window.location.host
|
||||
return `${link.username}@${domain}`
|
||||
},
|
||||
mapPayLink(obj) {
|
||||
const locationPath = [
|
||||
window.location.protocol,
|
||||
|
|
@ -140,11 +144,13 @@ window.PageLnurlp = {
|
|||
(link.success_url ? ' and URL "' + link.success_url + '"' : '')
|
||||
: 'do nothing',
|
||||
lnurl: link.lnurl,
|
||||
domain: link.domain,
|
||||
pay_url: link.pay_url,
|
||||
print_url: link.print_url,
|
||||
username: link.username
|
||||
}
|
||||
this.activeUrl = window.location.origin + '/lnurlp/' + link.id
|
||||
const domain = link.domain || window.location.host
|
||||
this.activeUrl = `https://${domain}/lnurlp//${link.id}`
|
||||
this.qrCodeDialog.show = true
|
||||
},
|
||||
openUpdateDialog(linkId) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
<span v-text="col.label"></span>
|
||||
</q-th>
|
||||
<q-th auto-width></q-th>
|
||||
<q-th auto-width></q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
|
|
@ -55,7 +54,6 @@
|
|||
><q-tooltip>Shareable Page</q-tooltip></q-btn
|
||||
>
|
||||
<q-btn
|
||||
unelevated
|
||||
dense
|
||||
size="xs"
|
||||
icon="visibility"
|
||||
|
|
@ -64,6 +62,27 @@
|
|||
@click="openQrCodeDialog(props.row.id)"
|
||||
><q-tooltip>View Link</q-tooltip></q-btn
|
||||
>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="xs"
|
||||
@click="openUpdateDialog(props.row.id)"
|
||||
icon="edit"
|
||||
color="light-blue"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<q-tooltip>Edit</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="xs"
|
||||
@click="deletePayLink(props.row.id)"
|
||||
icon="cancel"
|
||||
color="pink"
|
||||
class="q-ml-sm"
|
||||
><q-tooltip>Delete</q-tooltip></q-btn
|
||||
>
|
||||
</q-td>
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
|
|
@ -104,27 +123,6 @@
|
|||
</q-tooltip>
|
||||
</q-icon>
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="xs"
|
||||
@click="openUpdateDialog(props.row.id)"
|
||||
icon="edit"
|
||||
color="light-blue"
|
||||
>
|
||||
<q-tooltip>Edit</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="xs"
|
||||
@click="deletePayLink(props.row.id)"
|
||||
icon="cancel"
|
||||
color="pink"
|
||||
><q-tooltip>Delete</q-tooltip></q-btn
|
||||
>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
|
|
@ -402,10 +400,17 @@
|
|||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="col" style="margin-top: 10px">
|
||||
<span class="label">
|
||||
@ <span v-text="domain"></span>
|
||||
</span>
|
||||
<div class="col" style="flex: 0 0 auto; margin-top: 10px">
|
||||
<span class="label"> @ </span>
|
||||
</div>
|
||||
<div class="col">
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
v-model.trim="formDialog.data.domain"
|
||||
type="text"
|
||||
:label="domain"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-col-gutter-sm q-mx-sm">
|
||||
|
|
@ -642,7 +647,7 @@
|
|||
<span v-text="qrCodeDialog.data.success"></span><br />
|
||||
<span v-if="qrCodeDialog.data.username">
|
||||
<strong>Lightning Address: </strong>
|
||||
<span v-text="qrCodeDialog.data.username + '@' + domain"></span>
|
||||
<span v-text="lnaddress(qrCodeDialog.data)"></span>
|
||||
<br />
|
||||
</span>
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue