fix: update checker — proper badge logic for missing hash baseline

When no .update_hash exists, compare VERSION strings to distinguish
fresh installs (same version = save baseline, no badge) from old
installs pre-hash-support (different version = show badge).
This commit is contained in:
SamNet-dev
2026-02-10 21:25:44 -06:00
parent 3ce0903955
commit 6a977a487a

View File

@@ -8756,10 +8756,24 @@ SVCEOF
local _stored_hash=""
[ -f "$INSTALL_DIR/.update_hash" ] && _stored_hash=$(<"$INSTALL_DIR/.update_hash")
if [ -z "$_stored_hash" ]; then
# No stored hash (curl|bash install) — save baseline, no badge
# No stored hash — check version to distinguish fresh vs old install
local _rv=$(grep -m1 '^VERSION=' "$_utmp" | cut -d'"' -f2)
if [ -n "$_rv" ] && [ "$_rv" = "$VERSION" ]; then
# Same version = likely fresh install — save baseline, no badge
echo "$_remote_hash" > "$INSTALL_DIR/.update_hash" 2>/dev/null || true
rm -f /tmp/.conduit_update_available
elif [ "$_remote_hash" != "$_stored_hash" ]; then
else
# Different version = old install without hash — show badge
if [ -n "$_rv" ]; then
echo "v${_rv}" > /tmp/.conduit_update_available
else
echo "new" > /tmp/.conduit_update_available
fi
fi
rm -f "$_utmp"
exit 0
fi
if [ "$_remote_hash" != "$_stored_hash" ]; then
local _rv=$(grep -m1 '^VERSION=' "$_utmp" | cut -d'"' -f2)
if [ -n "$_rv" ] && [ "$_rv" != "$VERSION" ]; then
echo "v${_rv}" > /tmp/.conduit_update_available