diff --git a/backend/config.ini b/backend/config.ini index 503a95bf6feb0889b94e32869954ca8a200723b3..9c926ed4fa6360c5e301d8384fd5661c70e4eb67 100644 --- a/backend/config.ini +++ b/backend/config.ini @@ -21,4 +21,4 @@ backup_dir = backup evueapps_dir = evueapps launcher_dir = launcher host = 127.0.0.1 -port = 5000 \ No newline at end of file +port = 5001 \ No newline at end of file diff --git a/backend/controller/apps_manager.py b/backend/controller/apps_manager.py index ac74f86df449d2460be86da8def76aa481c7ce2e..04ff7d8bbf479976a865b69844b5050c923edd14 100644 --- a/backend/controller/apps_manager.py +++ b/backend/controller/apps_manager.py @@ -80,7 +80,8 @@ class AppsManager(object): app_info = epk.pack() epk_filename = os.sep.join([os.path.dirname(epk_path).replace(config.get("UPLOAD_PATH"), ""), "{}.epk".format(app.app_name)]).replace('\\', '/') - app_info['md5'] = str(app_info['md5']) + if app_info: + app_info['md5'] = str(app_info['md5']) result = BuildLogs(app=app, app_path=epk_filename, app_info=app_info, create_by=editor, create_at=datetime.now(), update_by=editor, update_at=datetime.now()) commit() @@ -200,7 +201,7 @@ class AppsManager(object): temp.append(item.to_dict(only=["uuid", "app_name"])) return temp, len(temp), "get app {}.".format("success" if temp else "fail") - result = Apps.select().where(**temp).order_by(Apps.sort).page(data.get("pagenum", 1), pagesize=data.get("pagesize", 10)) + result = Apps.select().where(**temp).order_by(Apps.sort).sort_by(desc(Apps.create_at)).page(data.get("pagenum", 1), pagesize=data.get("pagesize", 10)) count = Apps.select().where(**temp).count() if result and len(result): diff --git a/backend/controller/build_logs_manager.py b/backend/controller/build_logs_manager.py index f574e88e9143ea6ccc6f27bc0f567c15f1b5448f..4626f258b51fb85d6ced697c74c8f2966a535c57 100644 --- a/backend/controller/build_logs_manager.py +++ b/backend/controller/build_logs_manager.py @@ -72,7 +72,8 @@ class BuildLogsManager(object): params['algorithm'] = "h" epk = EpkApp(**params) app_info = epk.pack() - app_info['md5'] = str(app_info['md5']) + if app_info: + app_info['md5'] = str(app_info['md5']) # æ›´æ–°æ•°æ®åº“对应文件路径 for sf in source_files: diff --git a/backend/utils/epk.py b/backend/utils/epk.py index fd8a7f843c4578dad1c3a8eb31119a8df805ec22..ab578784ceb946819e8b86cc5d522249e5336f56 100644 --- a/backend/utils/epk.py +++ b/backend/utils/epk.py @@ -52,6 +52,10 @@ def str_to_bin(s): def bin_to_str(s): return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]]) +def eprint(*args, **kwargs): + # print(*args, **kwargs) + pass + class EpkApp(object): @@ -61,10 +65,10 @@ class EpkApp(object): self._appName = appName self._appDir = os.path.abspath(appDir) self.algorithm = algorithm - print(sys.argv) - print(appName) - print(appDir) - print(self._appDir) + eprint(sys.argv) + eprint(appName) + eprint(appDir) + eprint(self._appDir) self._appVersion = appVersion self._appCRCCode = None self._files = [] @@ -114,7 +118,7 @@ class EpkApp(object): } if self._infoPath == os.sep.join([path, fname]): - print(finfo) + eprint(finfo) files.insert(0, finfo) else: files.append(finfo) @@ -159,7 +163,7 @@ class EpkApp(object): md5 = hashlib.md5() #获å–一个md5åŠ å¯†ç®—æ³•å¯¹è±¡ md5.update(content) #指定需è¦åŠ å¯†çš„å—符串 newmd5 = md5.hexdigest() #获å–åŠ å¯†åŽçš„16进制å—符串 - print("md5 == ",newmd5) + eprint("md5 == ",newmd5) content = self.sign(newmd5) ret = b"" @@ -186,8 +190,8 @@ class EpkApp(object): fileBytes += struct.pack("<%ds" % len(_name), fname.encode("utf-8")) with open(fpath, "rb") as fc: fileContentBytes = fc.read() - print(info["name"]) - print(len(fileContentBytes)) + eprint(info["name"]) + eprint(len(fileContentBytes)) fileBytes += struct.pack("<L", len(fileContentBytes)) if fext == "md5": @@ -195,11 +199,11 @@ class EpkApp(object): else: fileCompressBytes = self.compress()(fileContentBytes, level) - print("===",fileCompressBytes[0]) - print(fileCompressBytes) + eprint("===",fileCompressBytes[0]) + eprint(fileCompressBytes) fileBytes += struct.pack("<L", len(fileCompressBytes)) - print(fileBytes) + eprint(fileBytes) fileBytes += fileCompressBytes @@ -212,6 +216,7 @@ class EpkApp(object): # infos = self.epkInfo() epkFileBytes = b"" + ret = None epkFileContentBytes = b"" file_count = len(infos["files"]) with open(self._epkName, "wb") as f: @@ -251,6 +256,8 @@ class EpkApp(object): pprint.pprint(ret) + return ret + def main(path, appName, algorithm): epk = EpkApp(appName, path, algorithm)