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.
This commit is contained in:
JeLuF 2023-03-14 18:49:31 +01:00
parent 24b631500a
commit 7af620f66e

View File

@ -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",