Add frontpage

This commit is contained in:
sqozz 2021-03-23 14:37:38 +01:00
parent c709f9695a
commit 5e34263288
3 changed files with 156 additions and 1 deletions

28
homepage/html/index.html Normal file
View file

@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>play.geekify.de Minecraftserver</title>
<meta name="description" content="play.geekify.de Minecraftserver">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div class="content">
<div class="player_count">Players Online: {{player_count}}/{{max_players}}</div>
<div class="items">
<a class="row news" href="/news">
<div class="icon"></div>
<div class="text">News</div>
</a>
<a class="row map" href="https://play.geekify.de">
<div class="icon"></div>
<div class="text">Map</div>
</a>
<a class="row whitelist" href="/request">
<div class="icon"></div>
<div class="text">Request Invite</div>
</a>
</div>
</div>
</body>
</html>

View file

@ -1,2 +1,35 @@
#!/usr/bin/env python3 #!/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("/<path:path>")
def callback(path):
return static_file(path, root="static")
run(host="localhost", port=8080)

View file

@ -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');
}