Merge branch 'main' into zdy

This commit is contained in:
David Chang
2023-12-25 20:29:20 +08:00
80 changed files with 835 additions and 90 deletions

View File

@@ -4,9 +4,9 @@ import platform
import subprocess
import requests
#import Xlib.display
# import Xlib.display
import pyautogui
#from PIL import ImageGrab, Image
# from PIL import ImageGrab, Image
from PIL import Image
from flask import Flask, request, jsonify, send_file
@@ -47,7 +47,6 @@ def capture_screen_with_cursor():
# Ensure the screenshots directory exists
os.makedirs(os.path.dirname(file_path), exist_ok=True)
# fixme: This is a temporary fix for the cursor not being captured on Windows and Linux
if user_platform == "Windows" or user_platform == "Linux":
def _download_image(url, path):
@@ -191,10 +190,10 @@ def open_file():
return f"File not found: {path}", 404
try:
if platform.system()=="Windows":
if platform.system() == "Windows":
os.startfile(path)
else:
open_cmd: str = "open" if platform.system()=="Darwin" else "xdg-open"
open_cmd: str = "open" if platform.system() == "Darwin" else "xdg-open"
subprocess.Popen([open_cmd, str(path)])
return "File opened successfully"
except Exception as e: