fix: hide configured token value in Web UI startup log

Only print the access token when auto-generated (user needs it to
log in). When set via WEB_UI_TOKEN env var, just confirm it is set
without exposing the value in console output.
This commit is contained in:
0xbyt4
2026-03-13 17:05:55 +03:00
parent 44abe852fb
commit a21f518c0b

View File

@@ -66,7 +66,9 @@ class WebAdapter(BasePlatformAdapter):
# Config
self._host: str = config.extra.get("host", "127.0.0.1")
self._port: int = config.extra.get("port", 8765)
self._token: str = config.extra.get("token", "") or secrets.token_hex(16)
configured_token = config.extra.get("token", "")
self._token: str = configured_token or secrets.token_hex(16)
self._token_auto_generated: bool = not configured_token
# Connected WebSocket clients: session_id -> ws
self._clients: Dict[str, web.WebSocketResponse] = {}
@@ -110,7 +112,10 @@ class WebAdapter(BasePlatformAdapter):
for ip in all_ips:
if ip != primary_ip:
print(f"[{self.name}] also: http://{ip}:{self._port}")
print(f"[{self.name}] Access token: {self._token}")
if self._token_auto_generated:
print(f"[{self.name}] Access token (auto-generated): {self._token}")
else:
print(f"[{self.name}] Access token: (set via WEB_UI_TOKEN)")
return True