Browse Source

code update

dukuisong 15 hours ago
parent
commit
0402c8be81
7 changed files with 14 additions and 20 deletions
  1. 4 4
      api/ws_app.py
  2. 1 1
      config.py
  3. 4 4
      office_helper.py
  4. 1 1
      static/index.html
  5. BIN
      static/index.html.gz
  6. 0 7
      static/publish.html
  7. 4 3
      tools/serve_client.py

+ 4 - 4
api/ws_app.py

@@ -35,11 +35,11 @@ def on_message(client, server, data):
         file_id = data['params'].get('file_id')
         is_template = data['params'].get('is_template')
         # 判断是否为exe模式执行
-
+        work_path = os.path.join(args['work_path'], args['username'])
         if is_template:
             file_info = server_client.get_template_file_info(file_id)
             time_str = datetime.datetime.now().strftime('%Y-%m-%dT%H-%M-%S')
-            local_path = os.path.join(args['work_path'],
+            local_path = os.path.join(work_path,
                                       f'{file_info["name"]}({time_str}).{file_info["nameSuffix"]}')
 
             if server_client.download_template(file_info['fileLink'], local_path):
@@ -51,11 +51,11 @@ def on_message(client, server, data):
         if not file_info:
             return ws_send(client, server, {'code': 3006, 'msg': '文件不存在'})
         logger.info(f'args:{args}, file_info:{file_info}')
-        local_file = os.path.join(args['work_path'], file_info['filePath'].replace('/', '_'))
+        local_file = os.path.join(work_path, file_info['filePath'].replace('/', '_'))
 
         # 判断本地是否存在已下载的同名文件
         if not os.path.exists(local_file) or not os.path.exists(local_file + '.metadata.json'):
-            server_client.download_file(file_info, args['work_path'])
+            server_client.download_file(file_info, work_path)
 
             return ws_send(client, server, open_file_by_wps(local_file))
 

+ 1 - 1
config.py

@@ -2,7 +2,7 @@ import json
 import os
 import sys
 
-VERSION = '1.2.6'
+VERSION = '1.3.0'
 
 
 dl_code = os.path.realpath(sys.argv[0])[:1]

+ 4 - 4
office_helper.py

@@ -57,9 +57,9 @@ if __name__ == "__main__":
     if not (args.get('username') and args.get('password')):
         logger.error('The config is missing critical information')
         sys.exit(0)
-
-    if not os.path.exists(os.path.join(args['work_path'], args['username'])):
-        os.makedirs(os.path.join(args['work_path'], args['username']))
+    storage_path = os.path.join(args['work_path'], args['username'])
+    if not os.path.exists(storage_path):
+        os.makedirs(storage_path)
     logger.info(f'VERSION: {VERSION}')
 
-    start_all_services(server_client, os.path.join(args['work_path'], args['username']))
+    start_all_services(server_client, storage_path)

+ 1 - 1
static/index.html

@@ -205,7 +205,7 @@
         opacity: 0.5;
       }
     </style>
-    <script type="module" crossorigin src="./assets/index-DSRTbhzc.js"></script>
+    <script type="module" crossorigin src="./assets/index-IGEjQt3_.js"></script>
     <link rel="stylesheet" crossorigin href="./assets/index-CFSY6fn5.css">
   </head>
   <script>

BIN
static/index.html.gz


File diff suppressed because it is too large
+ 0 - 7
static/publish.html


+ 4 - 3
tools/serve_client.py

@@ -54,7 +54,8 @@ class ServerClient:
         messagebox.showerror("登录失败", message)
         root.destroy()
         sys.exit(0)
-    @staticmethod
+
+    # @staticmethod
     def decryption(self, hex_str, secret='anZz000000000000'):
         key_bytes = secret.encode('utf-8')
         iv = key_bytes
@@ -244,7 +245,7 @@ class ServerClient:
         :param file_id:
         :return:
         '''
-        logger.info(self.headers)
+
         try:
             resp = requests.get(f'{self.serve_host}/mgr/document/no/auth/dcLibrary/info/{file_id}',
                                 headers=self.headers)
@@ -259,7 +260,7 @@ class ServerClient:
             return False
 
 
-# server_client = ServerClient(TARGET_URL, args['username'], args['password'])
+server_client = ServerClient(TARGET_URL, args['username'], args['password'])
 
 if __name__ == '__main__':
     res = ServerClient.decryption('97a66be9a6cc923c21dad3bbbd89274ddd414593f56da4681750df7dbdfd2f49fb68a49f4f8193edc33f4854f408aea083604e44da7696950f0fe1ef6a9bb23f82de304dfe921f2d300c79d5acacc687db4b8b34b6d714c9eff8bada97a38baa1eb5f11fd0f19f812a294f120e062c7091f0e28e8adc578e2433b6916d7d414a627bf772ff0cb0af718005a08f2c71dfdb05002000f6ca822c1099199967d7999f6678857f0f06ea68dc5ad390e71746662e2d73bba7e93784f93f5d29a7521d8165419153ff4edb9d79a76f4d92dfcb')

Some files were not shown because too many files changed in this diff