Extend auth/providers endpoint and add /api/person/list endpoint for local ip requests (#103906)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Robert Resch 2023-11-24 17:11:54 +01:00 committed by GitHub
parent 512902fc59
commit 852fb58ca8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 370 additions and 75 deletions

View file

@ -17,7 +17,7 @@ from homeassistant.components import websocket_api
from homeassistant.components.http.view import HomeAssistantView
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.network import get_url
from homeassistant.helpers.network import get_url, is_cloud_connection
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass
from homeassistant.util import network
@ -145,13 +145,8 @@ async def async_handle_webhook(
return Response(status=HTTPStatus.METHOD_NOT_ALLOWED)
if webhook["local_only"] in (True, None) and not isinstance(request, MockRequest):
if has_cloud := "cloud" in hass.config.components:
from hass_nabucasa import remote # pylint: disable=import-outside-toplevel
is_local = True
if has_cloud and remote.is_cloud_request.get():
is_local = False
else:
is_local = not is_cloud_connection(hass)
if is_local:
if TYPE_CHECKING:
assert isinstance(request, Request)
assert request.remote is not None