Make webui return correct mimetypes for css and js files.

This commit is contained in:
comfyanonymous 2023-01-24 20:18:16 -05:00
parent 463d0d0828
commit b9308407b2

View File

@ -294,6 +294,11 @@ class PromptServer(BaseHTTPRequestHandler):
out[x] = info
self.wfile.write(json.dumps(out).encode('utf-8'))
elif self.path[1:] in os.listdir(self.server.server_dir):
if self.path[1:].endswith('.css'):
self._set_headers(ct='text/css')
elif self.path[1:].endswith('.js'):
self._set_headers(ct='text/javascript')
else:
self._set_headers()
with open(os.path.join(self.server.server_dir, self.path[1:]), "rb") as f:
self.wfile.write(f.read())