diff --git a/app/app.py b/app/app.py index 1949c38..448baae 100644 --- a/app/app.py +++ b/app/app.py @@ -11,6 +11,8 @@ FLASK_ENV = os.getenv("FLASK_ENV", "production") FLASK_PORT = int(os.getenv("PORT", 5000)) print(f"🔧 Starting app on port {FLASK_PORT}, FLASK_ENV={FLASK_ENV}") +from flask import Flask, render_template, current_app +from markupsafe import Markup # Initialize the CacheManager cache_manager = CacheManager() @@ -48,6 +50,18 @@ app = Flask(__name__) load_config(app) cache_icons_and_logos(app) +@app.context_processor +def utility_processor(): + def include_svg(path): + full_path = os.path.join(current_app.root_path, 'static', path) + try: + with open(full_path, 'r', encoding='utf-8') as f: + svg = f.read() + return Markup(svg) + except IOError: + return Markup(f'') + return dict(include_svg=include_svg) + @app.before_request def reload_config_in_dev(): """Reload config and recache icons before each request in development mode.""" diff --git a/app/static/css/default.css b/app/static/css/default.css index 502c0c3..7495f28 100644 --- a/app/static/css/default.css +++ b/app/static/css/default.css @@ -96,9 +96,11 @@ h3.footer-title { font-size: 1.3em; } -.card-img-top i, .card-img-top object{ +.card-img-top i, .card-img-top svg{ font-size: 100px; fill: currentColor; + width: 100px; + height: auto; } div#navbarNavheader li.nav-item { diff --git a/app/templates/moduls/card.html.j2 b/app/templates/moduls/card.html.j2 index dbfcbb5..bcd663a 100644 --- a/app/templates/moduls/card.html.j2 +++ b/app/templates/moduls/card.html.j2 @@ -2,25 +2,16 @@
- {% if card.icon.cache %} - {% if card.icon.cache.endswith('.svg') %} - - {% if card.icon.class %} - - {% endif %} - - {% else %} - {{ card.title }} - {% if card.icon.class %} - - {% endif %} + {% if card.icon.cache and card.icon.cache.endswith('.svg') %} + {{ include_svg(card.icon.cache) }} + {% elif card.icon.cache %} + {{ card.title }} + {% if card.icon.class %} + {% endif %} {% elif card.icon.class %}