mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
图片代理Api增加cache参数
This commit is contained in:
@@ -144,6 +144,7 @@ def fetch_image(
|
|||||||
def proxy_img(
|
def proxy_img(
|
||||||
imgurl: str,
|
imgurl: str,
|
||||||
proxy: bool = False,
|
proxy: bool = False,
|
||||||
|
cache: bool = False,
|
||||||
if_none_match: Annotated[str | None, Header()] = None,
|
if_none_match: Annotated[str | None, Header()] = None,
|
||||||
_: schemas.TokenPayload = Depends(verify_resource_token)
|
_: schemas.TokenPayload = Depends(verify_resource_token)
|
||||||
) -> Response:
|
) -> Response:
|
||||||
@@ -154,7 +155,7 @@ def proxy_img(
|
|||||||
hosts = [config.config.get("host") for config in MediaServerHelper().get_configs().values() if
|
hosts = [config.config.get("host") for config in MediaServerHelper().get_configs().values() if
|
||||||
config and config.config and config.config.get("host")]
|
config and config.config and config.config.get("host")]
|
||||||
allowed_domains = set(settings.SECURITY_IMAGE_DOMAINS) | set(hosts)
|
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)
|
if_none_match=if_none_match, allowed_domains=allowed_domains)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -191,8 +191,8 @@ class LocalStorage(StorageBase):
|
|||||||
"""
|
"""
|
||||||
return Path(fileitem.path)
|
return Path(fileitem.path)
|
||||||
|
|
||||||
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: Optional[str] = None) -> Optional[
|
def upload(self, fileitem: schemas.FileItem, path: Path,
|
||||||
schemas.FileItem]:
|
new_name: Optional[str] = None) -> Optional[schemas.FileItem]:
|
||||||
"""
|
"""
|
||||||
上传文件
|
上传文件
|
||||||
:param fileitem: 上传目录项
|
:param fileitem: 上传目录项
|
||||||
|
|||||||
Reference in New Issue
Block a user