dukuisong 6 ساعت پیش
والد
کامیت
9352a8eb33
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 3 3
      api/api_app.py
  2. 2 1
      dpi_test.py

+ 3 - 3
api/api_app.py

@@ -128,7 +128,7 @@ def open_file_by_wps(file_path):
     if not os.path.exists(file_path):
         return jsonify({'code': 3006, 'msg': '文件不存在'})
 
-    subprocess.run([file_type_map[ext], file_path])
+    subprocess.run(['sudo', file_type_map[ext], file_path])
 
     return jsonify({'code': 1000, 'msg': '操作完成'})
 
@@ -358,9 +358,9 @@ def refresh_token():
 
 
 @logger.catch()
-@app.route('/get_yozo_path', methods=['POST'])
+@app.route('/get_yozo_path', methods=['GET'])
 def get_yozo_path():
-    yozo_path = os.path.basename(os.path.basename(config.yozoc))
+    yozo_path = os.path.dirname(os.path.dirname(config.yozoc))
     return jsonify({'code': 1000, 'msg': '操作成功', 'data': yozo_path})
 
 

+ 2 - 1
dpi_test.py

@@ -27,6 +27,7 @@ def get_xrandr_scale() -> float:
     """
     try:
         output = subprocess.check_output(['xrandr'], universal_newlines=True)
+        print(output)
         match_res = re.search(r'current (\d+) x (\d+)', output)
         match_phys = re.search(r'(\d+)mm x (\d+)mm', output)
         if match_res and match_phys:
@@ -44,7 +45,7 @@ def get_display_scale() -> float:
     """
     自动检测 Ubuntu 桌面显示缩放比例(支持 GNOME、X11)
     """
-    scale = get_gnome_scale()
+    scale = get_xrandr_scale()
     if scale == 1.0:
         scale = get_xrandr_scale()
     return scale