From 52ef3904644a4d88b14a0518a9a0252d4d0c49bf Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 3 Jul 2025 17:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=BB=A3=E7=90=86Api?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0cache=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/system.py | 3 ++- app/modules/filemanager/storages/local.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/api/endpoints/system.py b/app/api/endpoints/system.py index e6597a7b..7c9f2dfb 100644 --- a/app/api/endpoints/system.py +++ b/app/api/endpoints/system.py @@ -144,6 +144,7 @@ def fetch_image( def proxy_img( imgurl: str, proxy: bool = False, + cache: bool = False, if_none_match: Annotated[str | None, Header()] = None, _: schemas.TokenPayload = Depends(verify_resource_token) ) -> Response: @@ -154,7 +155,7 @@ def proxy_img( hosts = [config.config.get("host") for config in MediaServerHelper().get_configs().values() if config and config.config and config.config.get("host")] allowed_domains = set(settings.SECURITY_IMAGE_DOMAINS) | set(hosts) - return fetch_image(url=imgurl, proxy=proxy, use_disk_cache=False, + return fetch_image(url=imgurl, proxy=proxy, use_disk_cache=cache, if_none_match=if_none_match, allowed_domains=allowed_domains) diff --git a/app/modules/filemanager/storages/local.py b/app/modules/filemanager/storages/local.py index 8467dbb0..f4078273 100644 --- a/app/modules/filemanager/storages/local.py +++ b/app/modules/filemanager/storages/local.py @@ -191,8 +191,8 @@ class LocalStorage(StorageBase): """ return Path(fileitem.path) - def upload(self, fileitem: schemas.FileItem, path: Path, new_name: Optional[str] = None) -> Optional[ - schemas.FileItem]: + def upload(self, fileitem: schemas.FileItem, path: Path, + new_name: Optional[str] = None) -> Optional[schemas.FileItem]: """ 上传文件 :param fileitem: 上传目录项