new app-version

This commit is contained in:
Meowster 2024-07-01 21:48:48 +02:00
parent b22bf3adaa
commit 1f89b15ca7
2 changed files with 21 additions and 5 deletions

View file

@ -1,18 +1,20 @@
const fs = require("fs");
const {functions} = require("./functions");
const {decomp, modifyFunc, replaceLib, build} = require("./utils");
const {decomp, modifyFunc, replaceLib, build, replaceStringInManifest} = require("./utils");
const settings = require("./settings.json");
const decompName = settings.apkFileName;
const base = `${decompName}_decompile_xml`;
const appVersion = "20240615.10-dirty";
decomp();
functions.functions.forEach(func => {
modifyFunc(`./${base}/`+func.location, func.code)
})
replaceStringInManifest("android:versionName", `"${appVersion}"`)
replaceLib("./libbase.so", "libbase.so");
if(fs.existsSync(`./${decompName}_out.apk`)) fs.rmSync(`./${decompName}_out.apk`);

View file

@ -46,7 +46,6 @@ function decomp() {
console.error(err);
return;
}
console.log("decompiled");
}
);
}
@ -92,6 +91,21 @@ function replaceLib(newLibLocation, oldLib) {
);
}
function replaceStringInManifest(name, value) {
//replaces every instance of the "name" keyword
const manifest = `./${decompName}_decompile_xml/AndroidManifest.xml`;
const data = fs.readFileSync(manifest, "utf-8")
let arr = data.split(" ");
for (let i = 0; i < arr.length; i++) {
const line = arr[i];
if(line.includes(name)) {
line = `${name}=${value}`
}
}
fs.writeFileSync(manifest, arr.join(" "), "utf-8")
}
function build() {
execSync(`java -jar APKEditor.jar b -i ${decompName}_decompile_xml`);
@ -100,4 +114,4 @@ function build() {
);
}
module.exports = {generateIMEI, decomp, modifyFunc, replaceLib, build}
module.exports = {generateIMEI, decomp, modifyFunc, replaceLib, build, replaceStringInManifest}