mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-16 13:46:31 +00:00
New panel (#326)
* Update __init__.py * Update __init__.py * Update __init__.py * Update __init__.py
This commit is contained in:
parent
7257c44d27
commit
7a02777cfb
@ -166,15 +166,24 @@ class RestAPI(CoreSysAttributes):
|
|||||||
def create_panel_response(build_type):
|
def create_panel_response(build_type):
|
||||||
"""Create a function to generate a response."""
|
"""Create a function to generate a response."""
|
||||||
path = Path(__file__).parent.joinpath(
|
path = Path(__file__).parent.joinpath(
|
||||||
'panel/hassio-main-{}.html'.format(build_type))
|
f"panel/{build_type}.html")
|
||||||
|
|
||||||
return lambda request: web.FileResponse(path)
|
return lambda request: web.FileResponse(path)
|
||||||
|
|
||||||
# This route is for backwards compatibility with HA < 0.58
|
# 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(
|
self.webapp.router.add_get(
|
||||||
'/panel_latest', create_panel_response('latest'))
|
'/panel', create_panel_response('hassio-main-es5'))
|
||||||
|
|
||||||
|
# This route is for backwards compatibility with HA 0.58 - 0.61
|
||||||
|
self.webapp.router.add_get(
|
||||||
|
'/panel_es5', create_panel_response('hassio-main-es5'))
|
||||||
|
self.webapp.router.add_get(
|
||||||
|
'/panel_latest', create_panel_response('hassio-main-latest'))
|
||||||
|
|
||||||
|
# This route is for HA > 0.61
|
||||||
|
self.webapp.router.add_get(
|
||||||
|
'/app-es5/index.html', create_panel_response('index'))
|
||||||
|
self.webapp.router.add_get(
|
||||||
|
'/app-es5/hassio-app.html', create_panel_response('hassio-app'))
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
"""Run rest api webserver."""
|
"""Run rest api webserver."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user