Unverified Commit 8e51af67 authored by pythongosssss's avatar pythongosssss Committed by GitHub
Browse files

Changed to serve index.html on root

parent 540bbbdb
...@@ -409,6 +409,7 @@ class PromptServer(): ...@@ -409,6 +409,7 @@ class PromptServer():
self.socket_handler = socket_handler self.socket_handler = socket_handler
self.number = 0 self.number = 0
self.app = web.Application() self.app = web.Application()
self.web_root = os.path.join(os.path.dirname(os.path.realpath(__file__)), "webshit")
routes = web.RouteTableDef() routes = web.RouteTableDef()
@routes.get('/ws') @routes.get('/ws')
...@@ -417,7 +418,7 @@ class PromptServer(): ...@@ -417,7 +418,7 @@ class PromptServer():
@routes.get("/") @routes.get("/")
async def get_root(request): async def get_root(request):
return aiohttp.web.HTTPFound('/index.html') return web.FileResponse(os.path.join(self.web_root, "index.html"))
@routes.get("/prompt") @routes.get("/prompt")
async def get_prompt(request): async def get_prompt(request):
...@@ -494,7 +495,7 @@ class PromptServer(): ...@@ -494,7 +495,7 @@ class PromptServer():
self.app.add_routes(routes) self.app.add_routes(routes)
self.app.add_routes([ self.app.add_routes([
web.static('/', os.path.join(os.path.dirname(os.path.realpath(__file__)), "webshit")), web.static('/', self.web_root),
]) ])
async def start_server(server, address, port): async def start_server(server, address, port):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment