Add Version identification to footer

This commit is contained in:
2021-10-08 23:18:56 +02:00
parent 4b70b70a1d
commit c203317320
6 changed files with 72 additions and 7 deletions

View File

@ -32,6 +32,17 @@ def is_valid_uuid(val):
def check_config_exists():
return os.path.isfile(config_file)
def load_version(app):
if os.path.isfile(".version"):
with open('.version', 'r') as file:
data = file.read().replace('\n', '')
if data:
app.config['VERSION'] = data
else:
app.config['VERSION'] = ""
else:
app.config['VERSION'] = ""
def setup_config(app):
if check_config_exists():
config = json.load(open(config_file))

View File

@ -200,6 +200,7 @@ def admin():
@app.before_first_request
def activate_job():
helpers.load_version(app)
helpers.create_data_directory()
database.create_entry_table()
database.create_song_table()
@ -208,6 +209,10 @@ def activate_job():
database.create_done_song_view()
helpers.setup_config(app)
@app.context_processor
def inject_version():
return dict(karaoqueue_version=app.config['VERSION'])
if __name__ == "__main__":
app.run(host='127.0.0.1', port=8080, debug=True)

View File

@ -75,7 +75,7 @@
{% endif %}
<!--<a href="https://github.com/PhoenixTwoFive/karaoqueue"
class="ml-1 mr-1"><i class="fab fa-github mr-1"></i><span>Github</span></a>-->
<span class="text-muted">KaraoQueue (stale branch) -&nbsp;<span>&copy</span>&nbsp;2019-2021 - Phillip
<span class="text-muted">KaraoQueue {{karaoqueue_version}} -&nbsp;<span>&copy</span>&nbsp;2019-2021 - Phillip
Kühne</span>
</div>
</footer>