134 lines
6.7 KiB
Markdown
134 lines
6.7 KiB
Markdown
# Luanti-Web: A dynamic website-toolkit
|
|
|
|
Welcome to the Luanti Web Generator! Born from a passion for creative sandbox gaming, this hobby project provides a powerful, automated toolkit for generating a beautiful and feature-rich static website for your Minetest or Luanti server. Showcase your server, worlds, track your players, and inform your community.
|
|
|
|
This system is designed from the ground up to be modular, easily configurable, and perfect for small communities who want web presence without the hassle.
|
|
|
|
## ✨ Features
|
|
|
|
* **Automated Map Generation:** Leverages `minetestmapper` to create high-resolution PNG maps of your game worlds.
|
|
* **Performant Image Processing:** Uses `vips` for all image processing tasks (resizing and metadata reading), providing a massive performance increase and support for huge maps. The project is now completely independent of ImageMagick.
|
|
* **Tiled Map Generation:** Uses `gdal2tiles.py` to create performant, zoomable map tiles for a smooth user experience.
|
|
* **Dynamic Map Viewer:** Implements an interactive map viewer using **OpenLayers**, powered by the generated map tiles, including digital zoom beyond the highest resolution.
|
|
* **Live Data Overlays:** Dynamically fetches player positions and protected areas, displaying them as interactive overlays on the live map.
|
|
* **Layer Control:** A menu on the map allows users to toggle the visibility of Players, Parent Areas, and Sub-Areas (Parcels).
|
|
* **Map Archive:** Automatically saves a daily snapshot of the map and makes it available through a toggle on the world detail page.
|
|
* **Template-Driven Site Generation:** Builds all static HTML pages from simple, customizable templates.
|
|
* **Flexible Configuration:** Configuration is easy with a central global `config.sh` and a `web.conf`-file for every of your worlds.
|
|
* **Automation-Ready:** Designed for unattended execution via scheduling tools like `cron`.
|
|
|
|
## 🔧 Prerequisites
|
|
|
|
To run this system, the following software packages must be installed on your server:
|
|
|
|
* **bash:** The scripting language used for the entire project.
|
|
* **vips:** A high-performance image processing library.
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install libvips-tools`
|
|
* **GDAL/OGR:** Provides the `gdal2tiles.py` script for tile generation.
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install gdal-bin python3-gdal`
|
|
* **SQLite3:** The command-line tool to query the game databases (`players.sqlite`, `auth.sqlite`).
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install sqlite3`
|
|
* **bc:** The "basic calculator" command-line tool, required for calculations in scripts.
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install bc`
|
|
* **jq:** A command-line JSON processor, used by `sync_areas.sh`.
|
|
* *Debian/Ubuntu Install:* `sudo apt-get install jq`
|
|
* **minetestmapper:** The executable used to render maps from world data. This must be placed within the project directory.
|
|
* **iproute2:** Provides the `ss` command for `check_server_status.sh` (usually pre-installed on most systems).
|
|
* **Web Server:** A web server like Nginx or Apache is needed to serve the generated static files.
|
|
|
|
An included script (`check_dependencies.sh`) can automatically verify all important dependencies.
|
|
|
|
## ⚙️ Installation & Setup
|
|
|
|
### 1. Project Files
|
|
|
|
Download the **latest build** from the [Releases-Page](https://git.geigernet.eu/rainer/luanti-web/releases) and extract it to a base directory on your server, such as `/opt/luweb/`.
|
|
|
|
OR
|
|
|
|
Clone the Git repository to a base directory.
|
|
|
|
```bash
|
|
git clone https://git.geigernet.eu/rainer/luanti-web.git /opt/luweb
|
|
cd /opt/luweb
|
|
# Make all scripts executable
|
|
chmod +x generate_map.sh generate_site.sh check_server_status.sh check_dependencies.sh sync_players.sh sync_areas.sh
|
|
```
|
|
|
|
### 2. Global Configuration
|
|
|
|
The main configuration file is `config.sh`. You must edit this file to match your server's environment.
|
|
|
|
### 3. Per-World Configuration
|
|
|
|
The system is designed so that **only worlds with a `web.conf` file** will be displayed in the web frontend. This gives you full control over which worlds are publicly visible. To add a world, copy the template `site_generator/examples/web.conf.template` into the data directory of the respective world and adjust the values.
|
|
|
|
## 📂 Directory Structure
|
|
|
|
```md
|
|
/opt/luweb/
|
|
├── config.sh
|
|
├── generate_map.sh
|
|
├── generate_site.sh
|
|
├── check_server_status.sh
|
|
├── check_dependencies.sh
|
|
├── sync_players.sh
|
|
├── sync_areas.sh
|
|
├── minetestmapper (executable)
|
|
├── site_generator/
|
|
│ ├── functions/
|
|
│ │ └── ...
|
|
│ ├── templates/
|
|
│ └── examples/
|
|
├── web_content/
|
|
└── worldmaps_output/
|
|
└── <world_name>/
|
|
├── map.png
|
|
└── map_info.txt
|
|
```
|
|
|
|
## 🚀 Usage & Automation (Cronjob)
|
|
|
|
The scripts are designed for automated execution. If run without a `<world_key>` argument, they will process all worlds that contain a `web.conf` file.
|
|
|
|
**Example for `crontab -e`:**
|
|
```bash
|
|
# Update player data for all worlds every minute
|
|
* * * * * cd /opt/luweb && ./sync_players.sh >> /var/log/luweb/cron.log 2>&1
|
|
|
|
# Check server online status every 5 minutes
|
|
*/5 * * * * cd /opt/luweb && ./check_server_status.sh >> /var/log/luweb/cron.log 2>&1
|
|
|
|
# Generate map and tiles for all worlds once per hour
|
|
0 * * * * cd /opt/luweb && ./generate_map.sh >> /var/log/luweb/cron.log 2>&1
|
|
|
|
# Sync area data and rebuild the static site twice a day
|
|
45 */12 * * * cd /opt/luweb && ./sync_areas.sh >> /var/log/luweb/cron.log 2>&1
|
|
40 */12 * * * cd /opt/luweb && ./sync_tpads.sh >> /var/log/luweb/cron.log 2>&1
|
|
30 */12 * * * cd /opt/luweb && ./generate_site.sh >> /var/log/luweb/cron.log 2>&1
|
|
```
|
|
|
|
## 📄 License
|
|
**MIT License**
|
|
Copyright (c) 2025 Rage87 - rage87@geigernet.eu
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
## 👤 Autoren
|
|
* **Rage87** (Main-Developer)
|