From 2af2ee3d307e75f3a015fb6b40dfeb43a7e56fa3 Mon Sep 17 00:00:00 2001 From: fuRan Date: Fri, 14 Jan 2022 14:13:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/apk.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/apk.js b/lib/apk.js index c2cc25a..495729f 100644 --- a/lib/apk.js +++ b/lib/apk.js @@ -2,6 +2,8 @@ const Zip = require('./zip') const { mapInfoResource, findApkIconPath, getBase64FromBuffer } = require('./utils') const ManifestName = /^androidmanifest\.xml$/ const ResourceName = /^resources\.arsc$/ +const X86 = /^lib[\\/].*-v7a[\\/]/; +const X64 = /^lib[\\/].*-v8a[\\/]/; const ManifestXmlParser = require('./xml-parser/manifest') const ResourceFinder = require('./resource-finder') @@ -19,7 +21,7 @@ class ApkParser extends Zip { } parse () { return new Promise((resolve, reject) => { - this.getEntries([ManifestName, ResourceName]).then(buffers => { + this.getEntries([ManifestName, ResourceName, X86, X64]).then(buffers => { if (!buffers[ManifestName]) { throw new Error('AndroidManifest.xml can\'t be found.') } @@ -33,6 +35,9 @@ class ApkParser extends Zip { // update apkInfo with resourceMap apkInfo = mapInfoResource(apkInfo, resourceMap) + if (buffers[X86]) apkInfo['x86'] = 1; + if (buffers[X64]) apkInfo['x64'] = 1; + // find icon path and parse icon const iconPath = findApkIconPath(apkInfo) if (iconPath) { From 573fd147bd7cb5ed71c6526fd0797a43030023dc Mon Sep 17 00:00:00 2001 From: fuRan Date: Fri, 14 Jan 2022 14:44:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=8E=9F=E7=94=9FiconBuffer?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/apk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/apk.js b/lib/apk.js index 495729f..dab3bf8 100644 --- a/lib/apk.js +++ b/lib/apk.js @@ -43,6 +43,7 @@ class ApkParser extends Zip { if (iconPath) { this.getEntry(iconPath).then(iconBuffer => { apkInfo.icon = iconBuffer ? getBase64FromBuffer(iconBuffer) : null + apkInfo.iconBuffer = iconBuffer ?? null; resolve(apkInfo) }).catch(e => { apkInfo.icon = null