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