fix webhooks
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Request
|
||||
|
||||
@ -8,11 +9,11 @@ from app.core.config import settings
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
def start_webhook_chain(message: dict):
|
||||
def start_webhook_chain(body: Any, form: Any, args: Any):
|
||||
"""
|
||||
启动链式任务
|
||||
"""
|
||||
WebhookMessageChain().process(message)
|
||||
WebhookMessageChain().process(body=body, form=form, args=args)
|
||||
|
||||
|
||||
@router.post("/", response_model=schemas.Response)
|
||||
@ -22,6 +23,8 @@ async def webhook_message(background_tasks: BackgroundTasks, token: str, request
|
||||
"""
|
||||
if token != settings.API_TOKEN:
|
||||
return {"success": False, "message": "token认证不通过"}
|
||||
|
||||
background_tasks.add_task(start_webhook_chain, await request.json())
|
||||
body = await request.body()
|
||||
form = await request.form()
|
||||
args = request.query_params
|
||||
background_tasks.add_task(start_webhook_chain, body, form, args)
|
||||
return {"success": True}
|
||||
|
Reference in New Issue
Block a user