- show config and logs in webserver
This commit is contained in:
mcinj 2022-05-13 16:55:52 -04:00
parent 4f4709776b
commit f60220f302
6 changed files with 172 additions and 14 deletions

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Flask app</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>
<body>
<header>
<div class="container">
<h1 class="logo">Steamgifts Bot</h1>
<strong><nav>
<ul class="menu">
<li><a href="{{ url_for('config') }}">Config</a></li>
<li><a href="{{ url_for('logs') }}">Logs</a></li>
</ul>
</nav></strong>
</div>
</header>
<div class="container">
<pre>{{config}}</pre>
{% block content %}
{% endblock %}
</div>
</body>
</html>

35
src/templates/log.html Normal file
View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Flask app</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>
<body>
<header>
<div class="container">
<h1 class="logo">Steamgifts Bot</h1>
<strong><nav>
<ul class="menu">
<li><a href="{{ url_for('config') }}">Config</a></li>
<li><a href="{{ url_for('logs') }}">Logs</a></li>
</ul>
</nav></strong>
</div>
</header>
<div class="container">
<pre id="output"></pre>
<script>
var output = document.getElementById('output');
var xhr = new XMLHttpRequest();
xhr.open('GET', '{{ url_for('stream') }}');
xhr.send();
output.textContent = xhr.responseText;
setInterval(function() {
output.textContent = xhr.responseText;
}, 10000);
</script>
</div>
</body>
</html>