VLC updates, and some infra bugs fix

This commit is contained in:
Timothyxxx
2024-01-09 09:30:11 +08:00
parent 2b09b7ce41
commit fa84b20ea5
13 changed files with 278 additions and 71 deletions

View File

@@ -1,15 +1,15 @@
import os
from pathlib import Path
import platform
import subprocess
import requests
from .pyxcursor import Xcursor
# import Xlib.display
from pathlib import Path
from typing import List
import pyautogui
# from PIL import ImageGrab, Image
import requests
from PIL import Image
from flask import Flask, request, jsonify, send_file
from typing import List
from pyxcursor import Xcursor
app = Flask(__name__)
@@ -18,6 +18,7 @@ pyautogui.DARWIN_CATCH_UP_TIME = 0
logger = app.logger
@app.route('/setup/execute', methods=['POST'])
@app.route('/execute', methods=['POST'])
def execute_command():
@@ -40,6 +41,7 @@ def execute_command():
'message': str(e)
}), 500
@app.route('/setup/launch', methods=["POST"])
def launch_app():
data = request.json
@@ -49,11 +51,7 @@ def launch_app():
subprocess.Popen(command)
return "{:} launched successfully".format(" ".join(command))
except Exception as e:
return jsonify( { "status": "error"
, "message": str(e)
}
)\
, 500
return jsonify({"status": "error", "message": str(e)}), 500
@app.route('/screenshot', methods=['GET'])
@@ -116,6 +114,7 @@ def get_file():
# If the file is not found, return a 404 error
return jsonify({"error": "File not found"}), 404
@app.route("/setup/upload", methods=["POST"])
def upload_file():
# Retrieve filename from the POST request
@@ -127,6 +126,7 @@ def upload_file():
else:
return jsonify({"error": "file_path and file_data are required"}), 400
@app.route('/platform', methods=['GET'])
def get_platform():
return platform.system()