From 501d530d1dab669a5d71258a7b19c2b6c7620655 Mon Sep 17 00:00:00 2001 From: stkevintan Date: Sun, 21 Dec 2025 23:07:35 +0800 Subject: [PATCH 1/2] cookiecloud: support download encrypted data using post --- app/api/servcookie.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/api/servcookie.py b/app/api/servcookie.py index fbd6535b..fbaae376 100644 --- a/app/api/servcookie.py +++ b/app/api/servcookie.py @@ -4,7 +4,7 @@ from typing import Annotated, Callable, Any, Dict, Optional import aiofiles from anyio import Path as AsyncPath -from fastapi import APIRouter, Depends, HTTPException, Path, Request, Response +from fastapi import APIRouter, Body, Depends, HTTPException, Path, Request, Response from fastapi.responses import PlainTextResponse from fastapi.routing import APIRoute @@ -127,10 +127,14 @@ async def get_cookie( @cookie_router.post("/get/{uuid}") async def post_cookie( - uuid: Annotated[str, Path(min_length=5, pattern="^[a-zA-Z0-9]+$")], - request: schemas.CookiePassword): + uuid: Annotated[str, Path(min_length=5, pattern="^[a-zA-Z0-9]+$")], + request: Optional[schemas.CookiePassword] = Body(None) +): """ POST 下载加密数据 """ data = await load_encrypt_data(uuid) - return get_decrypted_cookie_data(uuid, request.password, data["encrypted"]) + if request is not None: + return get_decrypted_cookie_data(uuid, request.password, data["encrypted"]) + else: + return data \ No newline at end of file From 2c849cfa7acfe80ae252caeeef90c652710e6ce8 Mon Sep 17 00:00:00 2001 From: stkevintan Date: Mon, 22 Dec 2025 08:33:23 +0800 Subject: [PATCH 2/2] fix code style --- app/api/servcookie.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/api/servcookie.py b/app/api/servcookie.py index fbaae376..f4ee0010 100644 --- a/app/api/servcookie.py +++ b/app/api/servcookie.py @@ -127,9 +127,8 @@ async def get_cookie( @cookie_router.post("/get/{uuid}") async def post_cookie( - uuid: Annotated[str, Path(min_length=5, pattern="^[a-zA-Z0-9]+$")], - request: Optional[schemas.CookiePassword] = Body(None) -): + uuid: Annotated[str, Path(min_length=5, pattern="^[a-zA-Z0-9]+$")], + request: Optional[schemas.CookiePassword] = Body(None)): """ POST 下载加密数据 """ @@ -137,4 +136,4 @@ async def post_cookie( if request is not None: return get_decrypted_cookie_data(uuid, request.password, data["encrypted"]) else: - return data \ No newline at end of file + return data