Skip to content

Commit 1d2a5f9

Browse files
authored
Merge branch 'reisxd:main' into main
2 parents 09b61ad + 19fbbe7 commit 1d2a5f9

File tree

5 files changed

+83
-54
lines changed

5 files changed

+83
-54
lines changed

android-interface.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ run_builder() {
124124
[[ "$1" == "--delete-cache-no-keystore" ]] || [[ "$1" == "--dcnk" ]] && {
125125
delete_cache_no_keystore
126126
}
127-
cd "$RVB_DIR || exit"
127+
cd "$RVB_DIR"
128128
node .
129129
[[ "$1" == "--delete-cache-after" ]] || [[ "$1" == "--dca" ]] && {
130130
delete_cache
@@ -166,7 +166,7 @@ reinstall_builder() {
166166
mv "$HOME"/revanced.keystore "$RVB_DIR"/revanced/revanced.keystore
167167
}
168168
log "Reinstalling..."
169-
cd "$RVB_DIR || exit"
169+
cd "$RVB_DIR"
170170
dload_and_install
171171
}
172172

@@ -191,7 +191,7 @@ update_builder() {
191191
mv "$HOME"/settings.json "$RVB_DIR"/settings.json
192192
}
193193
log "Updating revanced-builder..."
194-
cd "$RVB_DIR || exit"
194+
cd "$RVB_DIR"
195195
dload_and_install n
196196
run_self_update
197197
}
@@ -223,7 +223,7 @@ mv "$SCR_NAME_EXEC_FP.tmp" "$SCR_NAME_EXEC_FP" && {
223223
}
224224
EOF
225225

226-
log "Inserting update process..."
226+
log "Running update process..."
227227
exec /bin/bash updateScript.sh
228228
}
229229

public/index.js

