openreader/scripts/openreader-webui.sh
Sunny 9a929d98cb fix: address CodeRabbit review comments for PR #77
- Add SSRF validation to TTS route with baseUrl allowlist
- Fix concurrency.ts: validate maxConcurrent >= 1, fill aborted slots
- Add .env existence check to shell script with error messaging
- Add language identifier to README code block (markdownlint MD040)
- Add input validation and 30s timeout to groq-tts route
- Preserve previous summary on error in SummarizeModal
- Pass maxLength parameter through to summarize API
- Fix unused docType parameter in dexie.ts getSummary
- Reject whitespace-only text in summarize API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 04:57:41 +00:00

52 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# OpenReader WebUI - TTS Document Reader
# URL: http://localhost:3003
# Uses Groq Orpheus TTS via built-in /api/groq-tts route
set -e
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# Load GROQ_API_KEY
if [ -f "$SCRIPT_DIR/.env" ]; then
source "$SCRIPT_DIR/.env"
export GROQ_API_KEY
else
echo "ERROR: $SCRIPT_DIR/.env file not found"
echo "Please create the .env file with your GROQ_API_KEY"
exit 1
fi
# Stop existing service
fuser -k 3003/tcp 2>/dev/null || true
# Wait for port to be released
for _ in {1..10}; do
if ! fuser 3003/tcp 2>/dev/null; then
break
fi
echo "Waiting for port 3003 to be released..."
sleep 1
done
# Final check
if fuser 3003/tcp 2>/dev/null; then
echo "ERROR: Port 3003 still in use after 10 seconds"
exit 1
fi
# Build and run OpenReader WebUI
cd "$PROJECT_DIR"
pnpm install
pnpm build
# Start the app
nohup pnpm start > /tmp/openreader.log 2>&1 &
disown
echo "OpenReader WebUI started at http://localhost:3003"
echo "Groq TTS available at /api/groq-tts"
echo "Available voices: troy, austin, daniel, autumn, diana, hannah"
echo "Logs: /tmp/openreader.log"