mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-20 03:57:30 +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 cachetools import TTLCache, cached
|
||||
|
||||
from app.utils.http import RequestUtils
|
||||
|
||||
|
||||
@@ -73,6 +75,7 @@ class WebUtils:
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
||||
def get_bing_wallpaper() -> Optional[str]:
|
||||
"""
|
||||
获取Bing每日壁纸
|
||||
@@ -90,6 +93,7 @@ class WebUtils:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
@cached(cache=TTLCache(maxsize=1, ttl=3600))
|
||||
def get_bing_wallpapers(num: int = 7) -> Optional[str]:
|
||||
"""
|
||||
获取7天的Bing每日壁纸
|
||||
|
||||
Reference in New Issue
Block a user