This commit is contained in:
mcinj 2022-05-16 23:56:47 -04:00
parent 6cb493eba7
commit 9b67cdacf1
5 changed files with 9 additions and 30 deletions

View file

@ -6,4 +6,5 @@ sqlalchemy_utils==0.38.2
python-dateutil==2.8.2 python-dateutil==2.8.2
Flask==2.1.2 Flask==2.1.2
Flask-BasicAuth==0.2.0 Flask-BasicAuth==0.2.0
pyopenssl==22.0.0 pyopenssl==22.0.0
alembic==1.7.7

View file

@ -176,7 +176,7 @@ class EnterGiveaways:
# game_list = soup.find_all('div', {'class': 'giveaway__row-inner-wrap'}) # game_list = soup.find_all('div', {'class': 'giveaway__row-inner-wrap'})
if not len(unentered_game_list) or (all_games_list_count == pinned_giveaway_count): if not len(unentered_game_list) or (all_games_list_count == pinned_giveaway_count):
txt = f"〰️ We have run out of gifts to consider." txt = f"🟡 We have run out of gifts to consider."
logger.info(txt) logger.info(txt)
break break

View file

@ -17,9 +17,7 @@
</div> </div>
</header> </header>
<div class="container"> <div class="container">
<pre>{{config}}</pre> <pre>{{content}}</pre>
{% block content %}
{% endblock %}
</div> </div>
</body> </body>
</html> </html>

View file

@ -17,19 +17,7 @@
</div> </div>
</header> </header>
<div class="container"> <div class="container">
<pre id="output"></pre> <pre id="output">{{content}}</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> </div>
</body> </body>
</html> </html>

View file

@ -41,21 +41,13 @@ class WebServerThread(threading.Thread):
def config(): def config():
with open('../config/config.ini', 'r') as f: with open('../config/config.ini', 'r') as f:
content = f.read() content = f.read()
return render_template('configuration.html', config=content) return render_template('configuration.html', content=content)
@app.route(f"{self.app_root}log") @app.route(f"{self.app_root}log")
def logs(): def logs():
return render_template('log.html') with open('../config/info.log', 'r') as f:
content = f.read()
@app.route(f"{self.app_root}stream") return render_template('log.html', content=content)
def stream():
def generate():
with open('../config/info.log') as f:
while True:
yield f.read()
sleep(10)
return app.response_class(generate(), mimetype='text/plain')
@app.route(f"{self.app_root}alive") @app.route(f"{self.app_root}alive")
def alive(): def alive():