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

View File

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

View File

@@ -352,7 +352,7 @@ body {
font-size: 16px; font-size: 16px;
} }
.link{ .link {
flex: 0 1 auto; flex: 0 1 auto;
} }
@@ -777,7 +777,7 @@ body {
background-color: #121212; background-color: #121212;
color: #fff; color: #fff;
} }
.header-block, .header-block,
.header { .header {
background-color: #121212; background-color: #121212;
@@ -802,7 +802,7 @@ body {
.update-card { .update-card {
background-color: #4D4D4D; background-color: #4D4D4D;
} }
.search-card { .search-card {
border: 1px solid #6E6E6E; border: 1px solid #6E6E6E;
} }
@@ -823,7 +823,7 @@ body {
.menu-options li { .menu-options li {
border-bottom: 1px solid #6E6E6E; border-bottom: 1px solid #6E6E6E;
} }
.language-option:active, .language-option:active,
.menu-options li:active, .menu-options li:active,
.card:active, .card:active,

View File

@@ -1,7 +1,7 @@
{ {
"description": "Unnecessary app list", "description": "Unnecessary app list",
"repo-link": "https://github.com/KOWX712/Tricky-Addon-Update-Target-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": [ "data": [
{ {
"info": "Root manager", "info": "Root manager",