Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #308 from git-Hmmm/main
Browse files Browse the repository at this point in the history
Bug fixes and minor changes
  • Loading branch information
reis authored Aug 24, 2022
2 parents 2745e62 + c86c4ca commit 6568db8
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 50 deletions.
3 changes: 2 additions & 1 deletion public/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link href="../styles/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="../styles/core.css" rel="stylesheet" type="text/css" />
<link href="../styles/about.css" rel="stylesheet" type="text/css" />
<script src="../index.js" defer></script>
<script src="../index.js"></script>
<script src="../colors.js" defer></script>
</head>

<body>
Expand Down
11 changes: 11 additions & 0 deletions public/colors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const accentColors = document.querySelectorAll('.theming span');
accentColors.forEach((color) => {
color.addEventListener('click', () => {
accentColors.forEach((el) => el.classList.remove('active'));
color.classList.add('active');
const colorNow1 = color.style.getPropertyValue('background-color');
// todo: in future maybe allow user to set any color, `colorNow1 = prompt("Set Custom Color:", colorNow1)`;
document.documentElement.style.setProperty('--accentColor', colorNow1);
localStorage.setItem('theme', colorNow1);
});
});
3 changes: 2 additions & 1 deletion public/dependencies/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link href="../styles/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="../styles/core.css" rel="stylesheet" type="text/css" />
<link href="../styles/dependencies.css" rel="stylesheet" type="text/css" />
<script src="../index.js" defer></script>
<script src="../index.js"></script>
<script src="../colors.js" defer></script>
</head>

<body>
Expand Down
3 changes: 2 additions & 1 deletion public/failure/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link href="../styles/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="../styles/core.css" rel="stylesheet" type="text/css" />
<link href="../styles/failure.css" rel="stylesheet" type="text/css" />
<script src="../index.js" defer></script>
<script src="../index.js"></script>
<script src="../colors.js" defer></script>
</head>

<body>
Expand Down
3 changes: 2 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link href="styles/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="styles/core.css" rel="stylesheet" type="text/css" />
<link href="styles/apps.css" rel="stylesheet" type="text/css" />
<script src="index.js" defer></script>
<script src="index.js"></script>
<script src="colors.js" defer></script>
</head>

<body>
Expand Down
45 changes: 17 additions & 28 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let hasFinished = false;
let arch;
let versionChoosen;

