mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-07 00:16:57 +08:00
feat(security): add cache to wallpaper endpoints to mitigate attacks
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from cachetools import TTLCache, cached
|
||||||
|
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
|
|
||||||
|
|
||||||
@@ -73,6 +75,7 @@ class WebUtils:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
||||||
def get_bing_wallpaper() -> Optional[str]:
|
def get_bing_wallpaper() -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
获取Bing每日壁纸
|
获取Bing每日壁纸
|
||||||
@@ -90,6 +93,7 @@ class WebUtils:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
||||||
def get_bing_wallpapers(num: int = 7) -> Optional[str]:
|
def get_bing_wallpapers(num: int = 7) -> Optional[str]:
|
||||||
"""
|
"""
|
||||||
获取7天的Bing每日壁纸
|
获取7天的Bing每日壁纸
|
||||||
|
|||||||
Reference in New Issue
Block a user