mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-06-27 20:36:30 +00:00
Hassio panel split (#249)
* Allow serving two types of panels * Remove old panel * Make backwards compatible * Add comment
This commit is contained in:
parent
893a5f8dd3
commit
ce9c3565b6
@ -139,13 +139,18 @@ class RestAPI(object):
|
||||
|
||||
def register_panel(self):
|
||||
"""Register panel for homeassistant."""
|
||||
panel = Path(__file__).parents[1].joinpath('panel/hassio-main.html')
|
||||
def create_panel_response(build_type):
|
||||
"""Create a function to generate a response."""
|
||||
path = Path(__file__).parents[1].joinpath(
|
||||
'panel/hassio-main-{}.html'.format(build_type))
|
||||
|
||||
def get_panel(request):
|
||||
"""Return file response with panel."""
|
||||
return web.FileResponse(panel)
|
||||
return lambda request: web.FileResponse(path)
|
||||
|
||||
self.webapp.router.add_get('/panel', get_panel)
|
||||
# This route is for backwards compatibility with HA < 0.58
|
||||
self.webapp.router.add_get('/panel', create_panel_response('es5'))
|
||||
self.webapp.router.add_get('/panel_es5', create_panel_response('es5'))
|
||||
self.webapp.router.add_get(
|
||||
'/panel_latest', create_panel_response('latest'))
|
||||
|
||||
async def start(self):
|
||||
"""Run rest api webserver."""
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user