Weak connection fix + code optimize + fix typo

Don't show applist before finish check update. Slightly slower loading but remove freeze on weak connection device
This commit is contained in:
KOWX712
2024-12-19 22:45:41 +08:00
parent dc46e5f12e
commit 610f106913
4 changed files with 33 additions and 29 deletions

View File

@@ -11,11 +11,11 @@ aapt() { "$MODPATH/aapt" "$@"; }
# wget = low pref, no ssl.
# curl, has ssl on android, we use it if found
download() {
if command -v curl > /dev/null 2>&1; then
curl --connect-timeout 3 -s "$1"
else
busybox wget -T 3 --no-check-certificate -qO - "$1"
fi
if command -v curl >/dev/null 2>&1; then
timeout 3 curl -s "$1"
else
timeout 3 busybox wget --no-check-certificate -qO - "$1"
fi
}
get_kb() {
@@ -28,7 +28,7 @@ get_xposed() {
APK_PATH=$(pm path "$PACKAGE" | grep "base.apk" | cut -d':' -f2 | tr -d '\r')
if [ -n "$APK_PATH" ]; then
if aapt dump xmltree "$APK_PATH" AndroidManifest.xml 2>/dev/null | grep -qE "xposed.category|xposeddescription"; then
echo "$PACKAGE" >> "$OUTPUT"
echo "$PACKAGE" >>"$OUTPUT"
fi
fi
done
@@ -36,9 +36,7 @@ get_xposed() {
get_unnecessary() {
if [ ! -s "$OUTPUT" ] || [ ! -f "$OUTPUT" ]; then
download "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/more-excldue.json" 2>/dev/null | \
grep -o '"package-name": *"[^"]*"' | \
awk -F'"' '{print $4}' > "$OUTPUT"
download "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/more-exclude.json" 2>/dev/null | grep -o '"package-name": *"[^"]*"' | awk -F'"' '{print $4}' >"$OUTPUT"
fi
get_xposed
}
@@ -55,8 +53,20 @@ check_update() {
}
case "$1" in
--kb) get_kb; exit ;;
--unnecessary) get_unnecessary; exit ;;
--xposed) get_xposed; exit ;;
--update) check_update; exit ;;
--kb)
get_kb
exit
;;
--unnecessary)
get_unnecessary
exit
;;
--xposed)
get_xposed
exit
;;
--update)
check_update
exit
;;
esac

View File

@@ -418,14 +418,8 @@ async function deselectUnnecessaryApps() {
// Function to check if Magisk
async function checkMagisk() {
try {
const hasDenylistCondition = await execCommand(`
if [ ! -f "/data/adb/apd" ] && [ ! -f "/data/adb/ksud" ]; then
echo "OK"
else
echo ""
fi
`);
if (hasDenylistCondition.trim() === "OK") {
const magiskEnv = await execCommand(`command -v magisk >/dev/null 2>&1 && echo "OK"`);
if (magiskEnv.trim() === "OK") {
console.log("Denylist conditions met, displaying element.");
selectDenylistElement.style.display = "flex";
} else {
@@ -798,9 +792,9 @@ document.addEventListener('DOMContentLoaded', async () => {
document.getElementById("about").addEventListener("click", aboutMenu);
await fetchAppList();
checkMagisk();
updateCheck();
loadingIndicator.style.display = "none";
document.querySelector('.uninstall-container').classList.remove('hidden-uninstall');
setTimeout(updateCheck, 0);
});
// Redirect to GitHub release page

View File

@@ -352,7 +352,7 @@ body {
font-size: 16px;
}
.link{
.link {
flex: 0 1 auto;
}

View File

@@ -1,7 +1,7 @@
{
"description": "Unnecessary app list",
"repo-link": "https://github.com/KOWX712/Tricky-Addon-Update-Target-List",
"json-link": "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/more-excldue.json",
"json-link": "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/more-exclude.json",
"data": [
{
"info": "Root manager",