Add ONION-URLS.md, export script, and tighten README

- ONION-URLS.md: static registry of all 43 hidden services (port, role, app path)
- scripts/export-onion-urls.sh: writes live .onion addresses to onion-urls.txt at runtime
- npm run onions:export shortcut added to package.json
- onion-urls.txt added to .gitignore (runtime artifact, not source)
- README: cohesive rewrite — architecture diagram, operator command table, source-of-truth
  map, BTCPay notes, full site map, common fixes
- BTCPay status route: awaited params destructuring (Next 15 async params)

Made-with: Cursor
This commit is contained in:
drjones
2026-04-16 18:03:30 -07:00
parent 4354416f1c
commit cb072437d0
6 changed files with 348 additions and 201 deletions

71
scripts/export-onion-urls.sh Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# Export all live CyberLux .onion URLs to onion-urls.txt in the repo root.
# Reads /var/lib/tor/*/hostname — run with sudo if needed.
#
# bash scripts/export-onion-urls.sh
# sudo bash scripts/export-onion-urls.sh
#
set -euo pipefail
REPO="$(cd "$(dirname "$0")/.." && pwd)"
TOR_DIRS="${REPO}/scripts/generated/tor-dirs.txt"
LABELS="${REPO}/scripts/generated/onion-labels.tsv"
OUT="${REPO}/onion-urls.txt"
if [[ ! -f "${TOR_DIRS}" ]]; then
echo "[!] Missing ${TOR_DIRS}. Run: node scripts/generate-onion-config.cjs"
exit 1
fi
declare -A ROLE=()
if [[ -f "${LABELS}" ]]; then
while IFS=$'\t' read -r dir desc || [[ -n "${dir}" ]]; do
[[ -z "${dir}" ]] && continue
ROLE["${dir}"]="${desc}"
done < "${LABELS}"
fi
read_host() {
local f="$1"
if [[ -r "${f}" ]]; then
tr -d '\n' < "${f}"
elif command -v sudo >/dev/null 2>&1 && sudo test -r "${f}" 2>/dev/null; then
sudo tr -d '\n' < "${f}"
else
echo ""
fi
}
{
echo "# CyberLux — Live .onion URLs"
echo "# Generated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
echo "# Open in: Tor Browser / Onion Browser (iOS) — http:// only"
echo "#"
echo ""
ready=0
missing=0
while IFS= read -r d || [[ -n "${d}" ]]; do
[[ -z "${d}" ]] && continue
f="/var/lib/tor/${d}/hostname"
host="$(read_host "${f}")"
role="${ROLE[$d]:-}"
if [[ -n "${host}" ]]; then
printf '%-28s http://%s\n' "${d}" "${host}"
[[ -n "${role}" ]] && printf '%-28s %s\n' "" "# ${role}"
echo ""
((ready++)) || true
else
printf '%-28s (not available — %s)\n' "${d}" "${f}"
echo ""
((missing++)) || true
fi
done < "${TOR_DIRS}"
echo "# Services resolved: ${ready}"
[[ "${missing}" -gt 0 ]] && echo "# Services pending: ${missing} (start Tor and wait ~30s)"
} > "${OUT}"
echo "[*] Wrote ${OUT}"
echo "[*] Services resolved: ${ready} / $((ready + missing))"
[[ "${missing}" -gt 0 ]] && echo "[!] ${missing} hostname(s) not yet available — run again after Tor fully starts."