Skip to content

Commit

Permalink
Fix wrong patches reisxd#461
Browse files Browse the repository at this point in the history
  • Loading branch information
reis committed Sep 27, 2022
1 parent d6136b5 commit 35b6ad7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion public/apps/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1>Select the app you want to patch</h1>
/><label for="app-1">YouTube</label>
</li>
<li>
<input type="radio" name="app" id="app-2" value="music" /><label
<input type="radio" name="app" id="app-2" value="youtube.music" /><label
for="app-2"
>YouTube Music</label
>
Expand Down
2 changes: 1 addition & 1 deletion public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ ws.onmessage = (msg) => {
}</label></li>`;
}

if (message.selectedApp === 'music' && !message.foundDevice)
if (message.selectedApp === 'youtube.music' && !message.foundDevice)
document.getElementById('continue').onclick = () => {
const version = document.querySelector(
'input[name="version"]:checked'
Expand Down
9 changes: 7 additions & 2 deletions utils/PatchListRememberer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { existsSync, readFileSync, writeFileSync } = require('node:fs');
const { existsSync, readFileSync, writeFileSync, rmSync } = require('node:fs');

const defaultPatchesList = JSON.stringify(
{
Expand All @@ -8,7 +8,7 @@ const defaultPatchesList = JSON.stringify(
patches: []
},
{
name: 'music',
name: 'youtube.music',
patches: []
},
{
Expand Down Expand Up @@ -46,6 +46,11 @@ function getPatchesList(pkgName) {
readFileSync('includedPatchesList.json', 'utf8')
);

if (patchesList.packages.find((package) => package.name === 'music')) {
rmSync('includedPatchesList.json');
return [];
}

return patchesList.packages.find((package) => package.name === pkgName)
.patches;
}
Expand Down
4 changes: 2 additions & 2 deletions utils/downloadApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function downloadApp(ws) {
`https://www.apkmirror.com/apk/google-inc/youtube/youtube-${apkMirrorVersionArg}-release/`
);
break;
case 'music':
case 'youtube.music':
versionDownload = await fetch(
`https://www.apkmirror.com/apk/google-inc/youtube-music/youtube-music-${apkMirrorVersionArg}-release/`
);
Expand Down Expand Up @@ -61,7 +61,7 @@ async function downloadApp(ws) {
const $ = load(versionDownloadList);

const dlLink =
arch && global.jarNames.selectedApp === 'music'
arch && global.jarNames.selectedApp === 'youtube.music'
? $(`div:contains("${arch}")`)
.parent()
.children('div[class^="table-cell rowheight"]')
Expand Down
2 changes: 1 addition & 1 deletion utils/mountReVancedInstaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = async function mountReVancedInstaller(deviceId) {
case 'youtube':
pkg = 'com.google.android.youtube';
break;
case 'music':
case 'youtube.music':
pkg = 'com.google.android.apps.youtube.music';
}

Expand Down
6 changes: 3 additions & 3 deletions wsEvents/getAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ module.exports = async function getAppVersion(ws, message) {
case 'youtube':
pkgName = 'com.google.android.youtube';
break;
case 'music':
case 'youtube.music':
pkgName = 'com.google.android.apps.youtube.music';
}

const appVersion = await getAppVersion_(pkgName, ws, true);

if (global.jarNames.selectedApp === 'music') {
if (global.jarNames.selectedApp === 'youtube.music') {
const arch = await getDeviceArch(ws);

global.apkInfo = {
Expand All @@ -121,7 +121,7 @@ module.exports = async function getAppVersion(ws, message) {
case 'youtube':
versionsList = await getPage(`${APKMIRROR_UPLOAD_BASE}youtube`);
break;
case 'music':
case 'youtube.music':
versionsList = await getPage(`${APKMIRROR_UPLOAD_BASE}youtube-music`);
break;
case 'android':
Expand Down
2 changes: 1 addition & 1 deletion wsEvents/installReVanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = async function installReVanced(ws) {
!global.jarNames.isRooted &&
global.jarNames.devices[0] &&
(global.jarNames.selectedApp === 'youtube' ||
global.jarNames.selectedApp === 'music')
global.jarNames.selectedApp === 'youtube.music')
) {
const currentMicroGVersion = (
await getDownloadLink({ owner: 'TeamVanced', repo: 'VancedMicroG' })
Expand Down
6 changes: 3 additions & 3 deletions wsEvents/patchApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function mount(ws) {
case 'youtube':
pkg = 'com.google.android.youtube';
break;
case 'music':
case 'youtube.music':
pkg = 'com.google.android.apps.youtube.music';
}

Expand Down Expand Up @@ -76,7 +76,7 @@ async function reinstallReVanced() {
if (!global.jarNames.isRooted)
pkgNameToGetUninstalled = 'app.revanced.android.youtube';
break;
case 'music':
case 'youtube.music':
if (!global.jarNames.isRooted)
pkgNameToGetUninstalled = 'app.revanced.android.apps.youtube.music';
break;
Expand Down Expand Up @@ -109,7 +109,7 @@ function outputName() {
case 'youtube':
part2 = 'YouTube';
break;
case 'music':
case 'youtube.music':
part2 = 'YouTube_Music';
break;
case 'frontpage':
Expand Down
2 changes: 1 addition & 1 deletion wsEvents/selectAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = async function selectAppVersion(message, ws) {
let arch = message.arch;

if (
(global.jarNames.selectedApp === 'music' && global.jarNames.devices[0]) ||
(global.jarNames.selectedApp === 'youtube.music' && global.jarNames.devices[0]) ||
process.platform === 'android'
) {
arch = await getDeviceArch(ws);
Expand Down

0 comments on commit 35b6ad7

Please sign in to comment.