Lines changed: 66 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function setAppVersion(arch, version) {
162162
/**
163163
* @param {boolean} isRooted
164164
*/
165-
function getAppVersions(isRooted) {
165+
function getAppVersions(isRooted, page = 1) {
166166
document.getElementsByTagName('header')[0].innerHTML = `
167167
<h1><i class="fa-solid fa-file-arrow-down"></i>Select the version you want to download</h1>
168168
<span>Versions marked as beta might have bugs or can be unstable, unless marked as recommended<span>
@@ -181,7 +181,9 @@ function getAppVersions(isRooted) {
181181
backButton.innerHTML = 'Back';
182182
backButton.onclick = () => history.back();
183183

184-
sendCommand({ event: 'getAppVersion', checkVer: true });
184+
if (page < 1) page = 1;
185+
186+
sendCommand({ event: 'getAppVersion', checkVer: true, page });
185187
}
186188

187189
function buildReVanced() {
@@ -370,6 +372,21 @@ ws.onmessage = (msg) => {
370372
const len = message.versionList.length;
371373

372374
const versionsElement = document.getElementById('versions');
375+
versionsElement.innerHTML = '';
376+
377+
versionsElement.innerHTML += `
378+
<li>
379+
${
380+
message.page != 1
381+
? `<button id="prevPage" onclick="getAppVersions(${
382+
message.isRooted
383+
}, ${message.page - 1})">Previous Page</button>`
384+
: ''
385+
}
386+
<button id="nextPage" onclick="getAppVersions(${message.isRooted}, ${
387+
message.page + 1
388+
})">Next Page</button>
389+
</li>`;
373390

374391
for (let i = 0; i < len; i++) {
375392
const version = message.versionList[i];
@@ -422,36 +439,38 @@ ws.onmessage = (msg) => {
422439
};
423440
}
424441
break;
425-
case 'installingStockApp': {
426-
if (message.status === 'DOWNLOAD_STARTED') {
427-
document.getElementsByTagName('header')[0].innerHTML =
428-
'<h1><i class="fa-solid fa-download"></i>Downloading APK</h1>';
429-
document.getElementById('content').innerHTML =
430-
'<span class="log"></span>';
431-
document.getElementsByTagName('main')[0].innerHTML +=
432-
'<progress value="0"></progress>';
433-
isDownloading = true;
434-
document.getElementById('continue').classList.add('disabled');
435-
} else if (message.status === 'DOWNLOAD_COMPLETE') {
436-
document.getElementById('continue').classList.add('disabled');
437-
isDownloading = false;
438-
document.getElementsByClassName(
439-
'log'
440-
)[0].innerHTML += `<span class="log-line info"><strong>[builder]</strong> Uninstalling the stock app...</span><br>`;
441-
} else if (message.status === 'UNINSTALL_COMPLETE') {
442-
document.getElementsByClassName(
443-
'log'
444-
)[0].innerHTML += `<span class="log-line info"><strong>[builder]</strong> Installing the downloaded (stock) APK...</span><br>`;
445-
} else if (message.status === 'ALL_DONE') {
446-
document.getElementsByClassName(
447-
'log'
448-
)[0].innerHTML += `<span class="log-line info"><strong>[builder]</strong> Complete.</span><br>`;
449-
document.getElementById('continue').classList.remove('disabled');
450-
document.getElementById('continue').onclick = () => {
451-
location.href = '/patch';
452-
};
442+
case 'installingStockApp':
443+
{
444+
if (message.status === 'DOWNLOAD_STARTED') {
445+
document.getElementsByTagName('header')[0].innerHTML =
446+
'<h1><i class="fa-solid fa-download"></i>Downloading APK</h1>';
447+
document.getElementById('content').innerHTML =
448+
'<span class="log"></span>';
449+
document.getElementsByTagName('main')[0].innerHTML +=
450+
'<progress value="0"></progress>';
451+
isDownloading = true;
452+
document.getElementById('continue').classList.add('disabled');
453+
} else if (message.status === 'DOWNLOAD_COMPLETE') {
454+
document.getElementById('continue').classList.add('disabled');
455+
isDownloading = false;
456+
document.getElementsByClassName(
457+
'log'
458+
)[0].innerHTML += `<span class="log-line info"><strong>[builder]</strong> Uninstalling the stock app...</span><br>`;
459+
} else if (message.status === 'UNINSTALL_COMPLETE') {
460+
document.getElementsByClassName(
461+
'log'
462+
)[0].innerHTML += `<span class="log-line info"><strong>[builder]</strong> Installing the downloaded (stock) APK...</span><br>`;
463+
} else if (message.status === 'ALL_DONE') {
464+
document.getElementsByClassName(
465+
'log'
466+
)[0].innerHTML += `<span class="log-line info"><strong>[builder]</strong> Complete.</span><br>`;
467+
document.getElementById('continue').classList.remove('disabled');
468+
document.getElementById('continue').onclick = () => {
469+
location.href = '/patch';
470+
};
471+
}
453472
}
454-
}
473+
break;
455474
case 'patchLog':
456475
{
457476
const logLevel = message.log.includes('WARNING')
@@ -553,25 +572,26 @@ ws.onmessage = (msg) => {
553572
}
554573
break;
555574
}
556-
case 'askRootVersion': {
557-
const confirmVer = confirm(
558-
`**Non Recommended Version**\nYour device has a non recommended version. This means you have to let the builder replace the stock YouTube with a recommended version.\nContinue?`
559-
);
560-
561-
if (confirmVer)
562-
return sendCommand({
563-
event: 'getAppVersion',
564-
installLatestRecommended: true
565-
});
566-
else {
567-
if (confirm('Alright, proceed with the non-recommended version?'))
575+
case 'askRootVersion':
576+
{
577+
const confirmVer = confirm(
578+
`**Non Recommended Version**\nYour device has a non recommended version. This means you have to let the builder replace the stock YouTube with a recommended version.\nContinue?`
579+
);
580+
581+
if (confirmVer)
568582
return sendCommand({
569583
event: 'getAppVersion',
570-
useVer: true
584+
installLatestRecommended: true
571585
});
586+
else {
587+
if (confirm('Alright, proceed with the non-recommended version?'))
588+
return sendCommand({
589+
event: 'getAppVersion',
590+
useVer: true
591+
});
592+
}
572593
}
573-
}
574-
594+
break;
575595
case 'appList': {
576596
let id = 0;
577597
for (const app of message.list) {

wsEvents/checkForUpdates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { getDownloadLink } = require('../utils/FileDownloader.js');
22

3-
const currentVersion = 'v3.9.0';
3+
const currentVersion = 'v3.9.1';
44

55
/**
66
* @param {import('ws').WebSocket} ws

wsEvents/getAppVersion.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const { getAppVersion: getAppVersion_ } = require('../utils/getAppVersion.js');
99
const { downloadApp: downloadApp_ } = require('../utils/downloadApp.js');
1010
const getDeviceArch = require('../utils/getDeviceArch.js');
1111

12-
const APKMIRROR_UPLOAD_BASE = 'https://www.apkmirror.com/uploads/?appcategory=';
12+
const APKMIRROR_UPLOAD_BASE = (page) =>
13+
`https://www.apkmirror.com/uploads/page/${page}/?appcategory=`;
1314

1415
/**
1516
* @param {string} ver
@@ -124,7 +125,9 @@ async function downloadApp(ws, message) {
124125
*/
125126
module.exports = async function getAppVersion(ws, message) {
126127
let versionsList = await getPage(
127-
`${APKMIRROR_UPLOAD_BASE}${global.jarNames.selectedApp.link.split('/')[3]}`
128+
`${APKMIRROR_UPLOAD_BASE(message.page || 1)}${
129+
global.jarNames.selectedApp.link.split('/')[3]
130+
}`
128131
);
129132

130133
if (global.jarNames.isRooted) {
@@ -229,11 +232,13 @@ module.exports = async function getAppVersion(ws, message) {
229232
JSON.stringify({
230233
event: 'appVersions',
231234
versionList,
235+
page: message.page || 1,
232236
selectedApp: global.jarNames.selectedApp.packageName,
233237
foundDevice:
234238
global.jarNames.devices && global.jarNames.devices[0]
235239
? true
236-
: process.platform === 'android'
240+
: process.platform === 'android',
241+
isRooted: global.jarNames.isRooted
237242
})
238243
);
239244
};

wsEvents/patchApp.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const exec = require('../utils/promisifiedExec.js');
77

88
const mountReVanced = require('../utils/mountReVanced.js');
99

10+
const fkill = require('fkill');
11+
1012
/**
1113
* @param {import('ws').WebSocket} ws
1214
*/
@@ -25,6 +27,8 @@ async function mount(ws) {
2527
* @param {import('ws').WebSocket} ws
2628
*/
2729
async function afterBuild(ws) {
30+
// HACK: Kill Java after build is done to prevent EBUSY errors while deleting the cache
31+
await fkill('java', { forceAfterTimeout: 5000, silent: true });
2832
rmSync('revanced-cache', { recursive: true, force: true });
2933
outputName();
3034
renameSync(

0 commit comments

Comments
 (0)