diff --git a/index.js b/index.js
index fae0d40b..96d38982 100644
--- a/index.js
+++ b/index.js
@@ -29,8 +29,6 @@ app.use(
server.listen(8080, () => {
console.log('The webserver is now running!');
try {
- // Shrihan, I sometimes question what are you doing with the console
- // :moyai:
console.log('Opening the app in the default browser...');
open('http://localhost:8080');
console.log('Done. Check if a browser window has opened');
diff --git a/public/index.js b/public/index.js
index ee03d2ca..221775ad 100644
--- a/public/index.js
+++ b/public/index.js
@@ -9,6 +9,8 @@ let currentFile;
let alreadyAddedLog = false;
let isDownloading = false;
let hasFinished = false;
+let arch;
+let versionChoosen;
function sendCommand (args) {
ws.send(JSON.stringify(args));
@@ -71,18 +73,22 @@ function setPatches () {
location.href = '/versions';
}
-function setAppVersion () {
+function setAppVersion (arch, version) {
if (!isDownloading) {
- if (!document.querySelector('input[name="version"]:checked')) {
- return alert("You didn't select an app version!");
+ if (!arch) {
+ if (!document.querySelector('input[name="version"]:checked')) {
+ return alert("You didn't select an app version!");
+ }
}
+
sendCommand({
event: 'selectAppVersion',
- versionChoosen: document.querySelector('input[name="version"]:checked')
- .value
+ versionChoosen: version || document.querySelector('input[name="version"]:checked').value,
+ arch
});
- document.getElementsByTagNane('header')[0].innerHTML = '
Downloading APK... '
+ document.getElementsByTagName('header')[0].innerHTML =
+ 'Downloading APK... ';
document.getElementById('content').innerHTML = ' ';
document.getElementsByTagName('main')[0].innerHTML +=
' ';
@@ -211,6 +217,35 @@ ws.onmessage = (msg) => {
${version.version} `;
i++;
}
+
+ if (message.selectedApp === 'music') {
+ document.getElementById('continue').onclick = () => {
+ let version = document.querySelector(
+ 'input[name="version"]:checked'
+ ).value;
+ document.getElementsByTagName('header')[0].innerHTML = `
+ Please select the architecture
+ YouTube Music APKs only have specific architecture APKs.
+ If you don't know which one to choose, either look at your devices architecture using CPU-Z or select Arm64. `;
+ document.getElementById('versions').innerHTML = '';
+ document.getElementById('versions').innerHTML += `
+
+
+ Arm64 (armv8)
+
+
+ Arm32 (armv7) `;
+ document.getElementById('continue').onclick = () => {
+ if (isDownloading && hasFinished) {
+ location.href = '/patch';
+ }
+ setAppVersion(
+ document.querySelector('input[name="arch"]:checked').value,
+ version
+ );
+ };
+ };
+ }
break;
}
diff --git a/utils/downloadApp.js b/utils/downloadApp.js
index d84a21d8..e6cbca96 100644
--- a/utils/downloadApp.js
+++ b/utils/downloadApp.js
@@ -2,7 +2,7 @@ const fetchURL = require('node-fetch');
const { load } = require('cheerio');
const { dloadFromURL } = require('../utils/FileDownlader.js');
-module.exports = async function (version, ws) {
+module.exports = async function (version, ws, arch) {
const apkVersion = version.replace(/\./g, '-');
let versionDownload;
@@ -56,12 +56,23 @@ module.exports = async function (version, ws) {
const versionDownloadList = await versionDownload.text();
const vDLL = load(versionDownloadList);
- const dlLink = vDLL('span[class="apkm-badge"]')
- .first()
- .parent()
- .children('a[class="accent_color"]')
- .first()
- .attr('href');
+ let dlLink;
+ if (arch) {
+ dlLink = vDLL(`div:contains("${arch}")`)
+ .parent()
+ .children('div[class^="table-cell rowheight"]')
+ .first()
+ .children('a[class="accent_color"]')
+ .first()
+ .attr('href');
+ } else {
+ dlLink = vDLL('span[class="apkm-badge"]')
+ .first()
+ .parent()
+ .children('a[class="accent_color"]')
+ .first()
+ .attr('href');
+ }
const downloadLink = await fetchURL(`https://www.apkmirror.com${dlLink}`);
const downloadLinkPage = await downloadLink.text();
diff --git a/wsEvents/GetAppVersion.js b/wsEvents/GetAppVersion.js
index 5f35caec..813e57ee 100644
--- a/wsEvents/GetAppVersion.js
+++ b/wsEvents/GetAppVersion.js
@@ -132,7 +132,8 @@ module.exports = async function (message, ws) {
return ws.send(
JSON.stringify({
event: 'appVersions',
- versionList
+ versionList,
+ selectedApp: global.jarNames.selectedApp
})
);
};
diff --git a/wsEvents/PatchApp.js b/wsEvents/PatchApp.js
index b2ed9f9c..b120d824 100644
--- a/wsEvents/PatchApp.js
+++ b/wsEvents/PatchApp.js
@@ -160,7 +160,7 @@ module.exports = async function (message, ws) {
ws.send(
JSON.stringify({
event: 'patchLog',
- log: data.toString(),
+ log: data.toString()
})
);
@@ -177,7 +177,7 @@ module.exports = async function (message, ws) {
ws.send(
JSON.stringify({
event: 'patchLog',
- log: data.toString(),
+ log: data.toString()
})
);
diff --git a/wsEvents/SelectAppVersion.js b/wsEvents/SelectAppVersion.js
index c9202f65..02318c98 100644
--- a/wsEvents/SelectAppVersion.js
+++ b/wsEvents/SelectAppVersion.js
@@ -1,5 +1,5 @@
const downloadApp = require('../utils/downloadApp.js');
module.exports = async function (message, ws) {
- await downloadApp(message.versionChoosen, ws);
+ await downloadApp(message.versionChoosen, ws, message.arch);
};