mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-07-04 09:11:42 +02:00
Less dodgy debug/version handling
This commit is contained in:
@ -16,9 +16,9 @@ accept_entries = True
|
||||
@app.route("/")
|
||||
def home():
|
||||
if basic_auth.authenticate():
|
||||
return render_template('main_admin.html', list=database.get_list(), auth=basic_auth.authenticate())
|
||||
return render_template('main_admin.html', list=database.get_list(), auth=basic_auth.authenticate(), debug=app.config['DEBUG'])
|
||||
else:
|
||||
return render_template('main.html', list=database.get_list(), auth=basic_auth.authenticate())
|
||||
return render_template('main.html', list=database.get_list(), auth=basic_auth.authenticate(), debug=app.config['DEBUG'])
|
||||
|
||||
|
||||
@app.route("/favicon.ico")
|
||||
@ -67,14 +67,14 @@ def enqueue():
|
||||
|
||||
@app.route("/list")
|
||||
def songlist():
|
||||
return render_template('songlist.html', list=database.get_song_list(), auth=basic_auth.authenticate())
|
||||
return render_template('songlist.html', list=database.get_song_list(), auth=basic_auth.authenticate(), debug=app.config['DEBUG'])
|
||||
|
||||
|
||||
@app.route("/settings")
|
||||
@nocache
|
||||
@basic_auth.required
|
||||
def settings():
|
||||
return render_template('settings.html', app=app, auth=basic_auth.authenticate(), themes=helpers.get_themes())
|
||||
return render_template('settings.html', app=app, auth=basic_auth.authenticate(), themes=helpers.get_themes(), debug=app.config['DEBUG'])
|
||||
|
||||
|
||||
@app.route("/settings", methods=['POST'])
|
||||
@ -109,7 +109,7 @@ def settings_post():
|
||||
if changed_credentials:
|
||||
return redirect("/")
|
||||
else:
|
||||
return render_template('settings.html', app=app, auth=basic_auth.authenticate(), themes=helpers.get_themes())
|
||||
return render_template('settings.html', app=app, auth=basic_auth.authenticate(), themes=helpers.get_themes(), debug=app.config['DEBUG'])
|
||||
|
||||
|
||||
@app.route("/api/queue")
|
||||
@ -123,7 +123,7 @@ def queue_json():
|
||||
@nocache
|
||||
@basic_auth.required
|
||||
def played_list():
|
||||
return render_template('played_list.html', list=database.get_played_list(), auth=basic_auth.authenticate())
|
||||
return render_template('played_list.html', list=database.get_played_list(), auth=basic_auth.authenticate(), debug=app.config['DEBUG'])
|
||||
|
||||
|
||||
@app.route("/api/songs")
|
||||
|
@ -1,5 +1,6 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import subprocess
|
||||
import os
|
||||
import uuid
|
||||
from flask import make_response, Flask
|
||||
@ -34,17 +35,14 @@ def check_config_exists():
|
||||
|
||||
|
||||
def load_version(app: Flask):
|
||||
if app.config['DEBUG'] is True:
|
||||
app.config['VERSION'] = subprocess.Popen("echo \"$(git rev-parse --abbrev-ref HEAD)-$(git describe)\"", shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8').strip() + " (debug)" # noqa: E501 # type: ignore
|
||||
return
|
||||
if os.environ.get("SOURCE_VERSION"):
|
||||
app.config['VERSION'] = os.environ.get("SOURCE_VERSION")[0:7] # type: ignore # noqa: E501
|
||||
elif os.path.isfile(".version"):
|
||||
with open('.version', 'r') as file:
|
||||
data = file.read().replace('\n', '')
|
||||
if data:
|
||||
app.config['VERSION'] = data
|
||||
return
|
||||
else:
|
||||
app.config['VERSION'] = ""
|
||||
else:
|
||||
app.config['VERSION'] = ""
|
||||
app.config['VERSION'] = "Unknown"
|
||||
|
||||
|
||||
def load_dbconfig(app: Flask):
|
||||
|
@ -178,6 +178,16 @@ pre {
|
||||
height: 1.5rem;
|
||||
}
|
||||
|
||||
.construction_bg {
|
||||
background: repeating-linear-gradient(
|
||||
45deg,
|
||||
#222200,
|
||||
#222200 10px,
|
||||
#000000 10px,
|
||||
#000000 20px
|
||||
);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
/* Navbar */
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top {% if debug %} construction_bg {% endif %}">
|
||||
<a class="navbar-brand" href="/">KaraoQueue</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
|
||||
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
@ -76,7 +76,7 @@
|
||||
</main><!-- /.container -->
|
||||
</div>
|
||||
<!-- Footer -->
|
||||
<footer class="footer">
|
||||
<footer class="footer {% if debug %} construction_bg {% endif %}">
|
||||
<div class="container text-center py-3">
|
||||
{% if not auth %}
|
||||
<a href="/login" class="ml-1 mr-1"><i class="fas fa-sign-in-alt mr-1"></i><span>Login</span></a>
|
||||
|
Reference in New Issue
Block a user