# Minecraft Chat Viewer

An elegant website for displaying and formatting Minecraft chat logs with Docker/Coolify support.

## 🚀 Quick Start

### Option 1: Docker (Recommended for Production)
```bash
# Build the Docker image
docker build -t minecraft-chat-viewer .

# Run the container
docker run -p 5000:5000 minecraft-chat-viewer

# Open browser
http://localhost:5000
```

### Option 2: Coolify Deployment
1. Push your code to a Git repository
2. In Coolify, create a new application
3. Select "Docker" as deployment type
4. Point to your repository
5. Set port to `5000`
6. Deploy!

### Option 3: Local Development with Flask
```bash
# Install dependencies
pip install -r requirements.txt

# Run the Flask app
python app.py

# Open browser
http://localhost:5000
```

### Option 4: Legacy Python Server
```bash
# Start simple HTTP server
python server.py

# Open browser
http://localhost:8000
```

## 🗺️ Minecraft Server Maps (2020)

### Survival-1
- **21.08.2020**: https://file.devanturas.net/u/4uVh8r.zip

### crea-1
- **21.08.2020**: https://file.devanturas.net/u/UfmfKF.zip

### THESUR-1
- **18.08.2020**: https://file.devanturas.net/u/373GHK.zip
- **20.08.2020**: https://file.devanturas.net/u/NwkZou.zip
- **22.08.2020**: https://file.devanturas.net/u/zwLaEG.zip
- **23.08.2020**: https://file.devanturas.net/u/1KIMeq.zip
- **27.08.2020**: https://file.devanturas.net/u/3Y5u2M.zip
- **28.08.2020**: https://file.devanturas.net/u/h5bygb.zip
- **31.08.2020**: https://file.devanturas.net/u/jdZOo1.zip

## 📁 Project Structure

```
minecraft-chat-viewer/
├── app.py                # Flask application (Production)
├── server.py             # Simple HTTP server (Development)
├── Dockerfile            # Docker configuration
├── .dockerignore         # Docker build exclusions
├── .gitignore            # Git exclusions
├── requirements.txt      # Python dependencies
├── index.html            # Main page
├── style.css             # Styling
├── script.js             # JavaScript Logic
├── statistics.js         # Statistics module
├── statistics.css        # Statistics styling
├── statistics-integration.js  # Statistics integration
├── local-chat-analyzer.js    # Local chat analyzer
├── chat-logs/            # Chat files (included in Docker)
│   ├── chat-index.json   # Chat overview
│   └── *.txt             # Chat log files
├── maps/                 # Minecraft world maps (excluded from Git/Docker)
├── raw logs/             # Raw log files (excluded from Git/Docker)
└── stats/                # Statistics (excluded from Git/Docker)
```

## ✨ Features

- 📋 **Server-side Chat List**: All chats are managed centrally
- 🎨 **Beautiful Formatting**: Role badges, timestamps, player names
- ⚙️ **Customizable Settings**: Filters for different message types
- 📊 **Detailed Statistics**: Message count, player info
- 💾 **Export Function**: Download as formatted HTML file
- 🌙 **Dark Theme**: Minecraft-inspired design
- 📱 **Responsive**: Works on all devices

## 🔧 Adding New Chat Logs

### 1. Create Chat File
Create a new `.txt` file in `chat-logs/` with the Minecraft chat format:
```
[17:40:32] : Mod ▎ duencity2 joined the game
[17:41:07] : Member ▎ sdf7 : Hello everyone!
```

### 2. Update Index
Add the chat to `chat-logs/chat-index.json`:
```json
{
    "id": "my-new-chat",
    "title": "🎯 My New Chat",
    "description": "Description of the chat log",
    "date": "2020-12-25",
    "participants": ["Player1", "Player2"],
    "messages": 50,
    "filename": "my-new-chat.txt"
}
```

## 🎮 Supported Chat Format

The website automatically recognizes:
- **Timestamps**: `[HH:MM:SS]`
- **Roles**: Admin, Mod, Member
- **Join/Leave**: `joined the game`, `left the game`
- **Chat Messages**: `Role ▎ Player : Message`
- **System Messages**: Server events

## 🌐 Server Requirements

### Docker/Coolify
- **Docker**: 20.10+
- **Port**: 5000 (configurable via PORT environment variable)

### Local Development
- **Python 3.11+**
- **Flask 3.0+**
- **Modern Browsers**: Chrome/Edge 80+, Firefox 70+, Safari 13+

## 🐳 Docker Configuration

### Environment Variables
- `PORT` - Server port (default: 5000)
- `FLASK_ENV` - Environment mode (production/development)
- `FLASK_APP` - Flask application file (default: app.py)

### Health Check
The Docker container includes a health check endpoint:
- **URL**: `/health`
- **Interval**: 30s
- **Response**: `{"status": "healthy", "service": "minecraft-chat-viewer"}`

### Building and Running
```bash
# Build
docker build -t minecraft-chat-viewer .

# Run
docker run -d -p 5000:5000 --name minecraft-chat minecraft-chat-viewer

# Check logs
docker logs minecraft-chat

# Health check
curl http://localhost:5000/health
```

## 🔒 Security & Privacy

- ✅ **Completely offline usable**
- ✅ **No data is transmitted**
- ✅ **All files remain local**
- ✅ **No tracking or cookies**

## 🛠️ Development

The project uses:
- **Vanilla JavaScript** - No external dependencies
- **CSS Grid & Flexbox** - Modern layout
- **CSS Custom Properties** - Easy theming
- **Fetch API** - For loading chat files

## 📝 License

Open Source - Free to use for private and commercial purposes.

---

Made with ❤️ for better Minecraft chat viewing • 2025
