From 82d46ee2866c5e7d471f9a714c2901bf42a1e209 Mon Sep 17 00:00:00 2001 From: tw93 Date: Sun, 1 Feb 2026 09:28:49 +0800 Subject: [PATCH] fix: refine clash pattern matching for data protection and improve spinner handling --- lib/core/app_protection.sh | 19 ++++++++++++++----- lib/core/base.sh | 12 ++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/core/app_protection.sh b/lib/core/app_protection.sh index 3be570e..a270626 100755 --- a/lib/core/app_protection.sh +++ b/lib/core/app_protection.sh @@ -280,9 +280,18 @@ readonly DATA_PROTECTED_BUNDLES=( "com.telerik.Fiddler" "com.usebruno.app" - # Network Proxy & VPN Tools - "*clash*" - "*Clash*" + # Network Proxy & VPN Tools (Clash variants - use specific patterns to avoid false positives) + "com.clash.*" + "ClashX*" + "clash-*" + "Clash-*" + "*-clash" + "*-Clash" + "clash.*" + "Clash.*" + "clash_*" + "clashverge*" + "ClashVerge*" "com.nssurge.surge-mac" "*surge*" "*Surge*" @@ -678,10 +687,10 @@ should_protect_data() { com.sublimetext.* | com.sublimehq.* | Cursor | Claude | ChatGPT | Ollama) return 0 ;; - com.nssurge.* | com.v2ray.* | ClashX* | Surge* | Shadowrocket* | Quantumult*) + com.nssurge.* | com.v2ray.* | com.clash.* | ClashX* | Surge* | Shadowrocket* | Quantumult*) return 0 ;; - *clash* | *Clash*) + clash-* | Clash-* | *-clash | *-Clash | clash.* | Clash.* | clash_* | clashverge* | ClashVerge*) return 0 ;; com.docker.* | com.getpostman.* | com.insomnia.*) diff --git a/lib/core/base.sh b/lib/core/base.sh index 8622f65..e2149fb 100644 --- a/lib/core/base.sh +++ b/lib/core/base.sh @@ -626,12 +626,12 @@ start_section_spinner() { # Stop spinner and clear the line # Usage: stop_section_spinner stop_section_spinner() { - # Only clear line if spinner was actually running - if [[ -n "${INLINE_SPINNER_PID:-}" ]]; then - stop_inline_spinner 2> /dev/null || true - if [[ -t 1 ]]; then - echo -ne "\r\033[2K" >&2 || true - fi + # Always try to stop spinner (function handles empty PID gracefully) + stop_inline_spinner 2> /dev/null || true + # Always clear line to handle edge cases where spinner output remains + # (e.g., spinner was stopped elsewhere but line not cleared) + if [[ -t 1 ]]; then + printf "\r\033[2K" >&2 || true fi }