feat: 新增获取Sentinel Token及POW代理配置

This commit is contained in:
TheSmallHanCat
2026-01-28 20:58:40 +08:00
parent 5570fa35a6
commit 92015882cc
8 changed files with 481 additions and 61 deletions

View File

@@ -167,6 +167,10 @@ class UpdateCallLogicConfigRequest(BaseModel):
call_mode: Optional[str] = None # "default" or "polling"
polling_mode_enabled: Optional[bool] = None # Legacy support
class UpdatePowProxyConfigRequest(BaseModel):
pow_proxy_enabled: bool
pow_proxy_url: Optional[str] = None
class BatchDisableRequest(BaseModel):
token_ids: List[int]
@@ -1369,6 +1373,36 @@ async def update_call_logic_config(
except Exception as e:
raise HTTPException(status_code=500, detail=f"Failed to update call logic configuration: {str(e)}")
# POW proxy config endpoints
@router.get("/api/pow-proxy/config")
async def get_pow_proxy_config(token: str = Depends(verify_admin_token)) -> dict:
"""Get POW proxy configuration"""
config_obj = await db.get_pow_proxy_config()
return {
"success": True,
"config": {
"pow_proxy_enabled": config_obj.pow_proxy_enabled,
"pow_proxy_url": config_obj.pow_proxy_url or ""
}
}
@router.post("/api/pow-proxy/config")
async def update_pow_proxy_config(
request: UpdatePowProxyConfigRequest,
token: str = Depends(verify_admin_token)
):
"""Update POW proxy configuration"""
try:
await db.update_pow_proxy_config(request.pow_proxy_enabled, request.pow_proxy_url)
config.set_pow_proxy_enabled(request.pow_proxy_enabled)
config.set_pow_proxy_url(request.pow_proxy_url or "")
return {
"success": True,
"message": "POW proxy configuration updated"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"Failed to update POW proxy configuration: {str(e)}")
# Task management endpoints
@router.post("/api/tasks/{task_id}/cancel")
async def cancel_task(task_id: str, token: str = Depends(verify_admin_token)):