From ad2ea8095b26f5ca22d4c6a2098b75bd42660b95 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Sat, 3 Apr 2021 15:09:48 +0430 Subject: [PATCH] fixes from the inspector project --- .../ir/armor/tachidesk/impl/Extension.kt | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/impl/Extension.kt b/server/src/main/kotlin/ir/armor/tachidesk/impl/Extension.kt index 0122453..df8b319 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/impl/Extension.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/impl/Extension.kt @@ -55,25 +55,25 @@ object Extension { val reader = MultiDexFileReader.open(Files.readAllBytes(File(dexFile).toPath())) val handler = BaksmaliBaseDexExceptionHandler() Dex2jar - .from(reader) - .withExceptionHandler(handler) - .reUseReg(false) - .topoLogicalSort() - .skipDebug(true) - .optimizeSynchronized(false) - .printIR(false) - .noCode(false) - .skipExceptions(false) - .to(jarFilePath) + .from(reader) + .withExceptionHandler(handler) + .reUseReg(false) + .topoLogicalSort() + .skipDebug(true) + .optimizeSynchronized(false) + .printIR(false) + .noCode(false) + .skipExceptions(false) + .to(jarFilePath) if (handler.hasException()) { val errorFile: Path = File(ApplicationDirs.extensionsRoot).toPath().resolve("$fileNameWithoutType-error.txt") logger.error( - "Detail Error Information in File $errorFile\n" + - "Please report this file to one of following link if possible (any one).\n" + - " https://sourceforge.net/p/dex2jar/tickets/\n" + - " https://bitbucket.org/pxb1988/dex2jar/issues\n" + - " https://github.com/pxb1988/dex2jar/issues\n" + - " dex2jar@googlegroups.com" + "Detail Error Information in File $errorFile\n" + + "Please report this file to one of following link if possible (any one).\n" + + " https://sourceforge.net/p/dex2jar/tickets/\n" + + " https://bitbucket.org/pxb1988/dex2jar/issues\n" + + " https://github.com/pxb1988/dex2jar/issues\n" + + " dex2jar@googlegroups.com" ) handler.dump(errorFile, emptyArray()) } @@ -90,8 +90,8 @@ object Extension { } data class InstallableAPK( - val apkFilePath: String, - val pkgName: String + val apkFilePath: String, + val pkgName: String ) suspend fun installExtension(pkgName: String): Int { @@ -118,10 +118,12 @@ object Extension { val extensionRecord: ResultRow = transaction { ExtensionTable.select { ExtensionTable.apkName eq apkName }.firstOrNull() } ?: { - ExtensionTable.insert { - it[this.apkName] = apkName + transaction { + ExtensionTable.insert { + it[this.apkName] = apkName + } + ExtensionTable.select { ExtensionTable.apkName eq apkName }.firstOrNull()!! } - ExtensionTable.select { ExtensionTable.apkName eq apkName }.firstOrNull()!! }() val extensionId = extensionRecord[ExtensionTable.id] @@ -140,7 +142,7 @@ object Extension { dex2jar(dexFilePath, jarFilePath, fileNameWithoutType) // clean up - File(apkFilePath).delete() +// File(apkFilePath).delete() File(dexFilePath).delete() // update sources of the extension @@ -258,7 +260,7 @@ object Extension { return getCachedImageResponse(saveDir, apkName) { network.client.newCall( - GET(iconUrl) + GET(iconUrl) ).await() } }