Skip to content

Commit

Permalink
fix webui when detach list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hc committed Jan 1, 2025
1 parent ba12e88 commit b8f7d3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ fn main() -> ExitCode {
eprintln!("ERROR: package name not supplied.");
return ExitCode::FAILURE;
};
if pkg_name.is_empty() {
eprintln!("ERROR: package name is empty.");
return ExitCode::FAILURE;
}
if detach_by_name(&pkg_name).expect("detach.txt") {
println!("Changes are applied. No need for a reboot!");
} else {
Expand Down
5 changes: 2 additions & 3 deletions ksu-webui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@ async function main() {

const detached_list_out = await run("/data/adb/modules/zygisk-detach/detach list");
if (detached_list_out === undefined) return;
const detached = detached_list_out.split('\n');
let uninstalled = [...detached];
const detached = detached_list_out ? detached_list_out.split('\n') : [];
const uninstalled = detached ? [...detached] : [];
for (const pkg of pkgs.split('\n').map((line) => line.split(':')[1])) {
const incls = detached.includes(pkg);
populateApp(pkg, incls);
if (incls) {
const index = uninstalled.indexOf(pkg);
if (index > -1) uninstalled.splice(index, 1);
}

}
for (const pkg of uninstalled) populateApp(pkg, true);
sortChecked();
Expand Down

0 comments on commit b8f7d3e

Please sign in to comment.