更新启动文件
This commit is contained in:
		
							
								
								
									
										20
									
								
								routers/webhook.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								routers/webhook.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
import os
 | 
			
		||||
from fastapi import APIRouter
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
router = APIRouter()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# 获取标准原尺寸图
 | 
			
		||||
@router.get("", summary="webhook", description="自动更新")
 | 
			
		||||
def webhook():
 | 
			
		||||
    print("webhook")
 | 
			
		||||
    
 | 
			
		||||
    # 执行 Bash 命令
 | 
			
		||||
    exit_code = os.system('git pull')
 | 
			
		||||
    print('Exit code:', exit_code)
 | 
			
		||||
 | 
			
		||||
    exit_code = os.system('npm restart reverse-5002')
 | 
			
		||||
    print('Exit code:', exit_code)
 | 
			
		||||
 | 
			
		||||
    return {"code": 200, "msg": "success"}
 | 
			
		||||
		Reference in New Issue
	
	Block a user