Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function setAppVersion(arch, version) {
/**
* @param {boolean} isRooted
*/
function getAppVersions(isRooted) {
function getAppVersions(isRooted, page = 1) {
document.getElementsByTagName('header')[0].innerHTML = `
<h1><i class="fa-solid fa-file-arrow-down"></i>Select the version you want to download</h1>
<span>Versions marked as beta might have bugs or can be unstable, unless marked as recommended<span>
Expand All @@ -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() {
Expand Down Expand Up @@ -370,6 +372,13 @@ ws.onmessage = (msg) => {
const len = message.versionList.length;

const versionsElement = document.getElementById('versions');
versionsElement.innerHTML = '';

versionsElement.innerHTML += `
<li>
${message.page != 1 ? `<button id="prevPage" onclick="getAppVersions(${message.isRooted}, ${message.page - 1})">Previous Page</button>` : ""}
<button id="nextPage" onclick="getAppVersions(${message.isRooted}, ${message.page + 1})">Next Page</button>
</li>`;

for (let i = 0; i < len; i++) {
const version = message.versionList[i];
Expand Down
8 changes: 5 additions & 3 deletions wsEvents/getAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
})
);
};