mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 09:20:08 +00:00
Update version check
This commit is contained in:
@@ -933,7 +933,7 @@ update_via_homebrew() {
|
||||
fi
|
||||
|
||||
# Clear version check cache
|
||||
rm -f "$HOME/.cache/mole/version_check" "$HOME/.cache/mole/update_message"
|
||||
rm -f "$HOME/.cache/mole/update_message"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
18
mole
18
mole
@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/lib/core/common.sh"
|
||||
|
||||
# Version info
|
||||
VERSION="1.11.10"
|
||||
VERSION="1.11.11"
|
||||
MOLE_TAGLINE="can dig deep to clean your Mac."
|
||||
|
||||
# Check if Touch ID is already configured
|
||||
@@ -54,21 +54,14 @@ is_homebrew_install() {
|
||||
command -v brew > /dev/null 2>&1 && brew list mole > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Check for updates (non-blocking, cached)
|
||||
# Check for updates (non-blocking, always check in background)
|
||||
check_for_updates() {
|
||||
local cache="$HOME/.cache/mole/version_check"
|
||||
local msg_cache="$HOME/.cache/mole/update_message"
|
||||
local debug_log="$HOME/.cache/mole/update_check_debug"
|
||||
local ttl="${MO_UPDATE_CHECK_TTL:-3600}"
|
||||
mkdir -p "$(dirname "$cache")" 2> /dev/null
|
||||
|
||||
# Skip if checked recently
|
||||
if [[ -f "$cache" ]]; then
|
||||
local age=$(($(date +%s) - $(stat -f%m "$cache" 2> /dev/null || echo 0)))
|
||||
[[ $age -lt $ttl ]] && return
|
||||
fi
|
||||
mkdir -p "$(dirname "$msg_cache")" 2> /dev/null
|
||||
|
||||
# Background version check (save to file, don't output)
|
||||
# Always check in background, display result from previous check
|
||||
(
|
||||
local latest
|
||||
local check_method="github"
|
||||
@@ -90,7 +83,6 @@ check_for_updates() {
|
||||
echo -n > "$msg_cache"
|
||||
[[ -n "${MO_UPDATE_DEBUG:-}" ]] && echo "$(date): No update needed ($check_method): $VERSION == $latest" >> "$debug_log"
|
||||
fi
|
||||
touch "$cache" 2> /dev/null
|
||||
) &
|
||||
disown 2> /dev/null || true
|
||||
}
|
||||
@@ -334,7 +326,7 @@ update_mole() {
|
||||
fi
|
||||
|
||||
rm -f "$tmp_installer"
|
||||
rm -f "$HOME/.cache/mole/version_check" "$HOME/.cache/mole/update_message"
|
||||
rm -f "$HOME/.cache/mole/update_message"
|
||||
}
|
||||
|
||||
# Remove Mole from system
|
||||
|
||||
Reference in New Issue
Block a user