bug: fix latest fastapi req_for (#20)
This commit is contained in:
parent
4b87e87f64
commit
ab4c9880be
2 changed files with 10 additions and 10 deletions
4
lnurl.py
4
lnurl.py
|
|
@ -38,7 +38,7 @@ async def api_lnurl_response(request: Request, unique_hash: str):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="Withdraw is spent."
|
status_code=HTTPStatus.NOT_FOUND, detail="Withdraw is spent."
|
||||||
)
|
)
|
||||||
url = request.url_for("withdraw.api_lnurl_callback", unique_hash=link.unique_hash)
|
url = str(request.url_for("withdraw.api_lnurl_callback", unique_hash=link.unique_hash))
|
||||||
|
|
||||||
# Check if url is .onion and change to http
|
# Check if url is .onion and change to http
|
||||||
if urlparse(url).netloc.endswith(".onion"):
|
if urlparse(url).netloc.endswith(".onion"):
|
||||||
|
|
@ -195,7 +195,7 @@ async def api_lnurl_multi_response(request: Request, unique_hash: str, id_unique
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="LNURL-withdraw not found."
|
status_code=HTTPStatus.NOT_FOUND, detail="LNURL-withdraw not found."
|
||||||
)
|
)
|
||||||
|
|
||||||
url = request.url_for("withdraw.api_lnurl_callback", unique_hash=link.unique_hash)
|
url = str(request.url_for("withdraw.api_lnurl_callback", unique_hash=link.unique_hash))
|
||||||
|
|
||||||
# Check if url is .onion and change to http
|
# Check if url is .onion and change to http
|
||||||
if urlparse(url).netloc.endswith(".onion"):
|
if urlparse(url).netloc.endswith(".onion"):
|
||||||
|
|
|
||||||
16
models.py
16
models.py
|
|
@ -49,24 +49,24 @@ class WithdrawLink(BaseModel):
|
||||||
usescssv = self.usescsv.split(",")
|
usescssv = self.usescsv.split(",")
|
||||||
tohash = self.id + self.unique_hash + usescssv[self.number]
|
tohash = self.id + self.unique_hash + usescssv[self.number]
|
||||||
multihash = shortuuid.uuid(name=tohash)
|
multihash = shortuuid.uuid(name=tohash)
|
||||||
url = req.url_for(
|
url = str(req.url_for(
|
||||||
"withdraw.api_lnurl_multi_response",
|
"withdraw.api_lnurl_multi_response",
|
||||||
unique_hash=self.unique_hash,
|
unique_hash=self.unique_hash,
|
||||||
id_unique_hash=multihash,
|
id_unique_hash=multihash,
|
||||||
)
|
))
|
||||||
else:
|
else:
|
||||||
url = req.url_for(
|
url = str(req.url_for(
|
||||||
"withdraw.api_lnurl_response", unique_hash=self.unique_hash
|
"withdraw.api_lnurl_response", unique_hash=self.unique_hash
|
||||||
)
|
))
|
||||||
|
|
||||||
return lnurl_encode(str(url))
|
return lnurl_encode(url)
|
||||||
|
|
||||||
def lnurl_response(self, req: Request) -> LnurlWithdrawResponse:
|
def lnurl_response(self, req: Request) -> LnurlWithdrawResponse:
|
||||||
url = req.url_for(
|
url = str(req.url_for(
|
||||||
name="withdraw.api_lnurl_callback", unique_hash=self.unique_hash
|
name="withdraw.api_lnurl_callback", unique_hash=self.unique_hash
|
||||||
)
|
))
|
||||||
return LnurlWithdrawResponse(
|
return LnurlWithdrawResponse(
|
||||||
callback=ClearnetUrl(str(url), scheme="https"),
|
callback=ClearnetUrl(url, scheme="https"),
|
||||||
k1=self.k1,
|
k1=self.k1,
|
||||||
minWithdrawable=MilliSatoshi(self.min_withdrawable * 1000),
|
minWithdrawable=MilliSatoshi(self.min_withdrawable * 1000),
|
||||||
maxWithdrawable=MilliSatoshi(self.max_withdrawable * 1000),
|
maxWithdrawable=MilliSatoshi(self.max_withdrawable * 1000),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue