diff --git a/homepage/html/index.html b/homepage/html/index.html new file mode 100644 index 0000000..f044738 --- /dev/null +++ b/homepage/html/index.html @@ -0,0 +1,28 @@ + + + + + play.geekify.de Minecraftserver + + + + +
+
Players Online: {{player_count}}/{{max_players}}
+
+ +
+
News
+
+ +
+
Map
+
+ +
+
Request Invite
+
+
+
+ + diff --git a/homepage/main.py b/homepage/main.py index 9c0ecf1..5578318 100644 --- a/homepage/main.py +++ b/homepage/main.py @@ -1,2 +1,35 @@ #!/usr/bin/env python3 -import bottle +from bottle import route, run, static_file, template +from os import listdir +from os.path import join as pathjoin +from random import random, choice + +# echo -n "["; ls | xargs -I{} echo -n \"{}\",; echo "]" +BG_IMAGES = listdir("./static/img/background") + +@route("/") +def index(): + return template("html/index.html", **{"player_count": int(random()*20), "max_players": 20}) + +@route("/request") +def request_whitelist(): + return "ok" + +@route("/img/bg.png") +def random_bg_image(): + bg_file = choice(BG_IMAGES) + print(bg_file) + response = static_file(bg_file, root="static/img/background") + response.set_header("Cache-Control", "no-cache") + response.set_header("Cache-Control", "no-store") + response.set_header("Pragma-Directive", "no-cache") + response.set_header("Cache-Directive", "no-cache") + response.set_header("Pragma", "no-cache") + response.set_header("Expires", "0") + return response + +@route("/") +def callback(path): + return static_file(path, root="static") + +run(host="localhost", port=8080) diff --git a/homepage/static/css/styles.css b/homepage/static/css/styles.css new file mode 100644 index 0000000..ca8fa54 --- /dev/null +++ b/homepage/static/css/styles.css @@ -0,0 +1,94 @@ +* { + font-family: "minecraft", "monospace"; +} + +html { + background-image: url("/img/bg.png"); + image-rendering: crisp-edges; + background-size: 100px; + height: 100%; +} + +body { + height: 100%; + margin: 0px; +} + +.content { + margin: auto; + width: 50%; + /*border: 3px solid green;*/ + padding: 10px; + height: 100%; + box-sizing: border-box; +} + +.player_count { + text-align: center; + margin: 3pt; + font-size: 40pt; + text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white; +} + +.items { + width: 70%; + margin: auto; +} + +.news .icon { + content:url('/img/birch_sign.png'); +} + +.map .icon { + content:url('/img/map.png'); +} + +.whitelist .icon { + content:url('/img/writable_book.png'); +} + +.row { + display: flex; + background-color: gray; + margin-bottom: 10pt; + padding: 2pt; + color: #d7d7d7; + border: 5px solid black; + background-image: url("/img/redstone_lamp.png"); + background-size: 55px; + text-decoration: none; + text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; + box-shadow: 5px 5px 15px black; +} + +.row:hover { + background-color: red; + cursor: pointer; + background-image: url("/img/redstone_lamp_on.png"); + background-size: 55px; + color: #FFFFFF; + text-decoration: underline; +} + +.items :last-child { + margin-bottom: 0pt; +} + +.row .icon { + width: 50pt; + height: auto; + image-rendering: crisp-edges; + padding: 10pt; +} + +.row .text { + display: flex; + align-items: center; + font-size: 25pt; + font-weight: bold; +} + +@font-face { + font-family: 'minecraft'; + src: URL('/fonts/Minecraft.ttf') format('truetype'); +}