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() now = datetime.now().timestamp()
for row in rows: for row in rows:
r = Addresses(**row)._asdict() r = Addresses(**row).dict()
start = datetime.fromtimestamp(r["time"]) start = datetime.fromtimestamp(r["time"])
paid = r["paid"] paid = r["paid"]

View File

@@ -370,9 +370,8 @@
if (data.wallet_endpoint == '') { if (data.wallet_endpoint == '') {
data.wallet_endpoint = null 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) data.duration = parseInt(data.duration)
console.log('data', data)
axios axios
.post('/lnaddress/api/v1/address/{{ domain_id }}', data) .post('/lnaddress/api/v1/address/{{ domain_id }}', data)

View File

@@ -186,10 +186,14 @@
<q-input <q-input
filled filled
dense dense
bottom-slots
v-model.trim="domainDialog.data.cf_token" v-model.trim="domainDialog.data.cf_token"
type="text" type="text"
label="Cloudflare API token" 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" <q-tooltip class="bg-grey-8" anchor="bottom left" self="top left"
>Your API key in cloudflare</q-tooltip >Your API key in cloudflare</q-tooltip
> >
@@ -489,18 +493,6 @@
this.getDomains() this.getDomains()
this.getAddresses() 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> </script>

View File

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