Raise on init if homeserver url is missing scheme
This commit is contained in:
parent
73541ad7a5
commit
5832c3ca2d
|
@ -44,11 +44,14 @@ class MatrixClient(nio.AsyncClient):
|
||||||
homeserver: str = "https://matrix.org",
|
homeserver: str = "https://matrix.org",
|
||||||
device_id: Optional[str] = None) -> None:
|
device_id: Optional[str] = None) -> None:
|
||||||
|
|
||||||
|
if not urlparse(homeserver).scheme:
|
||||||
|
raise ValueError(
|
||||||
|
f"homeserver is missing scheme (e.g. https://): {homeserver}",
|
||||||
|
)
|
||||||
|
|
||||||
store = Path(backend.app.appdirs.user_data_dir) / "encryption"
|
store = Path(backend.app.appdirs.user_data_dir) / "encryption"
|
||||||
store.mkdir(parents=True, exist_ok=True)
|
store.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# TODO: ensure homeserver starts by a scheme://
|
|
||||||
# TODO: pass a ClientConfig with a pickle key
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
homeserver = homeserver,
|
homeserver = homeserver,
|
||||||
user = user,
|
user = user,
|
||||||
|
@ -56,6 +59,7 @@ class MatrixClient(nio.AsyncClient):
|
||||||
store_path = store,
|
store_path = store,
|
||||||
config = nio.AsyncClientConfig(
|
config = nio.AsyncClientConfig(
|
||||||
max_timeout_retry_wait_time = 10,
|
max_timeout_retry_wait_time = 10,
|
||||||
|
# TODO: pass a custom encryption DB pickle key?
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user