Jelajahi Sumber

kelin update

dukuisong 16 jam lalu
induk
melakukan
4494d57fbf
3 mengubah file dengan 12 tambahan dan 5 penghapusan
  1. 11 3
      api/api_app.py
  2. 0 1
      office_helper.py
  3. 1 1
      script/install_autostart.sh

+ 11 - 3
api/api_app.py

@@ -385,9 +385,17 @@ def yozo_plugin_monitor():
     option = request.get_json()['option']
     yozo_path = os.path.dirname(os.path.dirname(config.yozoc))
     plugin_path = os.path.join(yozo_path, 'Plugins','yozooffice-jar-with-dependencies.jar')
-
-    flag = os.path.exists(plugin_path)
-    return jsonify({'code': 1000, 'msg': 'plugin_status', 'data': flag})
+    msg = '操作成功'
+    if option == 'install':
+        if os.path.exists(plugin_path):
+            os.remove(plugin_path)
+        os.system(f'cp yozooffice-jar-with-dependencies.jar {plugin_path}')
+    elif option == 'uninstall':
+        if os.path.exists(plugin_path):
+            os.remove(plugin_path)
+            msg = '插件卸载成功'
+
+    return jsonify({'code': 1000, 'msg': msg})
 
 
 @logger.catch()

+ 0 - 1
office_helper.py

@@ -1,5 +1,4 @@
 import functools
-import json
 import os.path
 import sys
 import threading

+ 1 - 1
script/install_autostart.sh

@@ -11,7 +11,7 @@ show_help() {
 }
 
 # 检查参数是否正确
-if [ $# -lt 1 ]; then
+if [ $# -lt 1 ]; thenc
     echo "错误:请提供可执行文件的路径!"
     show_help
     exit 1