This commit is contained in:
Joan
2025-11-27 16:27:01 +01:00
parent 33cc9586c2
commit 81f8912059
304 changed files with 56149 additions and 10122 deletions

View File

@@ -36,6 +36,45 @@ Optional: Specify a custom port
python server.py --port 3000
```
## Map Editor
The server includes a built-in web-based editor for managing game data.
### Accessing the Editor
Navigate to: **http://localhost:8080/editor**
### Authentication
The editor requires a password for access. Set it via environment variable:
```bash
export EDITOR_PASSWORD="your_secure_password"
export EDITOR_SECRET_KEY="$(python -c 'import secrets; print(secrets.token_hex(32))')"
```
**Default password (if not set):** `admin123`
> [!WARNING]
> **Security**: Always change the default password in production! Set `EDITOR_PASSWORD` in your `.env` file.
### Editor Features
- **Locations Tab**: Edit location properties, coordinates, danger levels, spawn tables
- **NPCs Tab**: Manage enemy stats, loot tables, and spawn weights
- **Items Tab**: Edit item properties, stats, crafting recipes, repair materials
- **Interactables Tab**: Manage interactable templates and actions
- **Connections Tab**: Create/delete connections between locations
- **Logs Tab**: View API container logs and restart the bot
### Environment Variables
| Variable | Description | Default |
|----------|-------------|----------|
| `EDITOR_PASSWORD` | Password for editor access | `admin123` |
| `EDITOR_SECRET_KEY` | Flask session secret key | Auto-generated |
| `PORT` | Server port | `8080` |
## Features Overview
### Map Controls
@@ -100,8 +139,10 @@ The map dynamically loads data from `/map_data.json`, which is generated from th
### Server Architecture
- **Backend**: Python HTTP server with dynamic data generation
- **Backend**: Flask server with RESTful API
- **Frontend**: Vanilla JavaScript with HTML5 Canvas
- **Authentication**: Session-based with password protection
- **Data Storage**: Direct JSON file manipulation
- **Responsive**: CSS Grid and Flexbox layout
- **Real-time**: Live data from game world loader
@@ -195,8 +236,22 @@ To modify the map visualization:
2. Edit `index.html` for layout and UI
3. Edit `server.py` for data serving logic
To modify the editor:
1. Edit `editor.html` for editor UI layout
2. Edit `editor_enhanced.js` for editor functionality
3. Edit `server.py` API routes for backend logic
The server auto-loads changes - just refresh your browser!
## Security Best Practices
1. **Change Default Password**: Always set `EDITOR_PASSWORD` to a strong password
2. **Use HTTPS**: In production, use a reverse proxy (Traefik/Nginx) with SSL
3. **Restrict Access**: Use firewall rules to limit editor access to trusted IPs
4. **Backup Data**: Regularly backup `gamedata/` folder before making changes
5. **Test Changes**: Use the export/import feature to test changes before applying
## License
Part of the Echoes of the Ashes RPG project.