From 7af620f66eea815c36e2363f703eaff251f158ce Mon Sep 17 00:00:00 2001 From: JeLuF Date: Tue, 14 Mar 2023 18:49:31 +0100 Subject: [PATCH] Hardcode CSS content type By default, uvicorn uses the 'Content Type' value from 'Computer\HKEY_CLASSES_ROOT\.css' for the Content-Type header in its responses. Some systems have this set to 'application/x-css', an outdated content type used in the early days of CSS. Modern browsers ignore stylesheets that don't have the content-type 'text/css'. This change hardcodes the Content-Type to 'text/css', ignoring the registry. --- ui/easydiffusion/server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/easydiffusion/server.py b/ui/easydiffusion/server.py index 77abd41f..1d05a1f0 100644 --- a/ui/easydiffusion/server.py +++ b/ui/easydiffusion/server.py @@ -16,6 +16,8 @@ from easydiffusion import app, model_manager, task_manager from easydiffusion.types import TaskData, GenerateImageRequest, MergeRequest from easydiffusion.utils import log +import mimetypes + log.info(f"started in {app.SD_DIR}") log.info(f"started at {datetime.datetime.now():%x %X}") @@ -52,6 +54,9 @@ class SetAppConfigRequest(BaseModel): def init(): + mimetypes.init() + mimetypes.add_type('text/css', '.css') + if os.path.isdir(app.CUSTOM_MODIFIERS_DIR): server_api.mount( "/media/modifier-thumbnails/custom",