function sendCommand(args) {
function sendCommand (args) {
ws.send(JSON.stringify(args));
}
let colorNow;
Expand All @@ -23,7 +23,7 @@ if (localStorage.getItem('theme')) {
}
document.documentElement.style.setProperty('--accentColor', colorNow);

function setApp() {
function setApp () {
if (!document.querySelector('input[name="app"]:checked')) {
return alert("You didn't select an app to patch!");
}
Expand All @@ -34,31 +34,31 @@ function setApp() {
location.href = '/dependencies';
}

function loadPatches() {
function loadPatches () {
sendCommand({ event: 'getPatches' });
}

function updateFiles() {
function updateFiles () {
sendCommand({ event: 'updateFiles' });
}

function toggle(bool) {
function toggle (bool) {
for (const checkbox of document.getElementsByClassName('select')) {
checkbox.checked = bool;
}
}

function goToPatches() {
function goToPatches () {
if (hasFinished) {
location.href = '/patches';
}
}

function checkForUpdates() {
function checkForUpdates () {
sendCommand({ event: 'checkForUpdates' });
}

function setPatches() {
function setPatches () {
const patchElementList = [...document.querySelectorAll('.select')];
const selectedPatchElementList = patchElementList.filter(
(x) => x.checked === true
Expand All @@ -84,7 +84,7 @@ function setPatches() {
location.href = '/versions';
}

function setAppVersion(arch, version) {
function setAppVersion (arch, version) {
if (!isDownloading) {
if (!arch) {
if (!document.querySelector('input[name="version"]:checked')) {
Expand Down Expand Up @@ -112,7 +112,7 @@ function setAppVersion(arch, version) {
}
}

function getAppVersions(isRooted) {
function getAppVersions (isRooted) {
document.getElementsByTagName('header')[0].innerHTML = `
<h1>Select the version you want to download</h1>
<span>Versions marked as beta might have bugs or be unstable, unless marked as recommended<span>
Expand All @@ -131,44 +131,33 @@ function getAppVersions(isRooted) {
sendCommand({ event: 'getAppVersion' });
}

function buildReVanced() {
function buildReVanced () {
sendCommand({ event: 'patchApp' });
}

function getAlreadyExists() {
function getAlreadyExists () {
sendCommand({ event: 'checkFileAlreadyExists' });
}
function openAbout() {
function openAbout () {
window.open('/about', '_blank');
}

function openGitHub() {
function openGitHub () {
window.open('https://github.com/reisxd/revanced-builder', '_blank');
}

let accentColors = document.querySelectorAll('.theming span');
accentColors.forEach((color) => {
color.addEventListener('click', () => {
accentColors.forEach((el) => el.classList.remove('active'));
color.classList.add('active');
colorNow = color.style.getPropertyValue('background-color');
// todo: in future maybe allow user to set any color, `colorNow = prompt("Set Custom Color:", colorNow)`;
document.documentElement.style.setProperty('--accentColor', colorNow);
localStorage.setItem('theme', colorNow);
});
});
function openColorPicker() {
function openColorPicker () {
document.querySelector('.theming').classList.toggle('show');
}

function toTitleCase(phrase) {
function toTitleCase (phrase) {
return phrase
.split('-')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
}

function exitApp() {
function exitApp () {
sendCommand({ event: 'exit' });
const tempW = window.open(location, '_self');
tempW.close();
Expand Down
3 changes: 2 additions & 1 deletion public/patch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link href="../styles/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="../styles/core.css" rel="stylesheet" type="text/css" />
<link href="../styles/dependencies.css" rel="stylesheet" type="text/css" />
<script src="../index.js" defer></script>
<script src="../index.js"></script>
<script src="../colors.js" defer></script>
</head>

<body>
Expand Down
3 changes: 2 additions & 1 deletion public/patches/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link href="../styles/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="../styles/core.css" rel="stylesheet" type="text/css" />
<link href="../styles/patches.css" rel="stylesheet" type="text/css" />
<script src="../index.js" defer></script>
<script src="../index.js"></script>
<script src="../colors.js" defer></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion public/styles/apps.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ input[type='radio'] + label {
transition: 200ms;
}

input[type="radio"] + label:hover {
input[type='radio'] + label:hover {
box-shadow: inset 0px 0px 0px 1px #ddd;
border-color: #ddd;
}
9 changes: 5 additions & 4 deletions public/styles/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ div#container {
height: 100%;
}

div#container>main {
div#container > main {
display: flex;
flex-direction: column;
min-width: 0;
Expand Down Expand Up @@ -235,13 +235,13 @@ dialog {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0)
transform: translate3d(0, 100%, 0);
}

to {
opacity: 1;
-webkit-transform: translateZ(0);
transform: translateZ(0)
transform: translateZ(0);
}
}

Expand All @@ -254,7 +254,7 @@ dialog {
padding-bottom: 25px;
position: fixed;
background: black;
animation: fadeInUp .25s;
animation: fadeInUp 0.25s;
bottom: 81px;
left: 22px;
border-bottom: 0px;
Expand All @@ -270,6 +270,7 @@ dialog {

#themecolor-picker {
display: flex;
list-style: none;
}

#themecolor-picker span {
Expand Down
2 changes: 1 addition & 1 deletion public/styles/fontawesome.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

.fa-palette:before {
content: "\f53f"
content: '\f53f';
}

.fa-brands {
Expand Down
2 changes: 1 addition & 1 deletion public/styles/patches.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ input[type='checkbox'].select + label {
transition: 200ms;
}

input[type="checkbox"].select + label:hover {
input[type='checkbox'].select + label:hover {
box-shadow: inset 0px 0px 0px 1px #ddd;
border-color: #ddd;
}
Expand Down
3 changes: 2 additions & 1 deletion public/versions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<link href="../styles/core.css" rel="stylesheet" type="text/css" />
<link href="../styles/apps.css" rel="stylesheet" type="text/css" />
<link href="../styles/dependencies.css" rel="stylesheet" type="text/css" />
<script src="../index.js" defer></script>
<script src="../index.js"></script>
<script src="../colors.js" defer></script>
</head>

<body>
Expand Down
8 changes: 6 additions & 2 deletions utils/mountReVanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ module.exports = async function (pkg, ws) {
// Force stop the app
await actualExec(`su -c 'am force-stop ${pkg}'`);
// Unmount
await actualExec(`su -mm -c 'stock_path="$( pm path ${pkg} | grep base | sed 's/package://g' )" && umount -l "$stock_path"'`);
await actualExec(
`su -mm -c 'stock_path="$( pm path ${pkg} | grep base | sed 's/package://g' )" && umount -l "$stock_path"'`
);
} catch (error) {} // An error occured, probably because there is no existing ReVanced APK to be unmounted, ignore it and continue

// Move APK to folder
Expand Down Expand Up @@ -50,7 +52,9 @@ module.exports = async function (pkg, ws) {
// );

// Run Mount script
await actualExec(`su -mm -c '"/data/adb/service.d/mount_revanced_${pkg}.sh"'`);
await actualExec(
`su -mm -c '"/data/adb/service.d/mount_revanced_${pkg}.sh"'`
);
// Kill mounted process
// await actualExec(`su -c 'monkey -p ${pkg} 1 && kill $(pidof -s ${pkg})'`);

Expand Down
9 changes: 3 additions & 6 deletions wsEvents/GetAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,11 @@ module.exports = async function (message, ws) {
const sanitizeVersion = (ver) => {
return ver
.replace(/\.0(?<digit>\d)/gi, '.$1') // because apparently x.0y.z (ex. 5.09.51) isn't a valid version
.replace(/^(?<version>\d+)\.(?<minor>\d+)$/gi, "$1.$2.0") // nor are versions without a patch (ex. 2.3)
}
.replace(/^(?<version>\d+)\.(?<minor>\d+)$/gi, '$1.$2.0'); // nor are versions without a patch (ex. 2.3)
};
versionList.sort(
(a, b) =>
lt(
sanitizeVersion(a.version),
sanitizeVersion(b.version)
)
lt(sanitizeVersion(a.version), sanitizeVersion(b.version))
? 1
: -1 /* yes i need to add this to the end, the sort function is stupid */
);
Expand Down

0 comments on commit 6568db8

Please sign in to comment.