diff --git a/index.js b/index.js index 96d38982..a88ee0a4 100644 --- a/index.js +++ b/index.js @@ -28,13 +28,15 @@ app.use( server.listen(8080, () => { console.log('The webserver is now running!'); - try { - console.log('Opening the app in the default browser...'); - open('http://localhost:8080'); - console.log('Done. Check if a browser window has opened'); - } catch (e) { - console.log('Failed. Open up http://localhost:8080 in your browser.'); - } + if (require('os').platform() !== 'android') { + try { + console.log('Opening the app in the default browser...'); + open('http://localhost:8080'); + console.log('Done. Check if a browser window has opened'); + } catch (e) { + console.log('Failed. Open up http://localhost:8080 in your browser.'); + } + } else console.log('Open up http://localhost:8080 in your browser.'); }); process.on('uncaughtException', (reason) => { diff --git a/public/index.html b/public/index.html index bc425e5d..fa5ad22a 100644 --- a/public/index.html +++ b/public/index.html @@ -72,7 +72,9 @@

Select the app you want to patch

onclick="openAbout();" > - + diff --git a/public/index.js b/public/index.js index 562ce2a9..40d3ff90 100644 --- a/public/index.js +++ b/public/index.js @@ -83,7 +83,9 @@ function setAppVersion (arch, version) { sendCommand({ event: 'selectAppVersion', - versionChoosen: version || document.querySelector('input[name="version"]:checked').value, + versionChoosen: + version || + document.querySelector('input[name="version"]:checked').value, arch }); @@ -139,13 +141,13 @@ function toTitleCase (phrase) { .join(' '); } -window.addEventListener("keypress", (e) => { - if(e.key === "Enter"){ +window.addEventListener('keypress', (e) => { + if (e.key === 'Enter') { e.preventDefault(); - document.getElementById("continue").click(); + document.getElementById('continue').click(); } -}) +}); ws.onmessage = (msg) => { const message = JSON.parse(msg.data); @@ -162,7 +164,9 @@ ws.onmessage = (msg) => { ${ patch.isRooted ? 'Needed for Non-Root Building' : '' } - ${toTitleCase(patch.name)}  (${patch.maxVersion !== " " ? patch.maxVersion : "ALL"}) + ${toTitleCase(patch.name)}  (${ + patch.maxVersion !== ' ' ? patch.maxVersion : 'ALL' + }) ${patch.description} `; @@ -229,7 +233,7 @@ ws.onmessage = (msg) => { if (message.selectedApp === 'music' && !message.foundDevice) { document.getElementById('continue').onclick = () => { - let version = document.querySelector( + const version = document.querySelector( 'input[name="version"]:checked' ).value; document.getElementsByTagName('header')[0].innerHTML = ` @@ -301,8 +305,11 @@ ws.onmessage = (msg) => { case 'buildFinished': { document.getElementsByTagName('header')[0].innerHTML = '

ReVanced has been built.

'; + if (WS_URI !== 'ws://localhost:8080') { + document.getElementsByTagName('footer')[0].innerHTML += + ''; + } document.getElementsByTagName('footer')[0].innerHTML += - '' + ''; break; } diff --git a/public/patches/index.html b/public/patches/index.html index d4d2f952..f383ba44 100644 --- a/public/patches/index.html +++ b/public/patches/index.html @@ -39,7 +39,9 @@

Select patches to include

> - + diff --git a/wsEvents/GetAppVersion.js b/wsEvents/GetAppVersion.js index 09d96776..c3e7c93e 100644 --- a/wsEvents/GetAppVersion.js +++ b/wsEvents/GetAppVersion.js @@ -65,7 +65,9 @@ module.exports = async function (message, ws) { ); } if (global.jarNames.selectedApp === 'music') { - const deviceArch = await actualExec('adb shell getprop ro.product.cpu.abi'); + const deviceArch = await actualExec( + 'adb shell getprop ro.product.cpu.abi' + ); return await downloadApp(appVersion, ws, deviceArch.stdout); } else return await downloadApp(appVersion, ws); } diff --git a/wsEvents/GetPatches.js b/wsEvents/GetPatches.js index b2730310..baddfae0 100644 --- a/wsEvents/GetPatches.js +++ b/wsEvents/GetPatches.js @@ -20,7 +20,6 @@ module.exports = async function (message, ws) { /:\s+(?\S+)\s+(?\S+)\s+(?.+)\t+(?.+)/g ); - let hasRoot = true; if (os.platform() === 'android') { await actualExec('su -c exit').catch((err) => { @@ -38,12 +37,17 @@ module.exports = async function (message, ws) { const { name, description, pkg, versions } = match.groups; const isRooted = rootedPatches.includes(name); const isCompatible = pkg === global.jarNames.selectedApp; - - const versionsArr = versions.split(", ") - const maxVersion = versionsArr.sort()[versionsArr.length - 1] + + const versionsArr = versions.split(', '); + const maxVersion = versionsArr.sort()[versionsArr.length - 1]; if (isCompatible && (!isRooted || hasRoot)) { - patchList.push({ name, description: description.trim(), maxVersion: maxVersion, isRooted }); + patchList.push({ + name, + description: description.trim(), + maxVersion, + isRooted + }); } } diff --git a/wsEvents/PatchApp.js b/wsEvents/PatchApp.js index b120d824..11672c25 100644 --- a/wsEvents/PatchApp.js +++ b/wsEvents/PatchApp.js @@ -3,6 +3,7 @@ const { exec, spawn } = require('child_process'); const os = require('os'); const mountReVanced = require('../utils/mountReVanced.js'); const actualExec = promisify(exec); +const fs = require('fs'); async function mount (ws) { let pkg; @@ -28,6 +29,7 @@ async function mount (ws) { } async function afterBuild (ws) { + fs.rmdirSync('./revanced', { recursive: true, force: true }); if (!global.jarNames.isRooted && os.platform() === 'android') { await actualExec( 'cp revanced/revanced.apk /storage/emulated/0/revanced.apk' @@ -137,7 +139,6 @@ module.exports = async function (message, ws) { if (global.jarNames.deviceID) { args.push('-d'); args.push(global.jarNames.deviceID); - args.push('-c'); } for (const patch of global.jarNames.patches.split(' ')) { diff --git a/wsEvents/SelectAppVersion.js b/wsEvents/SelectAppVersion.js index 597c530b..abf58e77 100644 --- a/wsEvents/SelectAppVersion.js +++ b/wsEvents/SelectAppVersion.js @@ -6,9 +6,14 @@ const actualExec = promisify(exec); module.exports = async function (message, ws) { let arch = message.arch; - if (global.jarNames.selectedApp === 'music' && global.jarNames.deviceID || os.platform() === 'android') { + if ( + (global.jarNames.selectedApp === 'music' && global.jarNames.deviceID) || + os.platform() === 'android' + ) { if (global.jarNames.deviceID) { - const deviceArch = await actualExec('adb shell getprop ro.product.cpu.abi'); + const deviceArch = await actualExec( + 'adb shell getprop ro.product.cpu.abi' + ); arch = deviceArch.arch; } else { const deviceArch = await actualExec('getprop ro.product.cpu.abi');