mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-09 18:26:30 +00:00
parent
78e093df96
commit
468cb0c36b
3
API.md
3
API.md
@ -663,12 +663,13 @@ return:
|
|||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
|
|
||||||
- GET `/version`
|
- GET `/info`
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"supervisor": "version",
|
"supervisor": "version",
|
||||||
"homeassistant": "version",
|
"homeassistant": "version",
|
||||||
"hassos": "null|version",
|
"hassos": "null|version",
|
||||||
|
"hostname": "name",
|
||||||
"machine": "type",
|
"machine": "type",
|
||||||
"arch": "arch",
|
"arch": "arch",
|
||||||
"channel": "stable|beta|dev"
|
"channel": "stable|beta|dev"
|
||||||
|
@ -10,11 +10,11 @@ from .homeassistant import APIHomeAssistant
|
|||||||
from .hardware import APIHardware
|
from .hardware import APIHardware
|
||||||
from .host import APIHost
|
from .host import APIHost
|
||||||
from .hassos import APIHassOS
|
from .hassos import APIHassOS
|
||||||
|
from .info import APIInfo
|
||||||
from .proxy import APIProxy
|
from .proxy import APIProxy
|
||||||
from .supervisor import APISupervisor
|
from .supervisor import APISupervisor
|
||||||
from .snapshots import APISnapshots
|
from .snapshots import APISnapshots
|
||||||
from .services import APIServices
|
from .services import APIServices
|
||||||
from .version import APIVersion
|
|
||||||
from .security import SecurityMiddleware
|
from .security import SecurityMiddleware
|
||||||
from ..coresys import CoreSysAttributes
|
from ..coresys import CoreSysAttributes
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class RestAPI(CoreSysAttributes):
|
|||||||
self._register_snapshots()
|
self._register_snapshots()
|
||||||
self._register_discovery()
|
self._register_discovery()
|
||||||
self._register_services()
|
self._register_services()
|
||||||
self._register_version()
|
self._register_info()
|
||||||
|
|
||||||
def _register_host(self):
|
def _register_host(self):
|
||||||
"""Register hostcontrol functions."""
|
"""Register hostcontrol functions."""
|
||||||
@ -92,13 +92,13 @@ class RestAPI(CoreSysAttributes):
|
|||||||
web.get('/hardware/audio', api_hardware.audio),
|
web.get('/hardware/audio', api_hardware.audio),
|
||||||
])
|
])
|
||||||
|
|
||||||
def _register_version(self):
|
def _register_info(self):
|
||||||
"""Register version functions."""
|
"""Register info functions."""
|
||||||
api_version = APIVersion()
|
api_info = APIInfo()
|
||||||
api_version.coresys = self.coresys
|
api_info.coresys = self.coresys
|
||||||
|
|
||||||
self.webapp.add_routes([
|
self.webapp.add_routes([
|
||||||
web.get('/version', api_version.info),
|
web.get('/info', api_info.info),
|
||||||
])
|
])
|
||||||
|
|
||||||
def _register_supervisor(self):
|
def _register_supervisor(self):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Init file for Hass.io version RESTful API."""
|
"""Init file for Hass.io info RESTful API."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .utils import api_process
|
from .utils import api_process
|
||||||
@ -10,12 +10,12 @@ from ..coresys import CoreSysAttributes
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class APIVersion(CoreSysAttributes):
|
class APIInfo(CoreSysAttributes):
|
||||||
"""Handle RESTful API for version functions."""
|
"""Handle RESTful API for info functions."""
|
||||||
|
|
||||||
@api_process
|
@api_process
|
||||||
async def info(self, request):
|
async def info(self, request):
|
||||||
"""Show version info."""
|
"""Show system info."""
|
||||||
return {
|
return {
|
||||||
ATTR_SUPERVISOR: self.sys_supervisor.version,
|
ATTR_SUPERVISOR: self.sys_supervisor.version,
|
||||||
ATTR_HOMEASSISTANT: self.sys_homeassistant.version,
|
ATTR_HOMEASSISTANT: self.sys_homeassistant.version,
|
@ -33,7 +33,7 @@ NO_SECURITY_CHECK = re.compile(
|
|||||||
ADDONS_API_BYPASS = re.compile(
|
ADDONS_API_BYPASS = re.compile(
|
||||||
r"^(?:"
|
r"^(?:"
|
||||||
r"|/addons/self/(?!security|update)[^/]+"
|
r"|/addons/self/(?!security|update)[^/]+"
|
||||||
r"|/version"
|
r"|/info"
|
||||||
r"|/services.*"
|
r"|/services.*"
|
||||||
r"|/discovery.*"
|
r"|/discovery.*"
|
||||||
r")$"
|
r")$"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user