fix purge

check for missing protocol

fix request url default

more debub

fix lnbits root url

add documentation reference
This commit is contained in:
Tiago vasconcelos
2021-11-30 15:13:06 +00:00
parent b9bc36fabf
commit 290268885d
4 changed files with 11 additions and 17 deletions

View File

@@ -176,7 +176,7 @@ async def purge_addresses(domain_id: str):
now = datetime.now().timestamp()
for row in rows:
r = Addresses(**row)._asdict()
r = Addresses(**row).dict()
start = datetime.fromtimestamp(r["time"])
paid = r["paid"]

View File

@@ -370,10 +370,9 @@
if (data.wallet_endpoint == '') {
data.wallet_endpoint = null
}
data.wallet_endpoint = data.wallet_endpoint ?? '{{ request.url_root }}'
data.wallet_endpoint = data.wallet_endpoint ?? '{{ root_url }}'
data.duration = parseInt(data.duration)
console.log('data', data)
axios
.post('/lnaddress/api/v1/address/{{ domain_id }}', data)
.then(response => {

View File

@@ -186,10 +186,14 @@
<q-input
filled
dense
bottom-slots
v-model.trim="domainDialog.data.cf_token"
type="text"
label="Cloudflare API token"
>
<template v-slot:hint>
Check extension <a href="https://github.com/lnbits/lnbits-legend/tree/master/lnbits/extensions/lnaddress">documentation!</a>
</template>
<q-tooltip class="bg-grey-8" anchor="bottom left" self="top left"
>Your API key in cloudflare</q-tooltip
>
@@ -489,18 +493,6 @@
this.getDomains()
this.getAddresses()
}
// var self = this
//
// // axios is available for making requests
// axios({
// method: 'GET',
// url: '/example/api/v1/tools',
// headers: {
// 'X-example-header': 'not-used'
// }
// }).then(function (response) {
// self.tools = response.data
// })
}
})
</script>

View File

@@ -1,4 +1,5 @@
from http import HTTPStatus
from urllib.parse import urlparse
from fastapi import Request
from fastapi.params import Depends
@@ -34,7 +35,8 @@ async def display(domain_id, request: Request):
await purge_addresses(domain_id)
wallet = await get_wallet(domain.wallet)
url = urlparse(str(request.url))
return lnaddress_renderer().TemplateResponse(
"lnaddress/display.html",
{
@@ -43,5 +45,6 @@ async def display(domain_id, request: Request):
"domain_domain": domain.domain,
"domain_cost": domain.cost,
"domain_wallet_inkey": wallet.inkey,
"root_url": f"{url.scheme}://{url.netloc}"
},
)