mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
fix(api): 适配 FastAPI 请求参数兼容性问题
修复系统配置和用户配置接口无法正常工作的问题。
This commit is contained in:
@@ -11,7 +11,7 @@ from typing import Optional, Union, Annotated
|
|||||||
import aiofiles
|
import aiofiles
|
||||||
import pillow_avif # noqa 用于自动注册AVIF支持
|
import pillow_avif # noqa 用于自动注册AVIF支持
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Header, Request, Response
|
from fastapi import APIRouter, Body, Depends, HTTPException, Header, Request, Response
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
|
|
||||||
from app import schemas
|
from app import schemas
|
||||||
@@ -288,8 +288,11 @@ def get_setting(key: str,
|
|||||||
|
|
||||||
|
|
||||||
@router.post("/setting/{key}", summary="更新系统设置", response_model=schemas.Response)
|
@router.post("/setting/{key}", summary="更新系统设置", response_model=schemas.Response)
|
||||||
def set_setting(key: str, value: Union[list, dict, bool, int, str] = None,
|
def set_setting(
|
||||||
_: User = Depends(get_current_active_superuser)):
|
key: str,
|
||||||
|
value: Annotated[Union[list, dict, bool, int, str] | None, Body()] = None,
|
||||||
|
_: User = Depends(get_current_active_superuser),
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
更新系统设置(仅管理员)
|
更新系统设置(仅管理员)
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import base64
|
import base64
|
||||||
import re
|
import re
|
||||||
from typing import Any, List, Union
|
from typing import Annotated, Any, List, Union
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, UploadFile, File
|
from fastapi import APIRouter, Body, Depends, HTTPException, UploadFile, File
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app import schemas
|
from app import schemas
|
||||||
@@ -164,8 +164,11 @@ def get_config(key: str,
|
|||||||
|
|
||||||
|
|
||||||
@router.post("/config/{key}", summary="更新用户配置", response_model=schemas.Response)
|
@router.post("/config/{key}", summary="更新用户配置", response_model=schemas.Response)
|
||||||
def set_config(key: str, value: Union[list, dict, bool, int, str] = None,
|
def set_config(
|
||||||
current_user: User = Depends(get_current_active_user)):
|
key: str,
|
||||||
|
value: Annotated[Union[list, dict, bool, int, str] | None, Body()] = None,
|
||||||
|
current_user: User = Depends(get_current_active_user),
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
更新用户配置
|
更新用户配置
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user