mirror of
https://github.com/JonasunderscoreJones/wiki.jonasjones.dev.git
synced 2025-10-22 22:09:17 +02:00
add: McWebserver entries
This commit is contained in:
parent
5d46775174
commit
315d13cde8
6 changed files with 403 additions and 0 deletions
38
src/routes/McWebserver/+page.md
Normal file
38
src/routes/McWebserver/+page.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# McWebserver
|
||||
---
|
||||
This is the fabric port, the Forge version is available [here](https://github.com/J-onasJones/McWebserver-forge)
|
||||
|
||||
<a href="https://github.com/J-onasJones/McWeberver/blob/master/LICENSE"><img src="https://img.shields.io/github/license/J-onasJones/McWebserver?style=flat&color=900c3f" alt="License"></a>
|
||||
<a href="https://discord.gg/V2EsuUVmWh"><img src="https://img.shields.io/discord/702180921234817135?color=5865f2&label=Discord&style=flat" alt="Discord"></a>
|
||||
<a href="https://www.curseforge.com/minecraft/mc-mods/mcwebserver"><img src="https://cf.way2muchnoise.eu/full_649823.svg" alt="CF"></a>
|
||||
<a href="https://modrinth.com/mod/mcwebserver"><img src="https://img.shields.io/modrinth/dt/mcwebserver?logo=modrinth&label=&style=flat&color=242629&labelColor=00AF5C&logoColor=white" alt="Modrinth"></a>
|
||||
<a href="https://modrinth.com/mod/mcwebserver"><img src="https://img.shields.io/modrinth/game-versions/mcwebserver?logo=modrinth&color=242629&labelColor=00AF5C&logoColor=white"></a>
|
||||
|
||||

|
||||
|
||||
<a align="center"><img src="http://cdn.jonasjones.dev/mod-badges/support-fabric.png" width="250px"><img src="http://cdn.jonasjones.dev/mod-badges/support-quilt.png" width="250px"><img src="http://cdn.jonasjones.dev/mod-badges/support-forge.png" width="250px"></a>
|
||||
<img src="http://cdn.jonasjones.dev/mod-badges/fabric-api.png" width="250px">
|
||||
|
||||
|
||||
|
||||
### About the mod
|
||||
This mod runs a simple HTTP server alongside the minecraft server.
|
||||
The mod allows You to host websites and share files and Server Backups directly from your server without the need of a seperate server setup. Adjust the port and design your website.
|
||||
|
||||
### API
|
||||
It also has a powerful API allowing you to fetch server info about players and the server itself. More info on the [API's Wiki page](https://github.com/J-onasJones/McWebserver/wiki/3.-Web%E2%80%90API)
|
||||
|
||||
The http server has up to no performance impact on the server
|
||||
|
||||
### Warning
|
||||
If used wrongly this mod can be a security risk for your server and all devices connected to the network that your server is in.
|
||||
|
||||
Do **only** put files into your webservers root directory that you want to be accessible to the internet. Those files are **public** to the entire world.
|
||||
|
||||
**Use at your own risk!**
|
||||
|
||||
|
||||
<img src="https://cdn.jonasjones.dev/mod-badges/available-modrinth.png" width="250px">
|
||||
|
||||
### Setup
|
||||
For Setup and further Info, please refer to the [setup page](http://localhost:5173/McWebserver/1.Setup)
|
12
src/routes/McWebserver/1.Setup/+page.md
Normal file
12
src/routes/McWebserver/1.Setup/+page.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Setup
|
||||
---
|
||||
1. Download the latest version of McWebserver from [modrinth](https://modrinth.com/mod/mcwebserver) or [curseforge](https://www.curseforge.com/minecraft/mc-mods/mcwebserver) as well as the Fabric API into your mods folder
|
||||
2. Start the Minecraft Server and let the mod create the config file
|
||||
3. Open the Config File, enable the webserver and configure the mod further. View [Mod Configuration (config-file)](/McWebserver/2.Mod-Configuration-(config-file)) for more information
|
||||
4. Use the example html files or create your own:
|
||||
- index.html
|
||||
- 404.html
|
||||
- not_supported.html
|
||||
- favicon.ico
|
||||
5. Port forward the webserver port if you plan on using it publicly
|
||||
6. Take a look at how to [configure the loggers](/McWebserver/5.Loggers) to prevent unnecessary spam.
|
|
@ -0,0 +1,38 @@
|
|||
# Mod Configuration (config-file)
|
||||
---
|
||||
The config file consists of the following entries:
|
||||
### web.isEnabled
|
||||
- enables/disables the entire mod
|
||||
- accepts: `true`/`false`
|
||||
|
||||
### web.port
|
||||
- sets the webserver port
|
||||
- accepts: `1`...`65535` (make sure to not have port conflicts)
|
||||
|
||||
### web.root
|
||||
- sets the root directory of the webserver, starting from the minecraft server directory
|
||||
- accepts: any file path
|
||||
|
||||
### web.api
|
||||
- enables/disables the basic API
|
||||
- accepts: `true`/`false`
|
||||
|
||||
### web.api.adv
|
||||
- enables/disables the advanced API
|
||||
- accepts: `true`/`false`
|
||||
|
||||
### web.file.root
|
||||
- the name of the html file of the homepage
|
||||
- accepts: any path with `[filename].html` at the end
|
||||
|
||||
### web.file.404
|
||||
- the name of the 404 page html file
|
||||
- accepts: any path with `[filename].html` at the end
|
||||
|
||||
### web.file.notSupported
|
||||
- the name of the html file for the "not supported" page if any internal errors occur
|
||||
- accepts: any path with `[filename].html` at the end
|
||||
|
||||
### logger.verbose
|
||||
- enables/disables the verbose logger (more info at [5. Loggers](/McWebserver/5.Loggers))
|
||||
- accepts: `true`/`false`
|
286
src/routes/McWebserver/3.Web-API/+page.md
Normal file
286
src/routes/McWebserver/3.Web-API/+page.md
Normal file
|
@ -0,0 +1,286 @@
|
|||
# Web-API
|
||||
---
|
||||
*This feature exists as of version 0.3.0 of McWebserver*
|
||||
|
||||
The API is split into two parts. the Simple API and the Advanced API.
|
||||
|
||||
# What is an API?
|
||||
An API allows you to get information from the server in form of `json` code.
|
||||
|
||||
As an example we can fetch ourselves the server MOTD to display it on our website.
|
||||
|
||||
This API call will get you the following response:
|
||||
- API call (replace `localhost` with your IP and the port with your actual webserver port from the config file):
|
||||
```
|
||||
http://localhost:8080/api/v1/motd
|
||||
```
|
||||
- Result:
|
||||
```json
|
||||
["A Minecraft Server"]
|
||||
```
|
||||
|
||||
|
||||
# Simple API
|
||||
This API allows you to gather the most surface-level information about your server.
|
||||
|
||||
**All API calls have the prefix `/api/v1/`.**
|
||||
|
||||
The supported API calls are
|
||||
|
||||
### Server MOTD
|
||||
- Returns the Server MOTD
|
||||
```
|
||||
http://localhost:8080/api/v1/motd
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["A Minecraft Server"]
|
||||
```
|
||||
|
||||
### Server IP address
|
||||
- Returns the Server's IP address, if set in the server's `server.properties` file, or else returns an empty string
|
||||
```
|
||||
http://localhost:8080/api/v1/serverip
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
[""]
|
||||
```
|
||||
|
||||
### Server Port
|
||||
- Returns the Server's port
|
||||
```
|
||||
http://localhost:8080/api/v1/serverport
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["25565"]
|
||||
```
|
||||
|
||||
### Server Name
|
||||
- Returns the Server's Name, if set in the server's `server.properties` file, or else returns an empty string
|
||||
```
|
||||
http://localhost:8080/api/v1/servername
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["Server"]
|
||||
```
|
||||
|
||||
### Server MC Version
|
||||
- Returns the Server's Minecraft Version
|
||||
```
|
||||
http://localhost:8080/api/v1/serverversion
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["1.20.1"]
|
||||
```
|
||||
|
||||
### Fabric/Quilt Loader Version
|
||||
- Returns the Mod-loader version
|
||||
```
|
||||
http://localhost:8080/api/v1/loaderversion
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["0.14.22"]
|
||||
```
|
||||
|
||||
### Server Player Count
|
||||
- Returns the current player count.
|
||||
```
|
||||
http://localhost:8080/api/v1/currentplayercount
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["0"]
|
||||
```
|
||||
|
||||
### Server Default Gamemode
|
||||
- Returns the Server's default gamemode
|
||||
```
|
||||
http://localhost:8080/api/v1/defaultgamemode
|
||||
```
|
||||
- Responses:
|
||||
```json
|
||||
["SURVIVAL"]
|
||||
```
|
||||
or
|
||||
```json
|
||||
["CREATIVE"]
|
||||
```
|
||||
or
|
||||
```json
|
||||
["SPECTATOR"]
|
||||
```
|
||||
|
||||
### Server Max Player Count
|
||||
- Returns the Server's maximum player allowance
|
||||
```
|
||||
http://localhost:8080/api/v1/maxplayercount
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["20"]
|
||||
```
|
||||
|
||||
### Server Current Player Names
|
||||
- Returns the Server's currently online players
|
||||
```
|
||||
http://localhost:8080/api/v1/playernames
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"ID": "c888eef5-edb7-4ceb-bbf3-987731de9747",
|
||||
"NAME": "Jonas_Jones",
|
||||
"LEGACY": false
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Server Ticks
|
||||
- Returns the Server's tick count
|
||||
```
|
||||
http://localhost:8080/api/v1/ticks
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["20456"]
|
||||
```
|
||||
|
||||
### Server Ticktime
|
||||
- Returns the Server's time it takes to process a single tick in Milliseconds
|
||||
```
|
||||
http://localhost:8080/api/v1/ticktime
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["0.1235235"]
|
||||
```
|
||||
|
||||
### Server Time-reference
|
||||
- Returns the Server's in-game time of the day of the overworld
|
||||
```
|
||||
http://localhost:8080/api/v1/timereference
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
["20"]
|
||||
```
|
||||
|
||||
### Server Metadata
|
||||
- Returns the Server's Metadata. This includes all the information that is also being sent to a Minecraft client when pinging the server.
|
||||
```
|
||||
http://localhost:8080/api/v1/servermetadata
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
{
|
||||
"DESCRIPTION": "A Minecraft Server",
|
||||
"PLAYERS": {
|
||||
"MAX":20,
|
||||
"ONLINE":1,
|
||||
"SAMPLE": [
|
||||
{
|
||||
"ID": "00000000-0000-0000-0000-000000000000",
|
||||
"NAME": "Anonymous Player",
|
||||
"LEGACY": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"VERSION": {
|
||||
"version": "1.20.1",
|
||||
"protocol": 763
|
||||
},
|
||||
"FAVICON": "/api/v1/servericon",
|
||||
"SECURE_CHAT_EINFORCED":true
|
||||
}
|
||||
```
|
||||
|
||||
### Server All-Info
|
||||
- Returns the Server's entire data of the Simple API
|
||||
```
|
||||
http://localhost:8080/api/v1/getall
|
||||
```
|
||||
- Response:
|
||||
```json
|
||||
{
|
||||
"SERVER_IP": "",
|
||||
"SERVER_PORT": 25565,
|
||||
"SERVER_NAME": "Server",
|
||||
"DEFAULT_GAME_MODE": "SURVIVAL",
|
||||
"LOADER_VERSION": "0.14.22",
|
||||
"METADATA": {
|
||||
"DESCRIPTION": "A Minecraft Server",
|
||||
"PLAYERS": {
|
||||
"MAX": 20,
|
||||
"ONLINE": 1,
|
||||
"SAMPLE": [
|
||||
{
|
||||
"ID": "00000000-0000-0000-0000-000000000000",
|
||||
"NAME": "Anonymous Player",
|
||||
"LEGACY": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"VERSION": {
|
||||
"version": "1.20.1",
|
||||
"protocol": 763
|
||||
},
|
||||
"FAVICON": "/api/v1/servericon",
|
||||
"SECURE_CHAT_EINFORCED": true
|
||||
},
|
||||
"TICKS": 29066,
|
||||
"TICK_TIME": 4.6665154,
|
||||
"TIME_REFERENCE": 29606414
|
||||
}
|
||||
```
|
||||
|
||||
### Server Favicon
|
||||
- Returns the server icon image in form of a png
|
||||
```
|
||||
http://localhost:8080/api/v1/favicon
|
||||
```
|
||||
- Response
|
||||
[image/png]
|
||||
|
||||
## Errors
|
||||
When interacting with the API some errors can occur.
|
||||
|
||||
### Bad Request
|
||||
- Occurs when a request doesn't exist
|
||||
```
|
||||
http://localhost:8080/api/v1/getmotd
|
||||
```
|
||||
In this example the request is wrong. `getmotd` isn't a valid request.
|
||||
- Response
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"status": 400,
|
||||
"message": "Bad Request"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Internal Server Error
|
||||
- Occurs when something unexpected happens internally while handling the request. This most likely has nothing to do with you.
|
||||
|
||||
One possible way of getting the error message is to send the request before the server has fully started, more precise while loading the world.
|
||||
|
||||
- Response
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"status": 500,
|
||||
"message": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
```
|
||||
# Advanced API
|
||||
This is still WIP and is unreleased.
|
||||
In the future it will be possible to get more information about players, their ingame coordinates, inventory, etc.
|
||||
Stay tuned for updates!
|
11
src/routes/McWebserver/4.Performance/+page.md
Normal file
11
src/routes/McWebserver/4.Performance/+page.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Performance
|
||||
---
|
||||
McWebserver attempts to be as lightweight as possible.
|
||||
|
||||
An experiment shows that this is clearly the case. Even when the server is getting DDOS'ed and the website might not be available due to the high demand of the DDOS, the server still runs perfectly fine.
|
||||
|
||||
The following gif shows a ddos script using 300 threads (300 simultaneous requests at a time) and the server's MSPT (Milliseconds per Tick) only rising my about 2ms while under the DDOS attack.
|
||||
|
||||
Notice: This isn't a scientific test and I wouldn't claim that the server can withstand a real DDOS attack. The results only give an idea of the performance impact under elevated load and medium demand.
|
||||
|
||||
[View performance impact (gif)](https://cdn.jonasjones.dev/misc/mcwebserver-ddos-performance-impact.gif)
|
18
src/routes/McWebserver/5.Loggers/+page.md
Normal file
18
src/routes/McWebserver/5.Loggers/+page.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Loggers
|
||||
---
|
||||
McWebserver has two different loggers: Default and Verbose.
|
||||
|
||||
## Default Logger
|
||||
This loggers is always enabled and logs the most important stuff such as:
|
||||
- Mod initialized
|
||||
- Webserver enabled/disabled
|
||||
- API enabled/disabled
|
||||
- Webserver starting/stopping
|
||||
- Webserver started/stopped
|
||||
- Internal errors while handling requests (this means only error 500)
|
||||
|
||||
## Verbose Logger
|
||||
This logger can be toggled in the config file and logs stuff like:
|
||||
- Verbose Logger enabled
|
||||
- Config loaded
|
||||
- Connection opened/closed
|
Loading…
Add table
Add a link
Reference in a new issue