File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 33import json
44import logging
55import os
6+ import shlex
67import shutil
78import subprocess
89import time
@@ -70,6 +71,20 @@ async def command_host(command: str, i_know_what_i_am_doing: bool = False) -> An
7071 return message
7172
7273
74+ @app .post ("/command/blueos" , status_code = status .HTTP_200_OK )
75+ @version (1 , 0 )
76+ async def command_blueos (command : str , i_know_what_i_am_doing : bool = False ) -> Any :
77+ check_what_i_am_doing (i_know_what_i_am_doing )
78+ logger .debug (f"Running command: { command } " )
79+ return subprocess .run (
80+ shlex .split (command ),
81+ check = False ,
82+ text = True ,
83+ stdout = subprocess .PIPE ,
84+ stderr = subprocess .PIPE ,
85+ )
86+
87+
7388@app .post ("/set_time" , status_code = status .HTTP_200_OK )
7489@version (1 , 0 )
7590async def set_time (unix_time_seconds : int , i_know_what_i_am_doing : bool = False ) -> Any :
You can’t perform that action at this time.
0 commit comments