|
@@ -2,12 +2,13 @@
|
|
|
|
|
|
import tempfile
|
|
import tempfile
|
|
import os.path
|
|
import os.path
|
|
|
|
+import os
|
|
from telnetlib import Telnet
|
|
from telnetlib import Telnet
|
|
from collections import defaultdict
|
|
from collections import defaultdict
|
|
from datetime import timedelta
|
|
from datetime import timedelta
|
|
|
|
|
|
import toml
|
|
import toml
|
|
-from flask import Flask, jsonify, render_template, request
|
|
|
|
|
|
+from flask import Flask, jsonify, request
|
|
from flask_cors import CORS
|
|
from flask_cors import CORS
|
|
|
|
|
|
IDLE_TIMEOUT = timedelta(minutes=5)
|
|
IDLE_TIMEOUT = timedelta(minutes=5)
|
|
@@ -16,7 +17,7 @@ REFRESH_RATE = 60 # seconds
|
|
app = Flask(__name__)
|
|
app = Flask(__name__)
|
|
CORS(app)
|
|
CORS(app)
|
|
|
|
|
|
-with open("secret.toml") as infile:
|
|
|
|
|
|
+with open(os.environ.get("TS_SECRET_FILE", "secret.toml")) as infile:
|
|
cfg = toml.load(infile)
|
|
cfg = toml.load(infile)
|
|
for k in ("host", "port", "user", "pass"):
|
|
for k in ("host", "port", "user", "pass"):
|
|
app.config[k] = cfg[k]
|
|
app.config[k] = cfg[k]
|
|
@@ -148,11 +149,6 @@ def get_status():
|
|
return jsonify({"users": [u.replace(r"\s", " ") for u in get_users()[0]]})
|
|
return jsonify({"users": [u.replace(r"\s", " ") for u in get_users()[0]]})
|
|
|
|
|
|
|
|
|
|
-@app.route("/page")
|
|
|
|
-def get_status_page():
|
|
|
|
- return render_template("embedded_body.html", users={k: [u.replace(r"\s", " ") for u in v] for k, v in get_users()[1].items()}, refresh_rate=REFRESH_RATE)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@app.route("/audiobot", methods=["POST"])
|
|
@app.route("/audiobot", methods=["POST"])
|
|
def message_audiobot():
|
|
def message_audiobot():
|
|
temp_dir = tempfile.mkdtemp()
|
|
temp_dir = tempfile.mkdtemp()
|