Skip to content

Commit

Permalink
"fix" error when trying to download youtube on root (in not a great way)
Browse files Browse the repository at this point in the history
  • Loading branch information
ActuallyTheSun committed Aug 4, 2022
1 parent 589ea97 commit 3947715
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function getAppVersions (isRooted) {
<h1>Select the version you want to download</h1>
${
isRooted
? "<span>You are building rooted ReVanced, you'll need to download the version matching with your YouTube version.<br>(You'll also need YouTube installed)<span>"
? "<span>You are building rooted ReVanced, you'll need to download the version matching with your YouTube version.<br>(You'll also need YouTube installed; if there's only one version of YouTube, it's the one you have installed)<span>"
: ''
}
`;
Expand Down
17 changes: 12 additions & 5 deletions wsEvents/GetAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const os = require('os');
const getAppVersion = require('../utils/getAppVersion.js');
const downloadApp = require('../utils/downloadApp.js');

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

module.exports = async function (message, ws) {
module.exports = async function (message, ws) {
let versionsList;
let localAppVersion;

if (global.jarNames.isRooted && os.platform() !== 'android') {
if (!global.jarNames.deviceID) {
Expand All @@ -39,8 +40,14 @@ module.exports = async function (message, ws) {
break;
}
}
const appVersion = await getAppVersion(pkgName);
return await downloadApp(appVersion, ws);

localAppVersion = await getAppVersion(pkgName);
return ws.send(
JSON.stringify({
event: 'appVersions',
versionList: [{ version: localAppVersion }]
})
);
}

switch (global.jarNames.selectedApp) {
Expand Down Expand Up @@ -104,4 +111,4 @@ module.exports = async function (message, ws) {
versionList
})
);
}
};

0 comments on commit 3947715

Please sign in to comment.