mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-05-05 08:14:25 +02:00
feat: Do not generate a new keystore each time Patcher runs
This commit is contained in:
parent
825a57ee69
commit
63c1fdf9c5
@ -45,6 +45,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
val cacheDirPath = call.argument<String>("cacheDirPath")
|
val cacheDirPath = call.argument<String>("cacheDirPath")
|
||||||
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
||||||
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
||||||
|
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
||||||
if (patchBundleFilePath != null &&
|
if (patchBundleFilePath != null &&
|
||||||
originalFilePath != null &&
|
originalFilePath != null &&
|
||||||
inputFilePath != null &&
|
inputFilePath != null &&
|
||||||
@ -54,7 +55,8 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches != null &&
|
selectedPatches != null &&
|
||||||
cacheDirPath != null &&
|
cacheDirPath != null &&
|
||||||
mergeIntegrations != null &&
|
mergeIntegrations != null &&
|
||||||
resourcePatching != null
|
resourcePatching != null &&
|
||||||
|
keyStoreFilePath != null
|
||||||
) {
|
) {
|
||||||
runPatcher(
|
runPatcher(
|
||||||
result,
|
result,
|
||||||
@ -67,7 +69,8 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches,
|
selectedPatches,
|
||||||
cacheDirPath,
|
cacheDirPath,
|
||||||
mergeIntegrations,
|
mergeIntegrations,
|
||||||
resourcePatching
|
resourcePatching,
|
||||||
|
keyStoreFilePath
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
result.notImplemented()
|
result.notImplemented()
|
||||||
@ -89,13 +92,15 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches: List<String>,
|
selectedPatches: List<String>,
|
||||||
cacheDirPath: String,
|
cacheDirPath: String,
|
||||||
mergeIntegrations: Boolean,
|
mergeIntegrations: Boolean,
|
||||||
resourcePatching: Boolean
|
resourcePatching: Boolean,
|
||||||
|
keyStoreFilePath: String
|
||||||
) {
|
) {
|
||||||
val originalFile = File(originalFilePath)
|
val originalFile = File(originalFilePath)
|
||||||
val inputFile = File(inputFilePath)
|
val inputFile = File(inputFilePath)
|
||||||
val patchedFile = File(patchedFilePath)
|
val patchedFile = File(patchedFilePath)
|
||||||
val outFile = File(outFilePath)
|
val outFile = File(outFilePath)
|
||||||
val integrations = File(integrationsPath)
|
val integrations = File(integrationsPath)
|
||||||
|
val keyStoreFile = File(keyStoreFilePath)
|
||||||
|
|
||||||
val patches =
|
val patches =
|
||||||
DexPatchBundle(
|
DexPatchBundle(
|
||||||
@ -314,7 +319,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile)
|
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||||
|
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
|
@ -49,10 +49,9 @@ internal class Signer(
|
|||||||
return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private
|
return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private
|
||||||
}
|
}
|
||||||
|
|
||||||
fun signApk(input: File, output: File) {
|
fun signApk(input: File, output: File, ks: File) {
|
||||||
Security.addProvider(BouncyCastleProvider())
|
Security.addProvider(BouncyCastleProvider())
|
||||||
|
|
||||||
val ks = File(input.parent, "revanced-cli.keystore")
|
|
||||||
if (!ks.exists()) newKeystore(ks)
|
if (!ks.exists()) newKeystore(ks)
|
||||||
|
|
||||||
val keyStore = KeyStore.getInstance("BKS", "BC")
|
val keyStore = KeyStore.getInstance("BKS", "BC")
|
||||||
|
@ -18,6 +18,7 @@ class PatcherAPI {
|
|||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final RootAPI _rootAPI = RootAPI();
|
final RootAPI _rootAPI = RootAPI();
|
||||||
late Directory _tmpDir;
|
late Directory _tmpDir;
|
||||||
|
late File _keyStoreFile;
|
||||||
List<Patch> _patches = [];
|
List<Patch> _patches = [];
|
||||||
File? _outFile;
|
File? _outFile;
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ class PatcherAPI {
|
|||||||
await _loadPatches();
|
await _loadPatches();
|
||||||
Directory appCache = await getTemporaryDirectory();
|
Directory appCache = await getTemporaryDirectory();
|
||||||
_tmpDir = Directory('${appCache.path}/patcher');
|
_tmpDir = Directory('${appCache.path}/patcher');
|
||||||
|
_keyStoreFile = File('${appCache.path}/revanced-manager.keystore');
|
||||||
cleanPatcher();
|
cleanPatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +140,7 @@ class PatcherAPI {
|
|||||||
'cacheDirPath': cacheDir.path,
|
'cacheDirPath': cacheDir.path,
|
||||||
'mergeIntegrations': mergeIntegrations,
|
'mergeIntegrations': mergeIntegrations,
|
||||||
'resourcePatching': resourcePatching,
|
'resourcePatching': resourcePatching,
|
||||||
|
'keyStoreFilePath': _keyStoreFile.path,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user