From 822369243685758209b2a682d1e112a684196328 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Sun, 22 Feb 2026 09:41:45 +0100 Subject: [PATCH] feat(gk2hub): Add dynamic hub generator v3 with categories and previews - Multi-view portal with grid/list/compact modes - Automatic site categorization (Intelligence, Dev, Finance, etc.) - Iframe thumbnail previews of real site content - Tag cloud and category tabs with emoji indicators - Instant search by domain/name/category - Auto-refresh via cron every 5 minutes - Created explicit vhosts for 54 MetaBlogizer sites - Fixed wildcard routing priority Co-Authored-By: Claude Opus 4.5 --- .claude/HISTORY.md | 16 ++ .../files/usr/sbin/hub-generator | 252 ++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100755 package/secubox/secubox-app-gk2hub/files/usr/sbin/hub-generator diff --git a/.claude/HISTORY.md b/.claude/HISTORY.md index 735a9d18..d2f61b7c 100644 --- a/.claude/HISTORY.md +++ b/.claude/HISTORY.md @@ -3097,3 +3097,19 @@ git checkout HEAD -- index.html - Add mitmproxy route in `/srv/mitmproxy-in/haproxy-routes.json` - Ensures all MetaBlogizer sites go through WAF inspection (security policy compliance). - Uploaded sites now immediately accessible via HTTPS domain. + +33. **GK2 Hub Generator v3 (2026-02-22)** + - Complete rewrite of hub-generator with dynamic multi-view portal. + - **Features:** + - Automatic categorization: Intelligence, Développement, Documentation, Finance, Média, etc. + - Iframe thumbnail previews showing real site content + - Tag cloud with category counts + - Category tabs with emoji indicators + - Instant search by domain/name/category + - Three view modes: Grid, List, Compact + - Auto-refresh every 5 minutes via cron + - Created explicit HAProxy vhosts for all 54 MetaBlogizer sites with `waf_bypass=1` and `priority=50`. + - Fixed wildcard `.gk2.secubox.in` routing to use `vortex_hub` with `priority=999` (processed last). + - Fixed missing mitmproxy routes for `admin.gk2.secubox.in` and `hub.gk2.secubox.in`. + - **Files:** + - `secubox-app-gk2hub/files/usr/sbin/hub-generator` (new) diff --git a/package/secubox/secubox-app-gk2hub/files/usr/sbin/hub-generator b/package/secubox/secubox-app-gk2hub/files/usr/sbin/hub-generator new file mode 100755 index 00000000..5df4de93 --- /dev/null +++ b/package/secubox/secubox-app-gk2hub/files/usr/sbin/hub-generator @@ -0,0 +1,252 @@ +#!/bin/sh +# SecuBox Hub Generator v3 - Dynamic portal with categories and thumbnails + +OUTPUT="/www/gk2-hub/index.html" +TEMP="/tmp/hub_gen_$$.html" +CACHE_DIR="/tmp/hub-cache" +DATE=$(date "+%Y-%m-%d %H:%M") + +mkdir -p "$CACHE_DIR" + +# Categorize site based on name +categorize_site() { + local name=$(echo "$1" | tr '[:upper:]' '[:lower:]') + case "$name" in + *intel*|*dgse*|*osint*|*threat*|*secu*|*raid*|*confid*|*mku*|*bdgse*|*camus*) echo "Intelligence" ;; + *game*|*play*|*comic*|*virus*|*survie*) echo "Divertissement" ;; + *dev*|*code*|*git*|*sdlc*|*crt*|*fabric*) echo "Développement" ;; + *doc*|*manual*|*guide*|*how*|*fm*|*bgp*|*lrh*|*bcf*) echo "Documentation" ;; + *media*|*video*|*tube*|*stream*|*radio*|*lyrion*|*jellyfin*) echo "Média" ;; + *blog*|*news*|*press*|*zine*|*flash*|*pub*) echo "Actualités" ;; + *cloud*|*file*|*nextcloud*) echo "Cloud" ;; + *admin*|*control*|*status*|*hub*|*glances*|*holo*) echo "Administration" ;; + *money*|*coin*|*crypto*|*cgv*|*cpi*|*apr*) echo "Finance" ;; + *geo*|*map*|*gondwana*|*earth*) echo "Géographie" ;; + *psy*|*oracle*|*yijing*|*bazi*|*equa*|*lunaquar*|*clock*) echo "Ésotérique" ;; + *) echo "Projets" ;; + esac +} + +get_emoji() { + case "$1" in + "Intelligence") echo "🔍" ;; + "Divertissement") echo "🎮" ;; + "Développement") echo "💻" ;; + "Documentation") echo "📚" ;; + "Média") echo "🎬" ;; + "Actualités") echo "📰" ;; + "Cloud") echo "☁️" ;; + "Administration") echo "⚙️" ;; + "Finance") echo "💰" ;; + "Géographie") echo "🌍" ;; + "Ésotérique") echo "🔮" ;; + *) echo "📄" ;; + esac +} + +# Start HTML +cat > "$TEMP" << 'HTMLHEAD' + + + + + +GK² Hub — Portal SecuBox + + + + +
+
+HTMLHEAD + +# Header +cat >> "$TEMP" << EOF +
+ +
+ + + + + +
+
+EOF + +# Collect sites +SITES_FILE="/tmp/hub_sites_$$.txt" +CAT_FILE="/tmp/hub_cats_$$.txt" +> "$SITES_FILE" +> "$CAT_FILE" + +uci show metablogizer 2>/dev/null | grep "=site$" | sed "s/metablogizer\.\(.*\)=site/\1/" | while read site; do + name=$(uci -q get "metablogizer.$site.name") + domain=$(uci -q get "metablogizer.$site.domain") + enabled=$(uci -q get "metablogizer.$site.enabled") + + [ "$enabled" != "1" ] && continue + [ -z "$domain" ] && continue + + cat=$(categorize_site "$name") + emoji=$(get_emoji "$cat") + + echo "$cat" >> "$CAT_FILE" + printf '%s\t%s\t%s\t%s\n' "$domain" "$name" "$cat" "$emoji" >> "$SITES_FILE" +done + +# Stats +TOTAL=$(wc -l < "$SITES_FILE" | tr -d ' ') +[ -z "$TOTAL" ] && TOTAL=0 +CAT_COUNTS=$(sort "$CAT_FILE" 2>/dev/null | uniq -c | sort -rn) + +# Stats bar +cat >> "$TEMP" << EOF +
+
$TOTALSites
+EOF +echo "$CAT_COUNTS" | head -5 | while read count cat; do + [ -n "$cat" ] && printf '
%s%s
\n' "$count" "$cat" >> "$TEMP" +done +echo "
" >> "$TEMP" + +# Tag cloud +echo '
' >> "$TEMP" +echo 'Tous' >> "$TEMP" +echo "$CAT_COUNTS" | while read count cat; do + [ -n "$cat" ] && printf '%s%s\n' "$cat" "$cat" "$count" >> "$TEMP" +done +echo '
' >> "$TEMP" + +# Category tabs +echo '
' >> "$TEMP" +printf '
📁 Tous%s
\n' "$TOTAL" >> "$TEMP" +echo "$CAT_COUNTS" | while read count cat; do + emoji=$(get_emoji "$cat") + [ -n "$cat" ] && printf '
%s %s%s
\n' "$cat" "$emoji" "$cat" "$count" >> "$TEMP" +done +echo '
' >> "$TEMP" + +# Sites grid with iframe preview +echo '
' >> "$TEMP" + +while IFS=' ' read -r domain name cat emoji; do + [ -z "$domain" ] && continue + + cat >> "$TEMP" << CARD + +
+ +
+
+
$name
+
$domain
+ $emoji $cat +
+
+CARD +done < "$SITES_FILE" + +echo '
' >> "$TEMP" + +# Footer and JS +cat >> "$TEMP" << 'FOOTER' + +
+ + + +FOOTER + +rm -f "$SITES_FILE" "$CAT_FILE" +mv "$TEMP" "$OUTPUT" +chmod 644 "$OUTPUT" +logger -t hub-generator "Hub v3: $TOTAL sites"