| 
					
				 | 
			
			
				@@ -4,22 +4,19 @@ import os.path 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import sys 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import threading 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if getattr(sys, 'frozen', False): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 打包后的 exe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    os.chdir(os.path.dirname(sys.executable)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 普通 Python 脚本 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    os.chdir(os.path.dirname(os.path.abspath(__file__))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from config import dl_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from core.api_app import start_flask 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from core.monitor_file import start_watchdog 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from tools.logger_handle import logger 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from tools.serve_client import ServerClient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-# 初始化 Flask 应用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-# 初始化桌面通知工具 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-# 存储文档内容和推荐内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-current_text = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-recommendation = "这是默认推荐内容" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 def ApplicationInstance(func): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @functools.wraps(func) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -51,19 +48,19 @@ def start_all_services(serve_client, work_path): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if __name__ == "__main__": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    def set_working_directory(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if getattr(sys, 'frozen', False): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 打包后的 exe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            os.chdir(os.path.dirname(sys.executable)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            # 普通 Python 脚本 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            os.chdir(os.path.dirname(os.path.abspath(__file__))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if not os.path.exists(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json'): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logger.error('"config.json" is not find') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sys.exit(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     with open(f'{dl_code}:\\ProgramData\\OfficeAssistant\\config.json', 'r', encoding='utf-8') as f: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    # with open(f'config.json', 'r', encoding='utf-8') as f: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # with open(f'config.json', 'r', encoding='utf-8') as f: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         args = json.load(f) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if not (args.get('server') and args.get('username') and args.get('password')): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logger.error('The config is missing critical information') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sys.exit(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     client = ServerClient(args['server'], args['username'], args['password']) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if not os.path.exists(os.path.join(args['worker_path'], args['username'])): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         os.makedirs(os.path.join(args['worker_path'], args['username'])) 
			 |