Compare commits

4 Commits
v2.3 ... v2.4

Author SHA1 Message Date
KOWX712
5806ab16d7 v2.4 2024-11-20 00:52:21 +08:00
KOWX712
0736f4ea38 Add app name display
try to display app name in webui
2024-11-20 00:44:28 +08:00
KOWX712
ff8a768a00 Add aapt bianry
prepare for app name feature
2024-11-19 23:26:27 +08:00
KOWX712
af3f8b88c0 Update changelog.md 2024-11-18 22:02:31 +08:00
11 changed files with 96 additions and 77 deletions

View File

@@ -1,15 +1,21 @@
### Tricky Addon: Update Target List ### Tricky Addon: Update Target List
Automated script to update tricky store target.txt A **KSU WebUI** to configure tricky store target.txt
Requirement: Tricky Store module installed Requirement: Tricky Store module installed
Manually add VerifiedBootHash to /data/adb/modules/TA_utl/boot_hash (optional) Manually add VerifiedBootHash to /data/adb/boot_hash (optional)
GitHub release: [Tricky Addon: Update Target List](https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/latest) GitHub release: [Tricky Addon: Update Target List](https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/latest)
Telegram channel: [KOW's Little World](https://t.me/kowchannel) Telegram channel: [KOW's Little World](https://t.me/kowchannel)
## Changelog ## Changelog
### v2.4
- Added aapt binary for app name display
**KSU WebUI**
- Added app name display
### v2.3 ### v2.3
- Removed curl binary - Removed curl binary
- Moved boot_hash to /data/adb to prevent overwrite - Moved boot_hash to /data/adb to prevent overwrite

View File

@@ -4,7 +4,7 @@
- Recommend to run with MT manager - Recommend to run with MT manager
## Changelog ## Changelog
### v2.1, v2.2, v2.3 ### v2.1, v2.2, v2.3, v2.4
- Remain same with v2.0 - Remain same with v2.0
### v2.0 ### v2.0

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Tricky Addon Lite: Update Target List Script v2.3 # Tricky Addon Lite: Update Target List Script v2.4
# GitHub Repository: https://github.com/KOWX712/Tricky-Addon-Update-Target-List/blob/master/lite-script_only/README.md # GitHub Repository: https://github.com/KOWX712/Tricky-Addon-Update-Target-List/blob/master/lite-script_only/README.md
# Telegram channel: https://t.me/kowchannel # Telegram channel: https://t.me/kowchannel

BIN
module/bin/arm64-v8a/aapt Normal file

Binary file not shown.

BIN
module/bin/armeabi-v7a/aapt Normal file

Binary file not shown.

View File

@@ -1,19 +0,0 @@
#!/system/bin/sh
if [ -f "/data/adb/apd" ] || [ -f "/data/adb/ksud" ]; then
exit 1
fi
MODPATH=${0%/*}
OUTPUT="$MODPATH/denylist"
# Get Magisk denylist
magisk --denylist ls 2>/dev/null | \
awk -F'|' '{print $1}' | \
grep -v "isolated" | \
sort | uniq > "$OUTPUT"
if [ ! -s "$OUTPUT" ]; then
echo "Failed to retrieve Magisk denylist or no packages found." > "$OUTPUT"
exit 1
fi

View File

@@ -13,9 +13,13 @@ initialize() {
ui_print "! Failed to set id" ui_print "! Failed to set id"
abort abort
} }
mkdir -p "$MODPATH/system/bin"
mv "$MODPATH/bin/$(getprop ro.product.cpu.abi)/aapt" "$COMPATH/aapt"
rm -rf "$MODPATH/bin"
set_perm $COMPATH/aapt 0 2000 0755
set_perm $SCRIPT_DIR/UpdateTargetList.sh 0 2000 0755 set_perm $SCRIPT_DIR/UpdateTargetList.sh 0 2000 0755
set_perm $COMPATH/get_denylist.sh 0 2000 0755
set_perm $COMPATH/get_exclude-list.sh 0 2000 0755 set_perm $COMPATH/get_exclude-list.sh 0 2000 0755
set_perm $COMPATH/get_WebUI.sh 0 2000 0755 set_perm $COMPATH/get_WebUI.sh 0 2000 0755

View File

@@ -1,7 +1,7 @@
id=TA_utl id=TA_utl
name=Tricky Addon - Update Target List name=Tricky Addon - Update Target List
version=v2.3 version=v2.4
versionCode=230 versionCode=240
author=KOWX712 author=KOWX712
description=A WebUI to conifgure tricky store target.txt description=A WebUI to conifgure tricky store target.txt
updateJson=https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/update.json updateJson=https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/master/update.json

View File

@@ -96,7 +96,7 @@
</div> </div>
<template id="app-template"> <template id="app-template">
<div class="card" onclick="toggleCheckbox(event)"> <div class="card" onclick="toggleCheckbox(event)">
<div class="content"> <div class="content" data-package="">
<p class="name"></p> <p class="name"></p>
<input type="checkbox" class="checkbox" checked> <input type="checkbox" class="checkbox" checked>
</div> </div>

View File

@@ -56,33 +56,49 @@ function isExcluded(appName) {
return excludeList.some(excludeItem => appName.includes(excludeItem)); return excludeList.some(excludeItem => appName.includes(excludeItem));
} }
// Function to fetch, sort, and render the app list // Function to fetch, sort, and render the app list with app names
async function fetchAppList() { async function fetchAppList() {
try { try {
await readExcludeFile(); await readExcludeFile();
const result = await execCommand("pm list packages -3 </dev/null 2>&1 | cat"); const result = await execCommand(`
const packageList = result.split("\n").map(line => line.replace("package:", "").trim()).filter(Boolean); pm list packages -3 | while read -r line; do
const sortedApps = packageList.sort((a, b) => { PACKAGE=$(echo "$line" | awk -F: '{print $2}')
const aInExclude = isExcluded(a); APK_PATH=$(pm path "$PACKAGE" | grep "base.apk" | awk -F: '{print $2}' | tr -d '\\r')
const bInExclude = isExcluded(b); if [ -n "$APK_PATH" ]; then
return aInExclude === bInExclude ? a.localeCompare(b) : aInExclude ? 1 : -1; APP_NAME=$( ${basePath}aapt dump badging "$APK_PATH" 2>/dev/null | grep "application-label:" | sed "s/application-label://; s/'//g" )
echo "$APP_NAME|$PACKAGE"
else
echo "Unknown App|$PACKAGE"
fi
done
`);
const appEntries = result.split("\n").map(line => {
const [appName, packageName] = line.split("|").map(item => item.trim());
return { appName, packageName };
}).filter(entry => entry.packageName); // Remove invalid entries
const sortedApps = appEntries.sort((a, b) => {
const aInExclude = isExcluded(a.packageName);
const bInExclude = isExcluded(b.packageName);
return aInExclude === bInExclude ? a.appName.localeCompare(b.appName) : aInExclude ? 1 : -1;
}); });
appListContainer.innerHTML = ""; appListContainer.innerHTML = ""; // Clear the container before rendering
sortedApps.forEach(appName => { sortedApps.forEach(({ appName, packageName }) => {
const appElement = document.importNode(appTemplate, true); const appElement = document.importNode(appTemplate, true);
appElement.querySelector(".name").textContent = appName; const contentElement = appElement.querySelector(".content");
contentElement.setAttribute("data-package", packageName);
const nameElement = appElement.querySelector(".name");
nameElement.innerHTML = `<strong>${appName || "Unknown App"}</strong><br>${packageName}`;
const checkbox = appElement.querySelector(".checkbox"); const checkbox = appElement.querySelector(".checkbox");
checkbox.checked = !isExcluded(appName); checkbox.checked = !isExcluded(packageName);
appListContainer.appendChild(appElement); appListContainer.appendChild(appElement);
}); });
console.log("App list fetched, sorted, and rendered successfully."); console.log("App list with names and packages rendered successfully.");
} catch (error) { } catch (error) {
console.error("Failed to fetch or render app list:", error); console.error("Failed to fetch or render app list with names:", error);
} }
floatingBtn.style.transform = 'translateY(-100px)'; floatingBtn.style.transform = "translateY(-100px)";
} }
// Function to refresh app list // Function to refresh app list
async function refreshAppList() { async function refreshAppList() {
isRefreshing = true; isRefreshing = true;
@@ -117,17 +133,18 @@ async function runXposedScript() {
} }
} }
// Function to read the xposed list and uncheck corresponding apps // Function to read the Xposed list and uncheck corresponding apps
async function deselectXposedApps() { async function deselectXposedApps() {
try { try {
const result = await execCommand(`cat ${basePath}exclude-list`); const result = await execCommand(`cat ${basePath}exclude-list`);
const xposedApps = result.split("\n").map(app => app.trim()).filter(Boolean); const xposedApps = result.split("\n").map(app => app.trim()).filter(Boolean);
const apps = document.querySelectorAll(".card"); const apps = document.querySelectorAll(".card");
apps.forEach(app => { apps.forEach(app => {
const appName = app.querySelector(".name").textContent.trim(); const contentElement = app.querySelector(".content");
const packageName = contentElement.getAttribute("data-package");
const checkbox = app.querySelector(".checkbox"); const checkbox = app.querySelector(".checkbox");
if (xposedApps.includes(appName)) { if (xposedApps.includes(packageName)) {
checkbox.checked = false; // Uncheck if found in exclude-list checkbox.checked = false; // Uncheck if found in Xposed list
} }
}); });
console.log("Xposed apps deselected successfully."); console.log("Xposed apps deselected successfully.");
@@ -136,30 +153,43 @@ async function deselectXposedApps() {
} }
} }
// Function to run the Denylist script // Function to check if Magisk
async function runDenylistScript() { async function checkMagisk() {
try { try {
const denylistScriptPath = `${basePath}get_denylist.sh`; const hasDenylistCondition = await execCommand(`
await execCommand(denylistScriptPath); if [ ! -f "/data/adb/apd" ] && [ ! -f "/data/adb/ksud" ]; then
console.log('Denylist element displayed successfully.'); echo "OK"
selectDenylistElement.style.display = "flex"; else
echo ""
fi
`);
if (hasDenylistCondition.trim() === "OK") {
console.log("Denylist conditions met, displaying element.");
selectDenylistElement.style.display = "flex";
} else {
console.log("ksud or apd detected, leaving denylist element hidden.");
}
} catch (error) { } catch (error) {
console.error("Failed to execute Denylist script:", error); console.error("Error while checking denylist conditions:", error);
} }
} }
// Function to read the denylist and check corresponding apps // Function to read the denylist and check corresponding apps
async function selectDenylistApps() { async function selectDenylistApps() {
try { try {
const result = await execCommand(`cat ${basePath}denylist`); const result = await execCommand(`
const denylistApps = result.split("\n") magisk --denylist ls 2>/dev/null | \
.map(app => app.trim()) awk -F'|' '{print $1}' | \
.filter(Boolean); grep -v "isolated" | \
sort | uniq
`);
const denylistApps = result.split("\n").map(app => app.trim()).filter(Boolean);
const apps = document.querySelectorAll(".card"); const apps = document.querySelectorAll(".card");
apps.forEach(app => { apps.forEach(app => {
const appName = app.querySelector(".name").textContent.trim(); const contentElement = app.querySelector(".content");
const packageName = contentElement.getAttribute("data-package");
const checkbox = app.querySelector(".checkbox"); const checkbox = app.querySelector(".checkbox");
if (denylistApps.includes(appName)) { if (denylistApps.includes(packageName)) {
checkbox.checked = true; // Select the app if found in denylist checkbox.checked = true; // Select the app if found in denylist
} }
}); });
@@ -169,7 +199,6 @@ async function selectDenylistApps() {
} }
} }
// Function to select all visible apps // Function to select all visible apps
function selectAllApps() { function selectAllApps() {
document.querySelectorAll(".card").forEach(card => { document.querySelectorAll(".card").forEach(card => {
@@ -312,26 +341,25 @@ clearBtn.addEventListener("click", () => {
document.getElementById("save").addEventListener("click", async () => { document.getElementById("save").addEventListener("click", async () => {
await readExcludeFile(); await readExcludeFile();
const deselectedApps = Array.from(appListContainer.querySelectorAll(".checkbox:not(:checked)")) const deselectedApps = Array.from(appListContainer.querySelectorAll(".checkbox:not(:checked)"))
.map(checkbox => checkbox.closest(".card").querySelector(".name").textContent); .map(checkbox => checkbox.closest(".card").querySelector(".content").getAttribute("data-package"));
const selectedApps = Array.from(appListContainer.querySelectorAll(".checkbox:checked")) const selectedApps = Array.from(appListContainer.querySelectorAll(".checkbox:checked"))
.map(checkbox => checkbox.closest(".card").querySelector(".name").textContent); .map(checkbox => checkbox.closest(".card").querySelector(".content").getAttribute("data-package"));
// Add deselected apps to EXCLUDE list
for (const app of deselectedApps) { for (const packageName of deselectedApps) {
if (!excludeList.includes(app)) { if (!excludeList.includes(packageName)) {
excludeList.push(app); excludeList.push(packageName);
console.log("Added to EXCLUDE list:", app); console.log("Added to EXCLUDE list:", packageName);
} else { } else {
console.log("App already in EXCLUDE file, skipping:", app); console.log("Package already in EXCLUDE file, skipping:", packageName);
} }
} }
// Remove selected apps from EXCLUDE list
if (selectedApps.length > 0) { if (selectedApps.length > 0) {
selectedApps.forEach(app => { selectedApps.forEach(packageName => {
excludeList = excludeList.filter(excludedApp => excludedApp !== app); excludeList = excludeList.filter(excludedPackage => excludedPackage !== packageName);
console.log("Removed from EXCLUDE list:", app); console.log("Removed from EXCLUDE list:", packageName);
}); });
} }
try { try {
// Save the EXCLUDE file // Save the EXCLUDE file
const updatedExcludeContent = excludeList.join("\n"); const updatedExcludeContent = excludeList.join("\n");
@@ -363,7 +391,7 @@ document.addEventListener('DOMContentLoaded', async () => {
document.getElementById("select-denylist").addEventListener("click", selectDenylistApps); document.getElementById("select-denylist").addEventListener("click", selectDenylistApps);
document.getElementById("deselect-xposed").addEventListener("click", deselectXposedApps); document.getElementById("deselect-xposed").addEventListener("click", deselectXposedApps);
await fetchAppList(); await fetchAppList();
runDenylistScript(); checkMagisk();
runXposedScript(); runXposedScript();
loadingIndicator.style.display = "none"; loadingIndicator.style.display = "none";
}); });

View File

@@ -1,6 +1,6 @@
{ {
"versionCode": 230, "versionCode": 240,
"version": "v2.3", "version": "v2.4",
"zipUrl": "https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/download/v2.3/TrickyAddonModule-v2.3.zip", "zipUrl": "https://github.com/KOWX712/Tricky-Addon-Update-Target-List/releases/download/v2.3/TrickyAddonModule-v2.3.zip",
"changelog": "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/refs/heads/master/changelog.md" "changelog": "https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/refs/heads/master/changelog.md"
} }