From 9ef1f56ea1290ee3abe4674c0d332480f0076527 Mon Sep 17 00:00:00 2001 From: InfinityPacer <160988576+InfinityPacer@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:21:00 +0800 Subject: [PATCH] feat(cache): add proxy support for specific domains in image caching --- app/api/endpoints/system.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/endpoints/system.py b/app/api/endpoints/system.py index 909e4653..62776774 100644 --- a/app/api/endpoints/system.py +++ b/app/api/endpoints/system.py @@ -159,7 +159,8 @@ def cache_img( 本地缓存图片文件,支持 HTTP 缓存,如果启用全局图片缓存,则使用磁盘缓存 """ # 如果没有启用全局图片缓存,则不使用磁盘缓存 - return fetch_image(url=url, proxy=False, use_disk_cache=settings.GLOBAL_IMAGE_CACHE, if_none_match=if_none_match) + proxy = "doubanio.com" not in url + return fetch_image(url=url, proxy=proxy, use_disk_cache=settings.GLOBAL_IMAGE_CACHE, if_none_match=if_none_match) @router.get("/global", summary="查询非敏感系统设置", response_model=schemas.Response)