Expose if HTTP is configured for SSL (#64940)
This commit is contained in:
parent
149cd8e319
commit
9cbdd36082
2 changed files with 7 additions and 4 deletions
|
@ -21,6 +21,7 @@ from homeassistant.components.google_assistant import helpers as google_helpers
|
|||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||
from homeassistant.components.websocket_api import const as ws_const
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.util.location import async_detect_location_info
|
||||
|
||||
|
@ -288,7 +289,7 @@ async def websocket_cloud_status(hass, connection, msg):
|
|||
"""
|
||||
cloud = hass.data[DOMAIN]
|
||||
connection.send_message(
|
||||
websocket_api.result_message(msg["id"], await _account_data(cloud))
|
||||
websocket_api.result_message(msg["id"], await _account_data(hass, cloud))
|
||||
)
|
||||
|
||||
|
||||
|
@ -414,7 +415,7 @@ async def websocket_hook_delete(hass, connection, msg):
|
|||
connection.send_message(websocket_api.result_message(msg["id"]))
|
||||
|
||||
|
||||
async def _account_data(cloud):
|
||||
async def _account_data(hass: HomeAssistant, cloud: Cloud):
|
||||
"""Generate the auth data JSON response."""
|
||||
|
||||
if not cloud.is_logged_in:
|
||||
|
@ -445,6 +446,7 @@ async def _account_data(cloud):
|
|||
"remote_certificate": certificate,
|
||||
"remote_connected": remote.is_connected,
|
||||
"remote_domain": remote.instance_domain,
|
||||
"http_use_ssl": hass.config.api.use_ssl,
|
||||
}
|
||||
|
||||
|
||||
|
@ -457,7 +459,7 @@ async def websocket_remote_connect(hass, connection, msg):
|
|||
"""Handle request for connect remote."""
|
||||
cloud = hass.data[DOMAIN]
|
||||
await cloud.client.prefs.async_update(remote_enabled=True)
|
||||
connection.send_result(msg["id"], await _account_data(cloud))
|
||||
connection.send_result(msg["id"], await _account_data(hass, cloud))
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
|
@ -469,7 +471,7 @@ async def websocket_remote_disconnect(hass, connection, msg):
|
|||
"""Handle request for disconnect remote."""
|
||||
cloud = hass.data[DOMAIN]
|
||||
await cloud.client.prefs.async_update(remote_enabled=False)
|
||||
connection.send_result(msg["id"], await _account_data(cloud))
|
||||
connection.send_result(msg["id"], await _account_data(hass, cloud))
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue