dukuisong 2 tygodni temu
rodzic
commit
a3d732f872
4 zmienionych plików z 34 dodań i 5 usunięć
  1. 27 1
      api/api_app.py
  2. 3 0
      modify_folder/monitor_file.py
  3. 4 4
      office_helper.py
  4. 0 0
      readme.md

+ 27 - 1
api/api_app.py

@@ -339,7 +339,7 @@ def create_cloud_file():
 
 @logger.catch()
 @app.route('/get_folder_tree', methods=['POST'])
-def get_base_path():
+def get_folder_tree():
     res = app.config['serve_client'].get_folder_tree()
     return jsonify(res)
 
@@ -364,6 +364,32 @@ def get_yozo_path():
     return jsonify({'code': 1000, 'msg': '操作成功', 'data': yozo_path})
 
 
+@logger.catch()
+@app.route('/get_yozo_plugin_status', methods=['GET'])
+def get_yozo_plugle_status():
+    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})
+
+
+@logger.catch()
+@app.route('/get_base_path', methods=['GET'])
+def get_base_path():
+
+    return jsonify({'code': 1000, 'msg': 'plugin_status', 'data': config.base_path})
+
+@logger.catch()
+@app.route('/yozo_plugin_monitor', methods=['post'])
+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})
+
+
 @logger.catch()
 @app.route('/download_cloud_file', methods=['POST'])
 def download_cloud_file():

+ 3 - 0
modify_folder/monitor_file.py

@@ -42,6 +42,9 @@ class FileSaveHandler(FileSystemEventHandler):
         if '~$' in event.src_path:
             return
 
+        if event.src_path.endswith('.metadata'):
+            return
+
         if ext not in ['.docx', '.doc', '.ppt', '.pptx', '.xls', '.xlsx']:
             return
 

+ 4 - 4
office_helper.py

@@ -51,11 +51,11 @@ def start_all_services(serve_client, work_path):
 
 if __name__ == "__main__":
 
-    # if not os.path.exists(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json'):
-    #     logger.error('"config.json" is not find')
-    #     sys.exit(0)
+    if not os.path.exists('/opt/ProgramData/OfficeAssistant/config.json'):
+        logger.error('"config.json" is not find')
+        sys.exit(0)
     #
-    with open(f'/ProgramData/OfficeAssistant/config.json', 'r', encoding='utf-8') as f:
+    with open('/opt/ProgramData/OfficeAssistant/config.json', 'r', encoding='utf-8') as f:
     # with open(f'config.json', 'r', encoding='utf-8') as f:
         args = json.load(f)
     args['worker_path'] = args['worker_path'].replace('\\\\', '\\')

+ 0 - 0
readme → readme.md