mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-07-04 09:11:42 +02:00
Add Version identification to footer
This commit is contained in:
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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) - <span>©</span> 2019-2021 - Phillip
|
||||
<span class="text-muted">KaraoQueue {{karaoqueue_version}} - <span>©</span> 2019-2021 - Phillip
|
||||
Kühne</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
Reference in New Issue
Block a user