Add authentication to error log endpoint (#13836)
This commit is contained in:
1 parent
b9306a5e52
commit
598f093bf0
2 files changed
+46
-3
No files matched your search
@@ -52,9 +52,8 @@ def setup(hass, config):
|
||||
hass.http.register_view(APIComponentsView)
|
||||
hass.http.register_view(APITemplateView)
|
||||
|
||||
log_path = hass.data.get(DATA_LOGGING, None)
|
||||
if log_path:
|
||||
hass.http.register_static_path(URL_API_ERROR_LOG, log_path, False)
|
||||
if DATA_LOGGING in hass.data:
|
||||
hass.http.register_view(APIErrorLog)
|
||||
|
||||
return True
|
||||
|
||||
@@ -356,6 +355,17 @@ class APITemplateView(HomeAssistantView):
|
||||
HTTP_BAD_REQUEST)
|
||||
|
||||
|
||||
class APIErrorLog(HomeAssistantView):
|
||||
"""View to fetch the error log."""
|
||||
|
||||
url = URL_API_ERROR_LOG
|
||||
name = "api:error_log"
|
||||
|
||||
async def get(self, request):
|
||||
"""Retrieve API error log."""
|
||||
return await self.file(request, request.app['hass'].data[DATA_LOGGING])
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_services_json(hass):
|
||||
"""Generate services data to JSONify."""
|
||||
|
||||
Reference in new issue
Block a user