fix(gk2hub): Use placeholder for empty TSV fields (BusyBox read compat)

BusyBox ash's read command collapses consecutive tab delimiters,
causing the protected field to end up in the wrong variable.

Fix: Use "-" as placeholder for empty fields, then strip it when reading.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-23 09:48:39 +01:00
parent c5226255a2
commit a2bc5dd7d8

View File

@ -185,10 +185,10 @@ uci show metablogizer 2>/dev/null | grep "=site$" | sed "s/metablogizer\.\(.*\)=
cat=$(categorize_site "$name")
emoji=$(get_emoji "$cat")
echo "$cat" >> "$CAT_FILE"
# 7th field: protected (1 if auth_required)
protected=""
# 7th field: protected (use - placeholder for empty thumb to fix BusyBox read)
protected="-"
[ "$auth_required" = "1" ] && protected="protected"
printf '%s\t%s\t%s\t%s\tmeta\t\t%s\n' "$domain" "$name" "$cat" "$emoji" "$protected" >> "$SITES_FILE"
printf '%s\t%s\t%s\t%s\tmeta\t-\t%s\n' "$domain" "$name" "$cat" "$emoji" "$protected" >> "$SITES_FILE"
done
# Streamlit instances
@ -201,7 +201,7 @@ uci show streamlit 2>/dev/null | grep "=instance$" | sed "s/streamlit\.\(.*\)=in
cat=$(categorize_site "$name")
emoji=$(get_emoji "$cat")
echo "$cat" >> "$CAT_FILE"
printf '%s\t%s\t%s\t%s\tstreamlit\t\t\n' "$domain" "$name" "$cat" "$emoji" >> "$SITES_FILE"
printf '%s\t%s\t%s\t%s\tstreamlit\t-\t-\n' "$domain" "$name" "$cat" "$emoji" >> "$SITES_FILE"
done
# PeerTube videos
@ -308,6 +308,10 @@ echo '<div class="view-grid" id="viewContainer"><div class="sites-grid" id="site
while IFS=' ' read -r url name cat emoji type thumb protected; do
[ -z "$url" ] && continue
# Handle placeholder values (- means empty, used for BusyBox read compatibility)
[ "$thumb" = "-" ] && thumb=""
[ "$protected" = "-" ] && protected=""
# For videos, 'thumb' is thumbnail URL and 'protected' is duration
duration=""
if [ "$type" = "video" ]; then