diff --git a/public/index.js b/public/index.js
index 5963931a..f0c98c11 100644
--- a/public/index.js
+++ b/public/index.js
@@ -162,7 +162,7 @@ function setAppVersion(arch, version) {
/**
* @param {boolean} isRooted
*/
-function getAppVersions(isRooted) {
+function getAppVersions(isRooted, page = 1) {
document.getElementsByTagName('header')[0].innerHTML = `
Select the version you want to download
Versions marked as beta might have bugs or can be unstable, unless marked as recommended
@@ -181,7 +181,9 @@ function getAppVersions(isRooted) {
backButton.innerHTML = 'Back';
backButton.onclick = () => history.back();
- sendCommand({ event: 'getAppVersion', checkVer: true });
+ if (page < 1) page = 1;
+
+ sendCommand({ event: 'getAppVersion', checkVer: true, page });
}
function buildReVanced() {
@@ -370,6 +372,13 @@ ws.onmessage = (msg) => {
const len = message.versionList.length;
const versionsElement = document.getElementById('versions');
+ versionsElement.innerHTML = '';
+
+ versionsElement.innerHTML += `
+
+ ${message.page != 1 ? `` : ""}
+
+ `;
for (let i = 0; i < len; i++) {
const version = message.versionList[i];
diff --git a/wsEvents/getAppVersion.js b/wsEvents/getAppVersion.js
index 4c78d9bb..507ba92a 100644
--- a/wsEvents/getAppVersion.js
+++ b/wsEvents/getAppVersion.js
@@ -9,7 +9,7 @@ const { getAppVersion: getAppVersion_ } = require('../utils/getAppVersion.js');
const { downloadApp: downloadApp_ } = require('../utils/downloadApp.js');
const getDeviceArch = require('../utils/getDeviceArch.js');
-const APKMIRROR_UPLOAD_BASE = 'https://www.apkmirror.com/uploads/?appcategory=';
+const APKMIRROR_UPLOAD_BASE = (page) => `https://www.apkmirror.com/uploads/page/${page}/?appcategory=`;
/**
* @param {string} ver
@@ -124,7 +124,7 @@ async function downloadApp(ws, message) {
*/
module.exports = async function getAppVersion(ws, message) {
let versionsList = await getPage(
- `${APKMIRROR_UPLOAD_BASE}${global.jarNames.selectedApp.link.split('/')[3]}`
+ `${APKMIRROR_UPLOAD_BASE(message.page || 1)}${global.jarNames.selectedApp.link.split('/')[3]}`
);
if (global.jarNames.isRooted) {
@@ -229,11 +229,13 @@ module.exports = async function getAppVersion(ws, message) {
JSON.stringify({
event: 'appVersions',
versionList,
+ page: message.page || 1,
selectedApp: global.jarNames.selectedApp.packageName,
foundDevice:
global.jarNames.devices && global.jarNames.devices[0]
? true
- : process.platform === 'android'
+ : process.platform === 'android',
+ isRooted: global.jarNames.isRooted
})
);
};