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

Explicitly include patches #45

Merged
merged 2 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ If you want to exclude more, seperate the patches with a comma:
$ node . --patch --exclude disable-shorts-button,microg-support
```

If you want to explicitly include a patch, use the `--include` option, example:

```bash
$ node . --patch --include autorepeat-by-default
```

If you want to include more, seperate the patches with a comma (same as the exclude option).

If you want to patch a specific YT version, download the APK, move it to this folder and rename it to `youtube.apk`:

```bash
Expand Down
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ async function getYTVersion () {

case 'patch': {
let excludedPatches = '';
let includedPatches = '';
let ytVersion;
let isRooted = false;

Expand Down Expand Up @@ -399,9 +400,20 @@ async function getYTVersion () {
}
if (!argParser.options.exclude.includes(',')) {
excludedPatches = ` -e ${argParser.options.exclude}`;
} else {
for (const patch of argParser.options.exclude.split(',')) {
excludedPatches += ` -e ${patch}`;
}
}
for (const patch of argParser.options.exclude.split(',')) {
excludedPatches += ` -e ${patch}`;
}

if (argParser.options.include) {
if (!argParser.options.include.includes(',')) {
includedPatches = ` -i ${argParser.options.include}`;
} else {
for (const patch of argParser.options.include.split(',')) {
includedPatches += ` -i ${patch}`;
}
}
}

Expand All @@ -412,7 +424,7 @@ async function getYTVersion () {
console.log('Building ReVanced, please be patient!');

const { stdout, stderr } = await actualExec(
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} --experimental -a ./revanced/youtube.apk ${jarNames.deviceId} -o ./revanced/revanced.apk -m ${jarNames.integrations} ${excludedPatches}`,
`java -jar ${jarNames.cli} -b ${jarNames.patchesJar} --experimental -a ./revanced/youtube.apk ${jarNames.deviceId} -o ./revanced/revanced.apk -m ${jarNames.integrations} ${excludedPatches} ${includedPatches}`,
{ maxBuffer: 5120 * 1024 }
);
console.log(stdout || stderr);
Expand Down