mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 11:06:32 +00:00
Merge remote-tracking branch 'origin/dev'
Release 111
This commit is contained in:
commit
9f9ff0d1ad
@ -243,5 +243,9 @@ class RestAPI(CoreSysAttributes):
|
|||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
"""Stop rest api webserver."""
|
"""Stop rest api webserver."""
|
||||||
|
if not self._site:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Shutdown running API
|
||||||
await self._site.stop()
|
await self._site.stop()
|
||||||
await self._runner.cleanup()
|
await self._runner.cleanup()
|
||||||
|
@ -35,11 +35,6 @@ class SecurityMiddleware(CoreSysAttributes):
|
|||||||
_LOGGER.debug("Passthrough %s", request.path)
|
_LOGGER.debug("Passthrough %s", request.path)
|
||||||
return await handler(request)
|
return await handler(request)
|
||||||
|
|
||||||
# Unknown API access
|
|
||||||
if not hassio_token:
|
|
||||||
_LOGGER.warning("Invalid token for access %s", request.path)
|
|
||||||
raise HTTPUnauthorized()
|
|
||||||
|
|
||||||
# Home-Assistant
|
# Home-Assistant
|
||||||
if hassio_token == self.sys_homeassistant.uuid:
|
if hassio_token == self.sys_homeassistant.uuid:
|
||||||
_LOGGER.debug("%s access from Home-Assistant", request.path)
|
_LOGGER.debug("%s access from Home-Assistant", request.path)
|
||||||
@ -51,11 +46,14 @@ class SecurityMiddleware(CoreSysAttributes):
|
|||||||
request[REQUEST_FROM] = 'host'
|
request[REQUEST_FROM] = 'host'
|
||||||
|
|
||||||
# Add-on
|
# Add-on
|
||||||
addon = self.sys_addons.from_uuid(hassio_token)
|
addon = self.sys_addons.from_uuid(hassio_token) \
|
||||||
|
if hassio_token else None
|
||||||
if addon:
|
if addon:
|
||||||
_LOGGER.info("%s access from %s", request.path, addon.slug)
|
_LOGGER.info("%s access from %s", request.path, addon.slug)
|
||||||
request[REQUEST_FROM] = addon.slug
|
request[REQUEST_FROM] = addon.slug
|
||||||
|
|
||||||
if not request.get(REQUEST_FROM):
|
if request.get(REQUEST_FROM):
|
||||||
raise HTTPUnauthorized()
|
|
||||||
return await handler(request)
|
return await handler(request)
|
||||||
|
|
||||||
|
_LOGGER.warning("Invalid token for access %s", request.path)
|
||||||
|
raise HTTPUnauthorized()
|
||||||
|
@ -28,7 +28,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
ENV_SHARE = 'SUPERVISOR_SHARE'
|
ENV_SHARE = 'SUPERVISOR_SHARE'
|
||||||
ENV_NAME = 'SUPERVISOR_NAME'
|
ENV_NAME = 'SUPERVISOR_NAME'
|
||||||
ENV_REPO = 'HOMEASSISTANT_REPOSITORY'
|
ENV_REPO = 'HOMEASSISTANT_REPOSITORY'
|
||||||
ENV_MACHINE = 'MACHINE_ID'
|
|
||||||
|
MACHINE_ID = Path('/etc/machine-id')
|
||||||
|
|
||||||
|
|
||||||
def initialize_coresys(loop):
|
def initialize_coresys(loop):
|
||||||
@ -54,7 +55,8 @@ def initialize_coresys(loop):
|
|||||||
initialize_system_data(coresys)
|
initialize_system_data(coresys)
|
||||||
|
|
||||||
# Set Machine/Host ID
|
# Set Machine/Host ID
|
||||||
coresys.machine_id = os.environ.get(ENV_MACHINE)
|
if MACHINE_ID.exists():
|
||||||
|
coresys.machine_id = MACHINE_ID.read_text().strip()
|
||||||
|
|
||||||
return coresys
|
return coresys
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
|
|
||||||
HASSIO_VERSION = '110'
|
HASSIO_VERSION = '111'
|
||||||
|
|
||||||
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
||||||
URL_HASSIO_VERSION = \
|
URL_HASSIO_VERSION = \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user