From a8c3e0662701436b2468cd42e59d3739a915136d Mon Sep 17 00:00:00 2001 From: casjay Date: Wed, 22 Oct 2025 17:12:54 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Update=20codebase=20?= =?UTF-8?q?=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/root/docker/setup/06-post.sh rootfs/root/docker/setup/06-post.sh --- rootfs/root/docker/setup/06-post.sh | 99 +---------------------------- 1 file changed, 2 insertions(+), 97 deletions(-) diff --git a/rootfs/root/docker/setup/06-post.sh b/rootfs/root/docker/setup/06-post.sh index 82d8d11..d7bd215 100755 --- a/rootfs/root/docker/setup/06-post.sh +++ b/rootfs/root/docker/setup/06-post.sh @@ -24,108 +24,13 @@ set -o pipefail # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set env variables exitCode=0 -LIST_INDEX_FILE="/usr/share/httpd/default/list.html" -RAW_URL="https://raw.githubusercontent.com/alecmuffett/real-world-onion-sites/refs/heads/master/README.md" + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Predefined actions -__build_onions_html() { - # temp file (POSIX-safe mktemp use) - tmp_md="$(mktemp 2>/dev/null || printf '/tmp/rwos.%s' "$$")" || { - printf '%s\n' "mktemp failed" >&2 - return 1 - } - trap 'rm -f "$tmp_md"' 0 1 2 3 15 - - # 1) Fetch README (UTF-8) - if ! curl -fsSL "$RAW_URL" >"$tmp_md"; then - printf '%s\n' "curl failed to fetch README" >&2 - return 2 - fi - - # 2) Emit full HTML - { - # --- HEAD (your exact head) --- - cat <<'HTML_HEAD' - - - - - - - - Welcome to your tor site - - -
-
-HTML_HEAD
-
-		# --- Body content pipeline ---
-		# Step A: replace GitHub :shortcodes: with emoji
-		# Step B: HTML-escape (&, <, >) to preserve literal layout
-		# Step C: auto-link http(s) URLs (done after escaping so  survives)
-		awk '
-      BEGIN { OFS=""; RS="\n"; ORS="\n" }
-      {
-        gsub(":white_check_mark:", "✅")
-        gsub(":closed_lock_with_key:", "🔐")
-        gsub(":small_red_triangle:", "🔺")
-        gsub(":key:", "🔑")
-        gsub(":question:", "❓")
-        gsub(":sos:", "🆘")
-        gsub(":alarm_clock:", "⏰")
-        gsub(":timer_clock:", "⏲️")
-        gsub(":exclamation:", "❗")
-        gsub(":eight_spoked_asterisk:", "✳️")
-        gsub(":crystal_ball:", "🔮")
-        gsub(":lock:", "🔒")
-        gsub(":arrow_up:", "⬆️")
-        gsub(":wrench:", "🔧")
-        gsub(":new:", "🆕")
-        print
-      }
-    ' "$tmp_md" |
-			awk '
-        # HTML-escape in correct order
-        { gsub(/&/, "&"); gsub(//, ">"); print }
-      ' |
-			awk '
-        # Auto-link URLs using POSIX awk (ERE), no gensub needed.
-        # Allowed URL chars kept conservative; onion links are fine.
-        {
-          line = $0
-          re = "https?://[A-Za-z0-9._~:/?#@!$&()*+,;=%-]+"
-          out = ""
-          while (match(line, re)) {
-            pre = substr(line, 1, RSTART-1)
-            url = substr(line, RSTART, RLENGTH)
-            line = substr(line, RSTART+RLENGTH)
-            out = out pre "" url ""
-          }
-          $0 = out line
-          print
-        }
-      '
-
-		# --- TAIL ---
-		cat <<'HTML_TAIL'
-
-
%s
\n' "Last uopdated on $(date +'%A, %B %d, %Y at %H:%M %Z')" -
- - -HTML_TAIL - } >"$LIST_INDEX_FILE" || { - printf '%s\n' "write failed: $LIST_INDEX_FILE" >&2 - return 3 - } - - printf 'Wrote %s\n' "$LIST_INDEX_FILE" >&2 -} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Main script -__build_onions_html + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set the exit code #exitCode=$?