File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1919from __future__ import annotations
2020
2121import datetime
22+ import subprocess
2223from typing import Dict , Optional , Union
2324
2425import psutil
@@ -241,6 +242,18 @@ async def get_server_stats(request: MystbinRequest):
241242 return UJSONResponse (data , status_code = 200 )
242243
243244
245+ @router .get ("/admin/release_hook" , tags = ["admin" ], include_in_schema = False )
246+ @limit ("admin" )
247+ async def get_server_stats (request : MystbinRequest ):
248+ if not request .state .user or not request .state .user ["admin" ]:
249+ return UJSONResponse ({"error" : "Unauthorized" }, status_code = 401 )
250+
251+ command = 'cd /root/MystBin/; git pull;'
252+ subprocess .run (command , stdout = subprocess .PIPE , shell = True )
253+
254+ return UJSONResponse (data , status_code = 200 )
255+
256+
244257@router .get (
245258 "/admin/pastes/{paste_id}" ,
246259 tags = ["admin" ],
You can’t perform that action at this time.
0 commit comments