From 6bed5fb76dd4481e617f588d80731559f741207d Mon Sep 17 00:00:00 2001 From: Orion Date: Tue, 21 Jul 2026 17:33:11 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E2=9A=A1=20=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E5=B9=B6=E5=85=BC=E5=AE=B9=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E8=B5=84=E6=BA=90=E8=B7=AF=E5=BE=84"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f093a8ac6d91114d184ce8fc218efa3b6fce5a6d. --- main.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main.py b/main.py index be6c74a..67fc1b1 100644 --- a/main.py +++ b/main.py @@ -10,7 +10,6 @@ from contextlib import asynccontextmanager from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import FileResponse, HTMLResponse, PlainTextResponse -from starlette.middleware.gzip import GZipMiddleware from tortoise import Tortoise from tortoise.contrib.fastapi import register_tortoise @@ -121,8 +120,6 @@ async def migrate_password_to_hash(): app = FastAPI(lifespan=lifespan) -app.add_middleware(GZipMiddleware, minimum_size=1024, compresslevel=6) - @app.middleware("http") async def refresh_settings_middleware(request, call_next): await refresh_settings() @@ -154,11 +151,8 @@ app.include_router(admin_api) @app.get("/theme-assets/{asset_path:path}") @app.get("/assets/{asset_path:path}") async def theme_asset(asset_path: str): - # Vite with base=/theme-assets/ emits /theme-assets/assets/ while - # legacy themes use /theme-assets/. Keep both forms compatible. - normalized_asset_path = asset_path.removeprefix("assets/") theme_assets = (BASE_DIR / settings.themesSelect / "assets").resolve() - target = (theme_assets / normalized_asset_path).resolve() + target = (theme_assets / asset_path).resolve() try: target.relative_to(theme_assets) except ValueError: