mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 17:24:45 +00:00
feat(uninstall): add support for third-party input methods
- Add '/Library/Input Methods' to application scan paths - Unprotect Sogou, QQ, and Baidu input methods from system critical list - Enhance file cleanup logic to detect input method plugins and caches - Allow clean uninstallation and deep cleaning of WeType, Sogou, etc.
This commit is contained in:
@@ -50,17 +50,8 @@ readonly SYSTEM_CRITICAL_BUNDLES=(
|
|||||||
"KeyLayout*"
|
"KeyLayout*"
|
||||||
"GlobalPreferences"
|
"GlobalPreferences"
|
||||||
".GlobalPreferences"
|
".GlobalPreferences"
|
||||||
# Input methods (critical for international users)
|
|
||||||
"com.tencent.inputmethod.QQInput"
|
|
||||||
"com.sogou.inputmethod.*"
|
|
||||||
"com.baidu.inputmethod.*"
|
|
||||||
"com.apple.inputmethod.*"
|
"com.apple.inputmethod.*"
|
||||||
"com.googlecode.rimeime.*"
|
|
||||||
"im.rime.*"
|
|
||||||
"org.pqrs.Karabiner*"
|
"org.pqrs.Karabiner*"
|
||||||
"*.inputmethod"
|
|
||||||
"*.InputMethod"
|
|
||||||
"*IME"
|
|
||||||
"com.apple.inputsource*"
|
"com.apple.inputsource*"
|
||||||
"com.apple.TextInputMenuAgent"
|
"com.apple.TextInputMenuAgent"
|
||||||
"com.apple.TextInputSwitcher"
|
"com.apple.TextInputSwitcher"
|
||||||
@@ -68,6 +59,16 @@ readonly SYSTEM_CRITICAL_BUNDLES=(
|
|||||||
|
|
||||||
# Applications with sensitive data; protected during cleanup but removable
|
# Applications with sensitive data; protected during cleanup but removable
|
||||||
readonly DATA_PROTECTED_BUNDLES=(
|
readonly DATA_PROTECTED_BUNDLES=(
|
||||||
|
# Input Methods (protected during cleanup, uninstall allowed)
|
||||||
|
"com.tencent.inputmethod.QQInput"
|
||||||
|
"com.sogou.inputmethod.*"
|
||||||
|
"com.baidu.inputmethod.*"
|
||||||
|
"com.googlecode.rimeime.*"
|
||||||
|
"im.rime.*"
|
||||||
|
"*.inputmethod"
|
||||||
|
"*.InputMethod"
|
||||||
|
"*IME"
|
||||||
|
|
||||||
# System Utilities & Cleanup Tools
|
# System Utilities & Cleanup Tools
|
||||||
"com.nektony.*" # App Cleaner & Uninstaller
|
"com.nektony.*" # App Cleaner & Uninstaller
|
||||||
"com.macpaw.*" # CleanMyMac, CleanMaster
|
"com.macpaw.*" # CleanMyMac, CleanMaster
|
||||||
@@ -663,6 +664,8 @@ find_app_files() {
|
|||||||
"$HOME/Library/Audio/Plug-Ins/VST3/$app_name.vst3"
|
"$HOME/Library/Audio/Plug-Ins/VST3/$app_name.vst3"
|
||||||
"$HOME/Library/Audio/Plug-Ins/Digidesign/$app_name.dpm"
|
"$HOME/Library/Audio/Plug-Ins/Digidesign/$app_name.dpm"
|
||||||
"$HOME/Library/PreferencePanes/$app_name.prefPane"
|
"$HOME/Library/PreferencePanes/$app_name.prefPane"
|
||||||
|
"$HOME/Library/Input Methods/$app_name.app"
|
||||||
|
"$HOME/Library/Input Methods/$bundle_id.app"
|
||||||
"$HOME/Library/Screen Savers/$app_name.saver"
|
"$HOME/Library/Screen Savers/$app_name.saver"
|
||||||
"$HOME/Library/Frameworks/$app_name.framework"
|
"$HOME/Library/Frameworks/$app_name.framework"
|
||||||
"$HOME/Library/Autosave Information/$bundle_id"
|
"$HOME/Library/Autosave Information/$bundle_id"
|
||||||
@@ -798,6 +801,8 @@ find_app_system_files() {
|
|||||||
"/Library/Receipts/$bundle_id.plist"
|
"/Library/Receipts/$bundle_id.plist"
|
||||||
"/Library/Frameworks/$app_name.framework"
|
"/Library/Frameworks/$app_name.framework"
|
||||||
"/Library/Internet Plug-Ins/$app_name.plugin"
|
"/Library/Internet Plug-Ins/$app_name.plugin"
|
||||||
|
"/Library/Input Methods/$app_name.app"
|
||||||
|
"/Library/Input Methods/$bundle_id.app"
|
||||||
"/Library/Audio/Plug-Ins/Components/$app_name.component"
|
"/Library/Audio/Plug-Ins/Components/$app_name.component"
|
||||||
"/Library/Audio/Plug-Ins/VST/$app_name.vst"
|
"/Library/Audio/Plug-Ins/VST/$app_name.vst"
|
||||||
"/Library/Audio/Plug-Ins/VST3/$app_name.vst3"
|
"/Library/Audio/Plug-Ins/VST3/$app_name.vst3"
|
||||||
|
|||||||
@@ -146,6 +146,20 @@ EOF
|
|||||||
[ "$result" = "not-protected" ]
|
[ "$result" = "not-protected" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "input methods are protected during cleanup but allowed for uninstall" {
|
||||||
|
result=$(HOME="$HOME" bash --noprofile --norc -c "source '$PROJECT_ROOT/lib/core/common.sh'; should_protect_data 'com.tencent.inputmethod.QQInput' && echo 'protected' || echo 'not-protected'")
|
||||||
|
[ "$result" = "protected" ]
|
||||||
|
|
||||||
|
result=$(HOME="$HOME" bash --noprofile --norc -c "source '$PROJECT_ROOT/lib/core/common.sh'; should_protect_data 'com.sogou.inputmethod.pinyin' && echo 'protected' || echo 'not-protected'")
|
||||||
|
[ "$result" = "protected" ]
|
||||||
|
|
||||||
|
result=$(HOME="$HOME" bash --noprofile --norc -c "source '$PROJECT_ROOT/lib/core/common.sh'; should_protect_from_uninstall 'com.tencent.inputmethod.QQInput' && echo 'protected' || echo 'not-protected'")
|
||||||
|
[ "$result" = "not-protected" ]
|
||||||
|
|
||||||
|
result=$(HOME="$HOME" bash --noprofile --norc -c "source '$PROJECT_ROOT/lib/core/common.sh'; should_protect_from_uninstall 'com.apple.inputmethod.SCIM' && echo 'protected' || echo 'not-protected'")
|
||||||
|
[ "$result" = "protected" ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "print_summary_block formats output correctly" {
|
@test "print_summary_block formats output correctly" {
|
||||||
result=$(HOME="$HOME" bash --noprofile --norc -c "source '$PROJECT_ROOT/lib/core/common.sh'; print_summary_block 'success' 'Test Summary' 'Detail 1' 'Detail 2'")
|
result=$(HOME="$HOME" bash --noprofile --norc -c "source '$PROJECT_ROOT/lib/core/common.sh'; print_summary_block 'success' 'Test Summary' 'Detail 1' 'Detail 2'")
|
||||||
[[ "$result" == *"Test Summary"* ]]
|
[[ "$result" == *"Test Summary"* ]]
|
||||||
|
|||||||
Reference in New Issue
Block a user