#!/bin/bash
# Script pour lancer un serveur HTTP local simple

PORT=8000

echo "🚀 Démarrage du serveur HTTP sur le port $PORT..."
echo "📂 Racine: $(pwd)"
echo ""
echo "🌐 Ouvrez votre navigateur à l'adresse:"
echo "   http://localhost:$PORT"
echo ""
echo "💡 Pour tester les téléchargements, utilisez:"
echo "   http://localhost:$PORT/test-download.html"
echo ""
echo "⏹️  Appuyez sur Ctrl+C pour arrêter le serveur"
echo ""

# Essayer Python 3 en premier
if command -v python3 &> /dev/null; then
    python3 -m http.server $PORT
# Sinon essayer Python 2
elif command -v python &> /dev/null; then
    python -m SimpleHTTPServer $PORT
# Sinon essayer PHP
elif command -v php &> /dev/null; then
    php -S localhost:$PORT
else
    echo "❌ Erreur: Aucun serveur HTTP disponible"
    echo "   Installez Python ou PHP pour utiliser ce script"
    exit 1
fi
