1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-15 05:15:10 +00:00

Optimize security fix prompts and auto-fix flow

This commit is contained in:
Tw93
2025-12-29 15:14:03 +08:00
parent 492f3f77d6
commit b852e91493

View File

@@ -10,9 +10,13 @@ show_suggestions() {
local can_auto_fix=false local can_auto_fix=false
local -a auto_fix_items=() local -a auto_fix_items=()
local -a manual_items=() local -a manual_items=()
local skip_security_autofix=false
if [[ "${MOLE_SECURITY_FIXES_SHOWN:-}" == "true" ]]; then
skip_security_autofix=true
fi
# Security suggestions # Security suggestions
if [[ -n "${FIREWALL_DISABLED:-}" && "${FIREWALL_DISABLED}" == "true" ]]; then if [[ "$skip_security_autofix" == "false" && -n "${FIREWALL_DISABLED:-}" && "${FIREWALL_DISABLED}" == "true" ]]; then
auto_fix_items+=("Enable Firewall for better security") auto_fix_items+=("Enable Firewall for better security")
has_suggestions=true has_suggestions=true
can_auto_fix=true can_auto_fix=true
@@ -24,7 +28,7 @@ show_suggestions() {
fi fi
# Configuration suggestions # Configuration suggestions
if [[ -n "${TOUCHID_NOT_CONFIGURED:-}" && "${TOUCHID_NOT_CONFIGURED}" == "true" ]]; then if [[ "$skip_security_autofix" == "false" && -n "${TOUCHID_NOT_CONFIGURED:-}" && "${TOUCHID_NOT_CONFIGURED}" == "true" ]]; then
auto_fix_items+=("Enable Touch ID for sudo") auto_fix_items+=("Enable Touch ID for sudo")
has_suggestions=true has_suggestions=true
can_auto_fix=true can_auto_fix=true
@@ -94,7 +98,7 @@ ask_for_auto_fix() {
return 1 return 1
fi fi
echo -ne "${PURPLE}${ICON_ARROW}${NC} Auto-fix issues now? ${GRAY}Enter confirm / ESC cancel${NC}: " echo -ne "${PURPLE}${ICON_ARROW}${NC} Auto-fix issues now? ${GRAY}Enter confirm / Space cancel${NC}: "
local key local key
if ! key=$(read_key); then if ! key=$(read_key); then