mirror of
				https://github.com/PhoenixTwoFive/karaoqueue.git
				synced 2025-11-04 09:25:11 +01:00 
			
		
		
		
	Add Version identification to footer
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -135,3 +135,6 @@ data/
 | 
				
			|||||||
# Node Modules
 | 
					# Node Modules
 | 
				
			||||||
 | 
					
 | 
				
			||||||
node_modules/
 | 
					node_modules/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Version identification file
 | 
				
			||||||
 | 
					.version
 | 
				
			||||||
							
								
								
									
										43
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										43
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@@ -4,12 +4,44 @@
 | 
				
			|||||||
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
 | 
					    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
 | 
				
			||||||
    "version": "0.2.0",
 | 
					    "version": "0.2.0",
 | 
				
			||||||
    "configurations": [
 | 
					    "configurations": [
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        {"name":"Python: Flask","type":"python","request":"launch","module":"flask","env":{"FLASK_APP":"backend/app/main.py","FLASK_ENV":"development","FLASK_DEBUG":"1"},"args":["run","--no-debugger","--no-reload"],"jinja":true},
 | 
					 | 
				
			||||||
        {"name":"Python: Flask (with reload)","type":"python","request":"launch","module":"flask","env":{"FLASK_APP":"backend/app/main.py","FLASK_ENV":"development","FLASK_DEBUG":"1"},"args":["run","--no-debugger"],"jinja":true},
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            "preLaunchTask": "versiondump",
 | 
				
			||||||
 | 
					            "name": "Python: Flask",
 | 
				
			||||||
 | 
					            "type": "python",
 | 
				
			||||||
 | 
					            "cwd": "${workspaceFolder}/backend/app",
 | 
				
			||||||
 | 
					            "request": "launch",
 | 
				
			||||||
 | 
					            "module": "flask",
 | 
				
			||||||
 | 
					            "env": {
 | 
				
			||||||
 | 
					                "FLASK_APP": "backend/app/main.py",
 | 
				
			||||||
 | 
					                "FLASK_ENV": "development",
 | 
				
			||||||
 | 
					                "FLASK_DEBUG": "1"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "run",
 | 
				
			||||||
 | 
					                "--no-debugger",
 | 
				
			||||||
 | 
					                "--no-reload"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "jinja": true
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "preLaunchTask": "versiondump",
 | 
				
			||||||
 | 
					            "name": "Python: Flask (with reload)",
 | 
				
			||||||
 | 
					            "type": "python",
 | 
				
			||||||
 | 
					            "request": "launch",
 | 
				
			||||||
 | 
					            "module": "flask",
 | 
				
			||||||
 | 
					            "env": {
 | 
				
			||||||
 | 
					                "FLASK_APP": "backend/app/main.py",
 | 
				
			||||||
 | 
					                "FLASK_ENV": "development",
 | 
				
			||||||
 | 
					                "FLASK_DEBUG": "1"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "run",
 | 
				
			||||||
 | 
					                "--no-debugger"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "jinja": true
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "preLaunchTask": "versiondump",
 | 
				
			||||||
            "name": "Python: Flask (with reload, externally reachable)",
 | 
					            "name": "Python: Flask (with reload, externally reachable)",
 | 
				
			||||||
            "type": "python",
 | 
					            "type": "python",
 | 
				
			||||||
            "request": "launch",
 | 
					            "request": "launch",
 | 
				
			||||||
@@ -27,6 +59,7 @@
 | 
				
			|||||||
            "jinja": true
 | 
					            "jinja": true
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            "preLaunchTask": "versiondump",
 | 
				
			||||||
            "name": "Python: Flask (externally reachable)",
 | 
					            "name": "Python: Flask (externally reachable)",
 | 
				
			||||||
            "type": "python",
 | 
					            "type": "python",
 | 
				
			||||||
            "request": "launch",
 | 
					            "request": "launch",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    // See https://go.microsoft.com/fwlink/?LinkId=733558
 | 
				
			||||||
 | 
					    // for the documentation about the tasks.json format
 | 
				
			||||||
 | 
					    "version": "2.0.0",
 | 
				
			||||||
 | 
					    "tasks": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "label": "versiondump",
 | 
				
			||||||
 | 
					            "type": "shell",
 | 
				
			||||||
 | 
					            "command": "git describe > ${workspaceFolder}/backend/app/.version",
 | 
				
			||||||
 | 
					            "problemMatcher": []
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -32,6 +32,17 @@ def is_valid_uuid(val):
 | 
				
			|||||||
def check_config_exists():
 | 
					def check_config_exists():
 | 
				
			||||||
    return os.path.isfile(config_file)
 | 
					    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):
 | 
					def setup_config(app):
 | 
				
			||||||
    if check_config_exists():
 | 
					    if check_config_exists():
 | 
				
			||||||
        config = json.load(open(config_file))
 | 
					        config = json.load(open(config_file))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -200,6 +200,7 @@ def admin():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@app.before_first_request
 | 
					@app.before_first_request
 | 
				
			||||||
def activate_job():
 | 
					def activate_job():
 | 
				
			||||||
 | 
					    helpers.load_version(app)
 | 
				
			||||||
    helpers.create_data_directory()
 | 
					    helpers.create_data_directory()
 | 
				
			||||||
    database.create_entry_table()
 | 
					    database.create_entry_table()
 | 
				
			||||||
    database.create_song_table()
 | 
					    database.create_song_table()
 | 
				
			||||||
@@ -208,6 +209,10 @@ def activate_job():
 | 
				
			|||||||
    database.create_done_song_view()
 | 
					    database.create_done_song_view()
 | 
				
			||||||
    helpers.setup_config(app)
 | 
					    helpers.setup_config(app)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@app.context_processor
 | 
				
			||||||
 | 
					def inject_version():
 | 
				
			||||||
 | 
					    return dict(karaoqueue_version=app.config['VERSION'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    app.run(host='127.0.0.1', port=8080, debug=True)
 | 
					    app.run(host='127.0.0.1', port=8080, debug=True)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,7 +75,7 @@
 | 
				
			|||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
            <!--<a href="https://github.com/PhoenixTwoFive/karaoqueue"
 | 
					            <!--<a href="https://github.com/PhoenixTwoFive/karaoqueue"
 | 
				
			||||||
                class="ml-1 mr-1"><i class="fab fa-github mr-1"></i><span>Github</span></a>-->
 | 
					                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>
 | 
					                Kühne</span>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </footer>
 | 
					    </footer>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user