Ver Fonte

Links and player list work

Peter Oertel há 2 anos atrás
pai
commit
e9c7692fcd
3 ficheiros alterados com 97 adições e 12 exclusões
  1. 13 3
      flaskapp.py
  2. 57 2
      static/css/custom.css
  3. 27 7
      templates/home.html

+ 13 - 3
flaskapp.py

@@ -16,22 +16,32 @@ def home():
             os.environ["HOST"],
             "-p",
             os.environ["PASSWORD"],
-            "list",
+            "list uuids",
         ],
         capture_output=True,
         text=True,
     )
-    messages = result.stdout.split(": ")
+    messages = result.stdout.strip().split(": ")
     messagelist = messages[0].split(" ")
     usercount = messagelist[2]
     maxcount = messagelist[7]
     userlist = None
+    usercombolist = None
 
     if len(messages) > 1:
         userlist = messages[1].split(", ")
 
+        usercombolist = []
+        for user in userlist:
+            username = user[: user.find(" ")]
+            uuid = user[user.find("(") + 1 : -1]
+            usercombolist.append((username, uuid))
+
     return render_template(
-        "home.html", usercount=usercount, maxcount=maxcount, userlist=userlist
+        "home.html",
+        usercount=usercount,
+        maxcount=maxcount,
+        userlist=usercombolist,
     )
 
 

+ 57 - 2
static/css/custom.css

@@ -3,7 +3,7 @@
 }
 
 .header {
-    margin-top: 6rem;
+    padding-top: 6rem;
     text-align: center;
 }
 
@@ -126,7 +126,7 @@
 /* Larger than phone */
 @media (min-width: 550px) {
     .header {
-        margin-top: 18rem;
+        padding-top: 18rem;
     }
 
     .value-props {
@@ -318,4 +318,59 @@
     .popover-item:first-child .popover-link:hover:after {
         border-bottom-color: #33C3F0;
     }
+}
+
+body {
+    background-color: #222;
+    color: lightgray;
+}
+
+.parallaxbox {
+    background-image: url("https://wallpapercave.com/wp/xIzYo2d.jpg");
+    background-attachment: fixed;
+    background-position: center;
+    background-repeat: no-repeat;
+    background-size: cover;
+    min-height: 30rem;
+    display: flex;
+    flex-direction: row;
+    flex-wrap: wrap;
+    align-items: center;
+    justify-content: space-around;
+}
+
+.parallaxbox .button {
+    margin-bottom: 0;
+}
+
+.button {
+    background-color: green;
+    color: lightgray;
+}
+
+.playerbox {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    margin-top: 2rem;
+}
+
+.playerline {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: center;
+    padding: 2rem;
+    font-size: large;
+    background-color: #333;
+}
+
+.playerline img {
+    max-height: 5rem;
+    margin-right: 2rem;
+}
+
+a .playerline span {
+    text-decoration: none;
+    color: green;
 }

+ 27 - 7
templates/home.html

@@ -16,14 +16,34 @@
     <body>
         <div class="container">
             <section class="header">
-                <h2 class="title">Boppers Bizza Minecraft Server</h2>
-                <h4>{{ usercount }}/{{ maxcount}}</h4>
-                {% if userlist %}
-                {% for user in userlist %}
-                <h5>{{ user }}</h5>
-                {% endfor %}
-                {% endif %}
+                <h1 class="title">Boppers Bizza Minecraft Server</h1>
+                <h3>Current Modpack: Prominence II v.2.8.0hf</h3>
             </section>
         </div>
+        <div class="parallaxbox">
+            <a
+                href="https://www.curseforge.com/minecraft/modpacks/prominence-2-rpg"
+                class="button">Download Modpack on Curseforge</a>
+            <a href="https://www.curseforge.com/download/app"
+                class="button">Download
+                Curseforge Launcher</a>
+            <a href="https://prismlauncher.org/" class="button">Download Prism
+                Launcher</a>
+        </div>
+        <div class="containe playerbox">
+            <h4>Current Players: {{ usercount }}/{{ maxcount}}</h4>
+            {% if userlist %}
+            {% for user in userlist %}
+            <a href="https://namemc.com/profile/{{user[0]}}">
+                <div class="playerline">
+                    <img
+                        src="https://crafatar.com/renders/head/{{user[1]}}?overlay"
+                        alt="Minecraft head of {{user[0]}}">
+                    <span>{{ user[0]}}</span>
+                </div>
+            </a>
+            {% endfor %}
+            {% endif %}
+        </div>
     </body>
 </html>