add 插件API
This commit is contained in:
25
app/api/endpoints/plugin.py
Normal file
25
app/api/endpoints/plugin.py
Normal file
@ -0,0 +1,25 @@
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from app import schemas
|
||||
from app.core.plugin import PluginManager
|
||||
from app.db.models.user import User
|
||||
from app.db.userauth import get_current_active_user
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/", response_model=schemas.Response)
|
||||
@router.post("/")
|
||||
async def run_plugin_method(plugin_id: str, method: str,
|
||||
_: User = Depends(get_current_active_user),
|
||||
*args,
|
||||
**kwargs) -> Any:
|
||||
"""
|
||||
运行插件方法
|
||||
"""
|
||||
return PluginManager().run_plugin_method(pid=plugin_id,
|
||||
method=method,
|
||||
*args,
|
||||
**kwargs)
|
Reference in New Issue
Block a user