From 14ea80a0fe11a92f51e6b7134eaab8903d690ca7 Mon Sep 17 00:00:00 2001 From: mrlt8 <67088095+mrlt8@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:50:43 -0700 Subject: [PATCH] Ignore WB_API if WB_AUTH is disabled #1304 --- README.md | 4 +++- app/wyzebridge/auth.py | 5 ++--- home_assistant/CHANGELOG.md | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4804ab29..45b8d9a6 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,9 @@ You can then use the web interface at `http://localhost:5000` where localhost is See [basic usage](#basic-usage) for additional information or visit the [wiki page](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant) for additional information on using the bridge as a Home Assistant Add-on. -## What's Changed in v2.10.0 +## What's Changed in v2.10.0/v2.10.1 + +FIXED: Could not disable `WB_AUTH` if `WB_API` is set. (#1304) ### WebUI Authentication diff --git a/app/wyzebridge/auth.py b/app/wyzebridge/auth.py index a948239c..b4de82f2 100644 --- a/app/wyzebridge/auth.py +++ b/app/wyzebridge/auth.py @@ -47,7 +47,7 @@ def gen_api_key(email): class WbAuth: enabled: bool = bool(env_bool("WB_AUTH") if os.getenv("WB_AUTH") else True) username: str = get_secret("wb_username", "wbadmin") - api: str = get_credential("wb_api") + api: str = "" _pass: str = get_credential("wb_password") _hashed_pass: Optional[str] = None @@ -80,8 +80,7 @@ def _update_credentials(cls, email: str, force: bool = False) -> None: cls._pass = email.partition("@")[0] cls._hashed_pass = generate_password_hash(cls._pass) - if not get_credential("wb_api"): - cls.api = gen_api_key(email) + cls.api = get_credential("wb_api") or gen_api_key(email) STREAM_AUTH: str = env_bool("STREAM_AUTH", style="original") diff --git a/home_assistant/CHANGELOG.md b/home_assistant/CHANGELOG.md index 1a929533..68de8a14 100644 --- a/home_assistant/CHANGELOG.md +++ b/home_assistant/CHANGELOG.md @@ -1,4 +1,6 @@ -## What's Changed in v2.10.0 +## What's Changed in v2.10.0/v2.10.1 + +FIXED: Could not disable `WB_AUTH` if `WB_API` is set. Thanks @bengthu! (#1304) ### WebUI Authentication