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

Commit

Permalink
Run ESLint & Add a warning for building rooted ReVanced
Browse files Browse the repository at this point in the history
  • Loading branch information
reisxd committed Jul 9, 2022
1 parent 1b618a5 commit 14498f6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ process.on('unhandledRejection', async (reason) => {
await exitProcess();
});

async function exitProcess() {
async function exitProcess () {
console.log('Press any key to exit...');
process.stdin.setRawMode(true);
process.stdin.resume();
await new Promise(() => process.stdin.on('data', () => process.exit()));
}

async function overWriteJarNames(link) {
async function overWriteJarNames (link) {
const fileName = link.split('/').pop();
// i have to use ifs for this sorry
if (fileName.includes('revanced-cli')) jarNames.cli += fileName;
Expand All @@ -56,7 +56,7 @@ async function overWriteJarNames(link) {
if (fileName.startsWith('microg')) jarNames.microG += fileName;
}

async function getDownloadLink(json) {
async function getDownloadLink (json) {
const apiRequest = await fetchURL(
`https://api.github.com/repos/${json.owner}/${json.repo}/releases/latest`
);
Expand Down Expand Up @@ -88,7 +88,7 @@ async function getDownloadLink(json) {
return assets;
}

async function getPage(pageUrl) {
async function getPage (pageUrl) {
const pageRequest = await fetchURL(pageUrl, {
headers: {
'user-agent':
Expand All @@ -98,7 +98,7 @@ async function getPage(pageUrl) {
return await pageRequest.text();
}

async function dloadFromURL(url, outputPath) {
async function dloadFromURL (url, outputPath) {
const request = await fetchURL(url, {
headers: {
'user-agent':
Expand Down Expand Up @@ -144,7 +144,7 @@ async function dloadFromURL(url, outputPath) {
});
}

async function downloadYTApk(ytVersion) {
async function downloadYTApk (ytVersion) {
const versionsList = await getPage(
'https://www.apkmirror.com/apk/google-inc/youtube'
);
Expand Down Expand Up @@ -207,7 +207,7 @@ async function downloadYTApk(ytVersion) {
return console.log('Download complete!');
}

async function downloadFile(assets) {
async function downloadFile (assets) {
for (const asset of assets) {
const dir = fs.readdirSync('./revanced/');
overWriteJarNames(asset.browser_download_url);
Expand All @@ -228,14 +228,14 @@ async function downloadFile(assets) {
}
}

async function downloadFiles(repos) {
async function downloadFiles (repos) {
for (const repo of repos) {
const downloadLink = await getDownloadLink(repo);
await downloadFile(downloadLink);
}
}

async function getADBDeviceID() {
async function getADBDeviceID () {
let deviceId;
const { stdout } = await actualExec('adb devices');
const match = stdout.match(/\r\n(.*?)\t/);
Expand All @@ -250,7 +250,7 @@ async function getADBDeviceID() {
return deviceId;
}

async function checkForJavaADB() {
async function checkForJavaADB () {
try {
const javaCheck = await actualExec('java -version');
const javaVer = Array.from(javaCheck.stderr.matchAll(/version\s([^:]+)/g))
Expand Down Expand Up @@ -288,7 +288,7 @@ async function checkForJavaADB() {
}
}

async function getYTVersion() {
async function getYTVersion () {
const { stdout, stderr } = await actualExec(
'adb shell dumpsys package com.google.android.youtube'
);
Expand Down Expand Up @@ -529,6 +529,9 @@ async function getYTVersion() {
return await exitProcess();
}
if (foundDevice) {
console.log(
'WARNING: Rooted builds might or might not work.\nKeep in mind that I (reisxd) cannot test it.'
);
ytVersion = await getYTVersion();
patches += ' --mount';
isRooted = true;
Expand Down

0 comments on commit 14498f6

Please sign in to comment.