mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-07-10 23:12:25 +08:00
feat(frontend): 新增多版本笔记功能,并做了向下兼容。
- 新增关于页面组件,介绍项目背景、功能和使用方法 - 重构笔记生成逻辑,支持多版本笔记 - 新增笔记版本选择、复制和导出功能 -优化笔记界面布局和交互 - 调整部分组件样式,提升用户体验
This commit is contained in:
@@ -217,17 +217,25 @@ def get_task_status(task_id: str):
|
||||
@router.get("/image_proxy")
|
||||
async def image_proxy(request: Request, url: str):
|
||||
headers = {
|
||||
"Referer": "https://www.bilibili.com/", # 模拟B站来源
|
||||
"Referer": "https://www.bilibili.com/",
|
||||
"User-Agent": request.headers.get("User-Agent", ""),
|
||||
}
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
resp = await client.get(url, headers=headers)
|
||||
|
||||
if resp.status_code != 200:
|
||||
raise HTTPException(status_code=resp.status_code, detail="图片获取失败")
|
||||
|
||||
content_type = resp.headers.get("Content-Type", "image/jpeg")
|
||||
return StreamingResponse(resp.aiter_bytes(), media_type=content_type)
|
||||
return StreamingResponse(
|
||||
resp.aiter_bytes(),
|
||||
media_type=content_type,
|
||||
headers={
|
||||
"Cache-Control": "public, max-age=86400", # ✅ 缓存一天
|
||||
"Content-Type": content_type,
|
||||
}
|
||||
)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
Reference in New Issue
Block a user