ver Jan31st
merged from main to zdy
This commit is contained in:
@@ -56,6 +56,12 @@ def execute_command():
|
||||
if isinstance(command, str) and not shell:
|
||||
command = shlex.split(command)
|
||||
|
||||
# WARNING: auto expansion should be completed by set `shell=True` and use str as `command`
|
||||
# Expand user directory
|
||||
for i, arg in enumerate(command):
|
||||
if arg.startswith("~/"):
|
||||
command[i] = os.path.expanduser(arg)
|
||||
|
||||
# Execute the command without any safety checks.
|
||||
try:
|
||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, text=True)
|
||||
@@ -93,6 +99,12 @@ def launch_app():
|
||||
if isinstance(command, str) and not shell:
|
||||
command = shlex.split(command)
|
||||
|
||||
# WARNING: auto expansion should be completed by set `shell=True` and use str as `command`
|
||||
# Expand user directory
|
||||
for i, arg in enumerate(command):
|
||||
if arg.startswith("~/"):
|
||||
command[i] = os.path.expanduser(arg)
|
||||
|
||||
try:
|
||||
if 'google-chrome' in command and _get_machine_architecture() == 'arm':
|
||||
index = command.index('google-chrome')
|
||||
@@ -177,8 +189,9 @@ def get_terminal_output():
|
||||
# raise NotImplementedError
|
||||
return "Currently not implemented for platform {:}.".format(platform.platform()), 500
|
||||
return jsonify({"output": output, "status": "success"})
|
||||
except:
|
||||
return jsonify({"output": None, "status": "error"})
|
||||
except Exception as e:
|
||||
logger.error("Failed to get terminal output. Error: %s", e)
|
||||
return jsonify({"status": "error", "message": str(e)}), 500
|
||||
|
||||
|
||||
_accessibility_ns_map = { "st": "uri:deskat:state.at-spi.gnome.org"
|
||||
@@ -806,6 +819,8 @@ def download_file():
|
||||
data = request.json
|
||||
url = data.get('url', None)
|
||||
path = data.get('path', None)
|
||||
print(url, path)
|
||||
print("*" * 100)
|
||||
|
||||
if not url or not path:
|
||||
return "Path or URL not supplied!", 400
|
||||
|
||||
Reference in New Issue
Block a user