Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Fix #4 for real this time
Browse files Browse the repository at this point in the history
  • Loading branch information
reisxd committed Jul 3, 2022
1 parent f0183fc commit a9c9459
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ async function getYTVersion () {
'adb shell dumpsys package com.google.android.youtube'
);
const dumpSysOut = stdout || stderr;
if (!dumpSysOut.match(/versionName=([^=]+)/)[1]) {
throw new Error('YouTube is not installed on your device\nIt\'s needed for rooted ReVanced.');
}
return dumpSysOut
.match(/versionName=([^=]+)/)[1]
.replace('\r\n ', '')
Expand Down Expand Up @@ -398,17 +401,18 @@ async function getYTVersion () {
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} -l`
);

const patchesText = getPatches.stderr || getPatches.stdout;
const firstWord = patchesText.slice(0, patchesText.indexOf(' '));
const regex = new RegExp(`${firstWord}\\s([^\\t]+)`, 'g');
console.log(regex.toString());
const patchesArray =
getPatches.stdout.match(/INFO:\s([^:]+)/g) ||
getPatches.stderr.match(/INFO:\s([^:]+)/g) ||
getPatches.stdout.match(/INFORMATION:\s([^:]+)/g) ||
getPatches.stderr.match(/INFORMATION:\s([^:]+)/g);
getPatches.stdout.match(regex) || getPatches.stderr.match(regex);

const patchesChoice = [];

for (const patchName of patchesArray) {
patchesChoice.push({
name: patchName.replace('INFO: ', '').replace('INFORMATION: ', '')
name: patchName.replace(firstWord, '')
});
}

Expand Down

0 comments on commit a9c9459

Please sign in to comment.