"Failed to connect to https://ws:" crash (#2548)

* Update base.py

fixing bug in normalize_enpoints

* Update lnbits/wallets/base.py

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>

---------

Co-authored-by: dni  <office@dnilabs.com>
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
This commit is contained in:
Ilya Evdokimov 2024-06-17 17:36:15 +02:00 committed by GitHub
parent b6d99b09cf
commit dbacf7e8c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -137,6 +137,8 @@ class Wallet(ABC):
def normalize_endpoint(self, endpoint: str, add_proto=True) -> str:
endpoint = endpoint[:-1] if endpoint.endswith("/") else endpoint
if add_proto:
if endpoint.startswith("ws://") or endpoint.startswith("wss://"):
return endpoint
endpoint = (
f"https://{endpoint}" if not endpoint.startswith("http") else endpoint
)