You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
loading time optimization
probably removed all loading time
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
URL="https://github.com/5ec1cff/KsuWebUIStandalone/releases/download/v1.0/KsuWebUI-1.0-34-release.apk"
|
URL="https://github.com/5ec1cff/KsuWebUIStandalone/releases/download/v1.0/KsuWebUI-1.0-34-release.apk"
|
||||||
APK_DIR="$COMPATH"
|
APK_DIR="$COMPATH"
|
||||||
|
|
||||||
find_busybox
|
|
||||||
check_wget
|
check_wget
|
||||||
|
|
||||||
echo "- Downloading the WebUI apk..."
|
echo "- Downloading the WebUI apk..."
|
||||||
|
|||||||
@@ -7,35 +7,33 @@ KBOUTPUT="$MODPATH/.extra"
|
|||||||
|
|
||||||
. $MODPATH/util_func.sh
|
. $MODPATH/util_func.sh
|
||||||
|
|
||||||
find_busybox
|
|
||||||
check_wget
|
check_wget
|
||||||
|
|
||||||
# Fetch additional package names
|
get_kb() {
|
||||||
|
wget --no-check-certificate -qO "$KBOUTPUT" "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/.extra"
|
||||||
|
[ -s "$KBOUTPUT" ] || rm -f "$KBOUTPUT"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_unnecessary() {
|
||||||
|
if [ ! -s "$OUTPUT" ] || [ ! -f "$OUTPUT" ]; then
|
||||||
wget --no-check-certificate -q -O - "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/more-excldue.json" 2>/dev/null | \
|
wget --no-check-certificate -q -O - "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/more-excldue.json" 2>/dev/null | \
|
||||||
grep -o '"package-name": *"[^"]*"' | \
|
grep -o '"package-name": *"[^"]*"' | \
|
||||||
awk -F'"' '{print $4}' > "$OUTPUT"
|
awk -F'"' '{print $4}' > "$OUTPUT"
|
||||||
|
|
||||||
if [ ! -s "$OUTPUT" ]; then
|
|
||||||
rm -f "$KBOUTPUT"
|
|
||||||
skipfetch=true
|
|
||||||
fi
|
fi
|
||||||
|
get_xposed
|
||||||
|
}
|
||||||
|
|
||||||
# Find xposed package name
|
get_xposed() {
|
||||||
pm list packages -3 </dev/null 2>&1 | cat | awk -F: '{print $2}' | while read -r PACKAGE; do
|
pm list packages -3 | awk -F: '{print $2}' | while read -r PACKAGE; do
|
||||||
if ! grep -Fq "$PACKAGE" "$SKIPLIST"; then
|
if ! grep -Fq "$PACKAGE" "$SKIPLIST" && ! grep -Fq "$PACKAGE" "$OUTPUT"; then
|
||||||
pm path "$PACKAGE" | grep "base.apk" | awk -F: '{print $2}' | tr -d '\r' | while read -r APK_PATH; do
|
pm path "$PACKAGE" | grep "base.apk" | awk -F: '{print $2}' | tr -d '\r' | while read -r APK_PATH; do
|
||||||
aapt dump xmltree "$APK_PATH" AndroidManifest.xml 2>/dev/null | grep -qE "xposed.category|xposeddescription" && echo "$PACKAGE" >> "$OUTPUT"
|
aapt dump xmltree "$APK_PATH" AndroidManifest.xml 2>/dev/null | grep -qE "xposed.category|xposeddescription" && echo "$PACKAGE" >> "$OUTPUT"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$skipfetch" != "true" ]; then
|
check_update() {
|
||||||
wget --no-check-certificate -qO "$KBOUTPUT" "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/.extra"
|
|
||||||
|
|
||||||
if [ ! -s "$KBOUTPUT" ]; then
|
|
||||||
rm -f "$KBOUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "$MODPATH/temp" ]; then
|
if [ -d "$MODPATH/temp" ]; then
|
||||||
JSON=$(wget --no-check-certificate -q -O - "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/update.json")
|
JSON=$(wget --no-check-certificate -q -O - "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/update.json")
|
||||||
REMOTE_VERSION=$(echo "$JSON" | grep -o '"versionCode": *[0-9]*' | awk -F: '{print $2}' | tr -d ' ')
|
REMOTE_VERSION=$(echo "$JSON" | grep -o '"versionCode": *[0-9]*' | awk -F: '{print $2}' | tr -d ' ')
|
||||||
@@ -44,6 +42,11 @@ if [ "$skipfetch" != "true" ]; then
|
|||||||
echo "update"
|
echo "update"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
}
|
||||||
exit 1
|
|
||||||
fi
|
case "$1" in
|
||||||
|
--kb) get_kb; exit ;;
|
||||||
|
--unnecessary) get_unnecessary; exit ;;
|
||||||
|
--xposed) get_xposed; exit ;;
|
||||||
|
--update) check_update; exit ;;
|
||||||
|
esac
|
||||||
@@ -1,26 +1,18 @@
|
|||||||
PACKAGE_NAME="io.github.a13e300.ksuwebui"
|
PACKAGE_NAME="io.github.a13e300.ksuwebui"
|
||||||
MODID="set-id"
|
MODID="set-id"
|
||||||
BBPATH="/data/adb/modules/busybox-ndk/system/*/busybox \
|
BBPATH="/data/adb/magisk/busybox \
|
||||||
/data/adb/magisk/busybox \
|
|
||||||
/data/adb/ksu/bin/busybox \
|
/data/adb/ksu/bin/busybox \
|
||||||
/data/adb/ap/bin/busybox"
|
/data/adb/ap/bin/busybox \
|
||||||
|
/data/adb/modules/busybox-ndk/system/*/busybox"
|
||||||
find_busybox() {
|
|
||||||
for path in $BBPATH; do
|
|
||||||
if [ -f "$path" ]; then
|
|
||||||
BUSYBOX="$path"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
check_wget() {
|
check_wget() {
|
||||||
|
for path in $BBPATH; do
|
||||||
|
[ -f "$path" ] && BUSYBOX="$path" && break
|
||||||
|
done
|
||||||
if ! command -v wget >/dev/null || grep -q "wget-curl" "$(command -v wget)"; then
|
if ! command -v wget >/dev/null || grep -q "wget-curl" "$(command -v wget)"; then
|
||||||
if find_busybox; then
|
if [ -n "$BUSYBOX" ]; then
|
||||||
wget() { "$BUSYBOX" wget "$@"; }
|
wget() { "$BUSYBOX" wget "$@"; }
|
||||||
else
|
else
|
||||||
echo "Error: busybox not found." > "$OUTPUT"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ async function refreshAppList() {
|
|||||||
await new Promise(resolve => setTimeout(resolve, 500));
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
if (noConnection.style.display === "flex") {
|
if (noConnection.style.display === "flex") {
|
||||||
await runExtraScript();
|
await updateCheck();
|
||||||
}
|
}
|
||||||
await fetchAppList();
|
await fetchAppList();
|
||||||
loadingIndicator.style.display = 'none';
|
loadingIndicator.style.display = 'none';
|
||||||
@@ -344,12 +344,12 @@ function deselectAllApps() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to run the extra script
|
// Function to run the update check
|
||||||
async function runExtraScript() {
|
async function updateCheck() {
|
||||||
try {
|
try {
|
||||||
const scriptPath = `${basePath}common/get_extra.sh`;
|
const scriptPath = `sh ${basePath}common/get_extra.sh --update`;
|
||||||
const output = await execCommand(scriptPath);
|
const output = await execCommand(scriptPath);
|
||||||
console.log("Extra script executed successfully.");
|
console.log("update script executed successfully.");
|
||||||
noConnection.style.display = "none";
|
noConnection.style.display = "none";
|
||||||
if (output.includes("update")) {
|
if (output.includes("update")) {
|
||||||
console.log("Update detected from extra script.");
|
console.log("Update detected from extra script.");
|
||||||
@@ -363,7 +363,7 @@ async function runExtraScript() {
|
|||||||
console.log("No update detected from extra script.");
|
console.log("No update detected from extra script.");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to execute Extra script:", error);
|
console.error("Failed to execute update script:", error);
|
||||||
showPrompt("no_internet", false);
|
showPrompt("no_internet", false);
|
||||||
noConnection.style.display = "flex";
|
noConnection.style.display = "flex";
|
||||||
}
|
}
|
||||||
@@ -372,6 +372,18 @@ async function runExtraScript() {
|
|||||||
// Function to read the exclude list and uncheck corresponding apps
|
// Function to read the exclude list and uncheck corresponding apps
|
||||||
async function deselectUnnecessaryApps() {
|
async function deselectUnnecessaryApps() {
|
||||||
try {
|
try {
|
||||||
|
const fileCheck = await execCommand(`test -f ${basePath}common/exclude-list && echo "exists" || echo "not found"`);
|
||||||
|
if (fileCheck.trim() === "not found") {
|
||||||
|
setTimeout(async () => {
|
||||||
|
await execCommand(`sh ${basePath}common/get_extra.sh --unnecessary`);
|
||||||
|
}, 100);
|
||||||
|
console.log("Exclude list not found. Running the unnecessary apps script.");
|
||||||
|
} else {
|
||||||
|
setTimeout(async () => {
|
||||||
|
await execCommand(`sh ${basePath}common/get_extra.sh --xposed`);
|
||||||
|
}, 100);
|
||||||
|
console.log("Exclude list found. Running xposed script.");
|
||||||
|
}
|
||||||
const result = await execCommand(`cat ${basePath}common/exclude-list`);
|
const result = await execCommand(`cat ${basePath}common/exclude-list`);
|
||||||
const UnnecessaryApps = result.split("\n").map(app => app.trim()).filter(Boolean);
|
const UnnecessaryApps = result.split("\n").map(app => app.trim()).filter(Boolean);
|
||||||
const apps = document.querySelectorAll(".card");
|
const apps = document.querySelectorAll(".card");
|
||||||
@@ -380,10 +392,10 @@ async function deselectUnnecessaryApps() {
|
|||||||
const packageName = contentElement.getAttribute("data-package");
|
const packageName = contentElement.getAttribute("data-package");
|
||||||
const checkbox = app.querySelector(".checkbox");
|
const checkbox = app.querySelector(".checkbox");
|
||||||
if (UnnecessaryApps.includes(packageName)) {
|
if (UnnecessaryApps.includes(packageName)) {
|
||||||
checkbox.checked = false; // Uncheck if found in more-exclude list
|
checkbox.checked = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("unnecessary apps deselected successfully.");
|
console.log("Unnecessary apps deselected successfully.");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to deselect unnecessary apps:", error);
|
console.error("Failed to deselect unnecessary apps:", error);
|
||||||
}
|
}
|
||||||
@@ -452,6 +464,9 @@ async function aospkb() {
|
|||||||
|
|
||||||
// Function to replace valid kb
|
// Function to replace valid kb
|
||||||
async function extrakb() {
|
async function extrakb() {
|
||||||
|
setTimeout(async () => {
|
||||||
|
await execCommand(`sh ${basePath}common/get_extra.sh --kb`);
|
||||||
|
}, 100);
|
||||||
const sourcePath = `${basePath}common/.extra`;
|
const sourcePath = `${basePath}common/.extra`;
|
||||||
const destinationPath = "/data/adb/tricky_store/keybox.xml";
|
const destinationPath = "/data/adb/tricky_store/keybox.xml";
|
||||||
try {
|
try {
|
||||||
@@ -469,7 +484,6 @@ async function extrakb() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Function to handle Verified Boot Hash
|
// Function to handle Verified Boot Hash
|
||||||
async function setBootHash() {
|
async function setBootHash() {
|
||||||
const showCard = () => {
|
const showCard = () => {
|
||||||
@@ -769,7 +783,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
checkMagisk();
|
checkMagisk();
|
||||||
loadingIndicator.style.display = "none";
|
loadingIndicator.style.display = "none";
|
||||||
document.querySelector('.uninstall-container').classList.remove('hidden-uninstall');
|
document.querySelector('.uninstall-container').classList.remove('hidden-uninstall');
|
||||||
runExtraScript();
|
setTimeout(updateCheck, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Redirect to GitHub release page
|
// Redirect to GitHub release page
|
||||||
|
|||||||
Reference in New Issue
Block a user