#!/usr/bin/env bash # Quick local checks for Tor → nginx → Next. Does not need sudo. # If .onion URLs fail in Tor Browser but this script is OK, export fresh URLs: # sudo bash scripts/export-onion-urls.sh # and use http:// (not https://) in Tor Browser. set -euo pipefail REPO="$(cd "$(dirname "$0")/.." && pwd)" cd "${REPO}" echo "" echo "━━ CyberLux onion stack (local) ━━" echo "" http_code() { curl -g -sS -o /dev/null -w "%{http_code}" --connect-timeout 3 --max-time 8 "$1" 2>/dev/null || echo "000" } c300="$(http_code "http://127.0.0.1:3000/")" c8080="$(http_code "http://127.0.0.1:8080/")" echo " Next.js (upstream) 127.0.0.1:3000 → HTTP ${c300}" echo " nginx hub (Tor target) 127.0.0.1:8080 → HTTP ${c8080}" if [[ "${c300}" =~ ^(200|301|302|304)$ ]]; then echo " Next.js: OK" else echo " Next.js: FAIL — onions will 502 until you run: npm run start:onion or systemctl start cyberlux.service" fi if [[ "${c8080}" =~ ^(200|301|302|304)$ ]]; then echo " Hub vhost: OK" else echo " Hub vhost: FAIL — check: systemctl status nginx" fi if command -v systemctl >/dev/null 2>&1; then echo "" echo " systemd:" systemctl is-active tor@default 2>/dev/null | sed 's/^/ tor@default: /' || echo " tor@default: (unknown)" systemctl is-active nginx 2>/dev/null | sed 's/^/ nginx: /' || echo " nginx: (unknown)" if systemctl list-unit-files cyberlux.service &>/dev/null; then systemctl is-active cyberlux.service 2>/dev/null | sed 's/^/ cyberlux.service: /' || true else echo " cyberlux.service: not installed (optional: sudo CYBERLUX_USER=\$USER bash scripts/install-systemd.sh)" fi fi echo "" if [[ -f "${REPO}/onion-urls.txt" ]]; then echo " onion-urls.txt: present (first lines):" grep -vE '^#|^$' "${REPO}/onion-urls.txt" 2>/dev/null | head -6 | sed 's/^/ /' || true else echo " onion-urls.txt: missing — run after Tor is up:" echo " sudo bash scripts/export-onion-urls.sh" fi echo "" echo " Full port + hostname table: node scripts/onion-status.cjs" echo ""