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:
parent
c5226255a2
commit
a2bc5dd7d8
@ -185,10 +185,10 @@ uci show metablogizer 2>/dev/null | grep "=site$" | sed "s/metablogizer\.\(.*\)=
|
|||||||
cat=$(categorize_site "$name")
|
cat=$(categorize_site "$name")
|
||||||
emoji=$(get_emoji "$cat")
|
emoji=$(get_emoji "$cat")
|
||||||
echo "$cat" >> "$CAT_FILE"
|
echo "$cat" >> "$CAT_FILE"
|
||||||
# 7th field: protected (1 if auth_required)
|
# 7th field: protected (use - placeholder for empty thumb to fix BusyBox read)
|
||||||
protected=""
|
protected="-"
|
||||||
[ "$auth_required" = "1" ] && protected="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
|
done
|
||||||
|
|
||||||
# Streamlit instances
|
# Streamlit instances
|
||||||
@ -201,7 +201,7 @@ uci show streamlit 2>/dev/null | grep "=instance$" | sed "s/streamlit\.\(.*\)=in
|
|||||||
cat=$(categorize_site "$name")
|
cat=$(categorize_site "$name")
|
||||||
emoji=$(get_emoji "$cat")
|
emoji=$(get_emoji "$cat")
|
||||||
echo "$cat" >> "$CAT_FILE"
|
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
|
done
|
||||||
|
|
||||||
# PeerTube videos
|
# 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
|
while IFS=' ' read -r url name cat emoji type thumb protected; do
|
||||||
[ -z "$url" ] && continue
|
[ -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
|
# For videos, 'thumb' is thumbnail URL and 'protected' is duration
|
||||||
duration=""
|
duration=""
|
||||||
if [ "$type" = "video" ]; then
|
if [ "$type" = "video" ]; then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user