mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
feat(endpoints): run scheduler through api by token
This commit is contained in:
@@ -12,7 +12,7 @@ from app.chain.search import SearchChain
|
|||||||
from app.chain.system import SystemChain
|
from app.chain.system import SystemChain
|
||||||
from app.core.config import settings, global_vars
|
from app.core.config import settings, global_vars
|
||||||
from app.core.module import ModuleManager
|
from app.core.module import ModuleManager
|
||||||
from app.core.security import verify_token, verify_uri_token
|
from app.core.security import verify_token, verify_uri_token, verify_apitoken
|
||||||
from app.db.models import User
|
from app.db.models import User
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.db.user_oper import get_current_active_superuser
|
from app.db.user_oper import get_current_active_superuser
|
||||||
@@ -365,3 +365,15 @@ def run_scheduler(jobid: str,
|
|||||||
return schemas.Response(success=False, message="命令不能为空!")
|
return schemas.Response(success=False, message="命令不能为空!")
|
||||||
Scheduler().start(jobid)
|
Scheduler().start(jobid)
|
||||||
return schemas.Response(success=True)
|
return schemas.Response(success=True)
|
||||||
|
|
||||||
|
@router.get("/runscheduler2", summary="运行服务(API_TOKEN)", response_model=schemas.Response)
|
||||||
|
def run_scheduler2(jobid: str,
|
||||||
|
_: str = Depends(verify_apitoken)):
|
||||||
|
"""
|
||||||
|
执行命令(API_TOKEN认证)
|
||||||
|
"""
|
||||||
|
if not jobid:
|
||||||
|
return schemas.Response(success=False, message="命令不能为空!")
|
||||||
|
|
||||||
|
Scheduler().start(jobid)
|
||||||
|
return schemas.Response(success=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user