mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-08-31 12:10:20 +01:00
pass the version to all templates
This commit is contained in:
parent
d40f6a95b0
commit
fdd2893255
@ -18,6 +18,13 @@ user_config = load_config()
|
||||
app = Flask(__name__)
|
||||
app.secret_key = os.environ.get("SECRET_KEY")
|
||||
|
||||
# Make version available to all templates
|
||||
from libs.generic import get_current_version
|
||||
@app.context_processor
|
||||
def inject_version():
|
||||
version = get_current_version()
|
||||
return dict(version=version)
|
||||
|
||||
# Inject config into routes that need it
|
||||
create_routes.init_app(user_config)
|
||||
auth_routes.init_app(user_config)
|
||||
|
@ -110,7 +110,7 @@ def get_current_version():
|
||||
return version
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Error running bump-my-version:", e)
|
||||
return None
|
||||
return "unknown"
|
||||
|
||||
def load_models_from_config():
|
||||
flux_models = load_config()["comfyui:flux"]["models"].split(",")
|
||||
|
@ -11,12 +11,10 @@ def index():
|
||||
image_filename = "./image.png"
|
||||
image_path = os.path.join(image_folder, image_filename)
|
||||
prompt = get_details_from_png(image_path)["p"]
|
||||
version = get_current_version()
|
||||
|
||||
return render_template(
|
||||
"index.html",
|
||||
image=image_filename,
|
||||
prompt=prompt,
|
||||
reload_interval=user_config["frame"]["reload_interval"],
|
||||
version=version,
|
||||
)
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<!-- Version number at bottom right -->
|
||||
<div class="version">
|
||||
<a href="{{ url_for('settings_route.config_editor') }}">v{{ version }}</a>
|
||||
<a href="{{ url_for('settings_route.config_editor') }}">{% if version and version != 'unknown' %}v{{ version }}{% else %}v?.?.?{% endif %}</a>
|
||||
</div>
|
||||
|
||||
{% block scripts %}{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user