PREFER_SECURE_URLS, get rid of FORCE_HTTPS hacks.

This commit is contained in:
Eneko Illarramendi
2020-09-24 13:08:59 -03:00
committed by fiatjaf
parent 39cd96594e
commit 098089af75
4 changed files with 6 additions and 15 deletions
+2 -7
View File
@@ -3,7 +3,6 @@ from lnurl import Lnurl, LnurlWithdrawResponse, encode as lnurl_encode
from sqlite3 import Row
from typing import NamedTuple
import shortuuid # type: ignore
from lnbits.settings import FORCE_HTTPS
class WithdrawLink(NamedTuple):
@@ -35,7 +34,6 @@ class WithdrawLink(NamedTuple):
@property
def lnurl(self) -> Lnurl:
scheme = "https" if FORCE_HTTPS else None
if self.is_unique:
usescssv = self.usescsv.split(",")
tohash = self.id + self.unique_hash + usescssv[self.number]
@@ -45,18 +43,15 @@ class WithdrawLink(NamedTuple):
unique_hash=self.unique_hash,
id_unique_hash=multihash,
_external=True,
_scheme=scheme,
)
else:
url = url_for("withdraw.api_lnurl_response", unique_hash=self.unique_hash, _external=True, _scheme=scheme)
url = url_for("withdraw.api_lnurl_response", unique_hash=self.unique_hash, _external=True)
return lnurl_encode(url)
@property
def lnurl_response(self) -> LnurlWithdrawResponse:
scheme = "https" if FORCE_HTTPS else None
url = url_for("withdraw.api_lnurl_callback", unique_hash=self.unique_hash, _external=True, _scheme=scheme)
url = url_for("withdraw.api_lnurl_callback", unique_hash=self.unique_hash, _external=True)
return LnurlWithdrawResponse(
callback=url,
k1=self.k1,