diff --git a/README.md b/README.md index 3e4f3feb..7178f470 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,4 @@ If you plan to use it from source, you'll also require [NodeJS >=16](https://nod ## How to use -Download the latest [executable](https://github.com/reisxd/revanced-builder/releases/latest) and if you are on Windows, unzip it and run it! +Download the latest [executable](https://github.com/reisxd/revanced-builder/releases/latest), unzip it and run it! diff --git a/src/ui/patchesScreen.js b/src/ui/patchesScreen.js index 54666510..c1972453 100644 --- a/src/ui/patchesScreen.js +++ b/src/ui/patchesScreen.js @@ -6,7 +6,7 @@ const { const fs = require('fs'); const { deleteWidgets } = require('../utils/index.js'); -function patchesScreen (selectedPatches, ui, variables, widgetsArray, pkg) { +function patchesScreen (selectedPatches, ui, variables, widgetsArray, pkg, patchesArray, pkgNameArray, firstWord) { ui.labels.main.setText('Select the patches you want to exclude:'); ui.labels.main.setObjectName('text'); const listWidget = new QListWidget(); @@ -79,10 +79,21 @@ function patchesScreen (selectedPatches, ui, variables, widgetsArray, pkg) { ); } } - const patchName = patch.replace(/\|.+(.*)$/, ''); + const patchName = patch.replace(/\|.+(.*)$/, '').replace(/\s/g, ''); variables.patches += ` -e ${patchName}`; packageObject.excludedPatches.push(patchName); } + let i = -1; + for (const patchnt of patchesArray) { + const patchName = patchnt.replace(firstWord, '').replace(/\s/g, '') + i++; + if (packageObject.excludedPatches.includes(patchName)) { + packageObject.excludedPatches.push(patchName); + continue; + } + if (pkgNameArray[i].replace(firstWord, '').replace(/\s/g, '') !== pkg) continue; + else variables.patches += ` -i ${patchName}`; + } let foundObj = false; for (const packageObj of excludedPatchList) { if (typeof packageObj === 'string') continue; @@ -113,7 +124,7 @@ function patchesScreen (selectedPatches, ui, variables, widgetsArray, pkg) { }); for (const patch of selectedPatches) { let excludedPatches = []; - const patchName = patch.replace(/\|.+(.*)$/, ''); + const patchName = patch.replace(/\|.+(.*)$/, '').replace(/\s/g, ''); if (fs.existsSync('./excludedPatchesList.json')) { excludedPatches = fs.readFileSync('./excludedPatchesList.json'); excludedPatches = JSON.parse(excludedPatches); diff --git a/src/utils/builder.js b/src/utils/builder.js index 77085d03..009b5c61 100644 --- a/src/utils/builder.js +++ b/src/utils/builder.js @@ -337,7 +337,7 @@ async function excludePatches (ui, pkg) { } patchesChoice.push(patch); } - patchesScreen(patchesChoice, ui, vars, widgetsArray, pkg); + patchesScreen(patchesChoice, ui, vars, widgetsArray, pkg, patchesArray, pkgNameArray, firstWord); } async function getAppVersions (version, app) {