1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 18:34:46 +00:00

Add 'F' key to refresh paginated menus, clarify UI text for search and selection, and improve robustness of BOM file processing

This commit is contained in:
Tw93
2025-12-12 14:33:07 +08:00
parent 42634fbf3d
commit fa75da07ca
5 changed files with 53 additions and 29 deletions

View File

@@ -708,32 +708,34 @@ find_app_receipt_files() {
done < <(find /private/var/db/receipts -name "${bundle_id}*.bom" -print0 2> /dev/null)
fi
for bom_file in "${bom_files[@]}"; do
[[ ! -f "$bom_file" ]] && continue
# Process bom files if any found
if [[ ${#bom_files[@]} -gt 0 ]]; then
for bom_file in "${bom_files[@]}"; do
[[ ! -f "$bom_file" ]] && continue
# Parse bom file
# lsbom -f: file paths only
# -s: suppress output (convert to text)
local bom_content
bom_content=$(lsbom -f -s "$bom_file" 2> /dev/null)
# Parse bom file
# lsbom -f: file paths only
# -s: suppress output (convert to text)
local bom_content
bom_content=$(lsbom -f -s "$bom_file" 2> /dev/null)
while IFS= read -r file_path; do
# Standardize path (remove leading dot)
local clean_path="${file_path#.}"
while IFS= read -r file_path; do
# Standardize path (remove leading dot)
local clean_path="${file_path#.}"
# Ensure it starts with /
if [[ "$clean_path" != /* ]]; then
clean_path="/$clean_path"
fi
# Ensure it starts with /
if [[ "$clean_path" != /* ]]; then
clean_path="/$clean_path"
fi
# ------------------------------------------------------------------------
# SAFETY FILTER: Only allow specific removal paths
# ------------------------------------------------------------------------
local is_safe=false
# ------------------------------------------------------------------------
# SAFETY FILTER: Only allow specific removal paths
# ------------------------------------------------------------------------
local is_safe=false
# Whitelisted prefixes
case "$clean_path" in
/Applications/*) is_safe=true ;;
# Whitelisted prefixes
case "$clean_path" in
/Applications/*) is_safe=true ;;
/Users/*) is_safe=true ;;
/usr/local/*) is_safe=true ;;
/opt/*) is_safe=true ;;
@@ -782,7 +784,7 @@ find_app_receipt_files() {
done <<< "$bom_content"
done
fi
if [[ ${#receipt_files[@]} -gt 0 ]]; then
printf '%s\n' "${receipt_files[@]}"
fi