Redirection to the bundled web-ui in the root handler

pull/1763/head
grossmj 4 years ago
parent 0a77233631
commit 91a1c5db49

@ -33,17 +33,7 @@ class IndexHandler:
)
async def index(request, response):
#FIXME: this could probably be handled in a better way
static = get_resource(os.path.join('static', 'web-ui', 'index.html'))
print(static)
# guesstype prefers to have text/html type than application/javascript
# which results with warnings in Firefox 66 on Windows
# Ref. gns3-server#1559
_, ext = os.path.splitext(static)
mimetype = ext == '.js' and 'application/javascript' or None
await response.stream_file(static, status=200, set_content_type=mimetype)
raise aiohttp.web.HTTPFound(location="/static/web-ui/bundled")
@Route.get(
r"/debug",

@ -200,6 +200,10 @@ class Route(object):
response = Response(request=request, route=route)
response.set_status(e.status)
response.json({"message": e.text, "status": e.status, "path": route, "request": request.json, "method": request.method})
except aiohttp.web.HTTPFound as e:
response = Response(request=request, route=route)
response.set_status(e.status)
raise # must raise to let aiohttp know about the redirection
except aiohttp.web.HTTPException as e:
response = Response(request=request, route=route)
response.set_status(e.status)

Loading…
Cancel
Save