|
@@ -5,7 +5,7 @@ import os.path
|
|
|
import os
|
|
|
from telnetlib import Telnet
|
|
|
from collections import defaultdict
|
|
|
-from datetime import timedelta
|
|
|
+from datetime import timedelta, datetime
|
|
|
|
|
|
import toml
|
|
|
from flask import Flask, jsonify, request, render_template_string
|
|
@@ -163,46 +163,59 @@ def default_to(hex_in, hex_def):
|
|
|
def get_page():
|
|
|
bg = default_to(request.args.get("bg", None), "111")
|
|
|
tc = default_to(request.args.get("tc", None), "ccc")
|
|
|
- return render_template_string("""
|
|
|
- <!DOCTYPE html>
|
|
|
- <html lang="en">
|
|
|
- <head>
|
|
|
- <title>Teamspeak Status</title>
|
|
|
- <style>
|
|
|
- body {
|
|
|
- margin: 0;
|
|
|
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
|
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
|
- sans-serif;
|
|
|
- -webkit-font-smoothing: antialiased;
|
|
|
- -moz-osx-font-smoothing: grayscale;
|
|
|
- margin: 0px 0px 0px 0px;
|
|
|
- padding: 0px 0px 0px 0px;
|
|
|
- color: #{{ tc }};
|
|
|
- background-color: #{{ bg }};
|
|
|
- }
|
|
|
- .users {
|
|
|
- list-style-type: none;
|
|
|
- padding: 0;
|
|
|
+ timestamp = "" if request.args.get("ts", None) != "1" else f"Updated at {datetime.now().strftime('%I:%M %p')}"
|
|
|
+ return render_template_string(
|
|
|
+ """
|
|
|
+ <!DOCTYPE html>
|
|
|
+ <html lang="en">
|
|
|
+ <head>
|
|
|
+ <title>Teamspeak Status</title>
|
|
|
+ <style>
|
|
|
+ body {
|
|
|
margin: 0;
|
|
|
- margin-top: 0.4em;
|
|
|
- }
|
|
|
- .user {
|
|
|
- font-size: 0.6em;
|
|
|
- margin-left: 0.8em;
|
|
|
- padding-bottom: 0.2em;
|
|
|
- }
|
|
|
- </style>
|
|
|
- </head>
|
|
|
- <body>
|
|
|
- <ul class="users">
|
|
|
- {% for user in users %}
|
|
|
- <li class="user">{{ user }}</li>
|
|
|
- {% endfor %}
|
|
|
- </ul>
|
|
|
- </body>
|
|
|
- </html>
|
|
|
- """, users=[u.replace(r"\s", " ") for u in get_users()[0]], tc=tc, bg=bg)
|
|
|
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
|
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
|
+ sans-serif;
|
|
|
+ -webkit-font-smoothing: antialiased;
|
|
|
+ -moz-osx-font-smoothing: grayscale;
|
|
|
+ margin: 0px 0px 0px 0px;
|
|
|
+ padding: 0px 0px 0px 0px;
|
|
|
+ color: #{{ tc }};
|
|
|
+ background-color: #{{ bg }};
|
|
|
+ }
|
|
|
+ .users {
|
|
|
+ list-style-type: none;
|
|
|
+ padding: 0;
|
|
|
+ margin: 0;
|
|
|
+ margin-top: 0.3em;
|
|
|
+ }
|
|
|
+ .user {
|
|
|
+ font-size: 0.6em;
|
|
|
+ margin-left: 0.8em;
|
|
|
+ padding-bottom: 0.2em;
|
|
|
+ }
|
|
|
+ .timestamp {
|
|
|
+ font-size: 0.6em;
|
|
|
+ margin-left: 0.2em;
|
|
|
+ padding-top: 0.1em;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div class="timestamp">{{ timestamp }}</div>
|
|
|
+ <ul class="users">
|
|
|
+ {% for user in users %}
|
|
|
+ <li class="user">{{ user }}</li>
|
|
|
+ {% endfor %}
|
|
|
+ </ul>
|
|
|
+ </body>
|
|
|
+ </html>
|
|
|
+ """,
|
|
|
+ users=[u.replace(r"\s", " ") for u in get_users()[0]],
|
|
|
+ tc=tc,
|
|
|
+ bg=bg,
|
|
|
+ timestamp=timestamp,
|
|
|
+ )
|
|
|
|
|
|
|
|
|
@app.route("/audiobot", methods=["POST"])
|