From c2c7adf950da67df30f656e055c9e29fa98c2260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Tue, 23 Sep 2025 10:37:02 +0200 Subject: [PATCH] version footer --- app.py | 24 +++++++++++++++ templates/admin/admin_panel.html | 5 ++-- templates/admin/edit_list.html | 9 +++--- templates/admin/list_products.html | 4 +-- templates/admin/mass_edit_categories.html | 4 +-- templates/admin/receipts.html | 36 +++++++++++------------ templates/admin/user_management.html | 2 +- templates/base.html | 35 +++++++++++++--------- templates/edit_my_list.html | 31 +++++++++---------- templates/expenses.html | 18 ++++++------ templates/list.html | 6 ++-- templates/list_share.html | 12 ++++---- templates/main.html | 7 +++-- 13 files changed, 113 insertions(+), 80 deletions(-) diff --git a/app.py b/app.py index 54324e3..5eca872 100644 --- a/app.py +++ b/app.py @@ -147,6 +147,25 @@ WEBP_SAVE_PARAMS = { "quality": 95, # tylko jeśli lossless=False } + +def build_fingerprint(paths): + h = hashlib.sha256() + for base in paths: + if not os.path.exists(base): + continue + for root, _, files in os.walk(base): + for f in sorted(files): + p = os.path.join(root, f) + try: + with open(p, "rb") as fh: + h.update(fh.read()) + except Exception: + pass + return h.hexdigest()[:8] + +APP_VERSION = f"{datetime.now():%Y.%m.%d}+{build_fingerprint(['templates','static','app.py'])}" +app.config['APP_VERSION'] = APP_VERSION + db = SQLAlchemy(app) socketio = SocketIO(app, async_mode="eventlet") login_manager = LoginManager(app) @@ -1320,6 +1339,11 @@ def load_user(user_id): return db.session.get(User, int(user_id)) +@app.context_processor +def inject_version(): + return {'APP_VERSION': app.config['APP_VERSION']} + + @app.context_processor def inject_time(): return dict(time=time) diff --git a/templates/admin/admin_panel.html b/templates/admin/admin_panel.html index d41f051..bc7346a 100644 --- a/templates/admin/admin_panel.html +++ b/templates/admin/admin_panel.html @@ -218,7 +218,8 @@ — {{ month_str|replace('-', ' / ') }} {% endif %} -
+
@@ -350,7 +351,7 @@ checkboxes.forEach(cb => cb.checked = this.checked); }); - + {% endblock %} {% endblock %} \ No newline at end of file diff --git a/templates/admin/edit_list.html b/templates/admin/edit_list.html index 48cb8c6..ca18c13 100644 --- a/templates/admin/edit_list.html +++ b/templates/admin/edit_list.html @@ -122,10 +122,9 @@
🔐 Użytkownicy z dostępem
- - ⚙️ Edytuj uprawnienia - + + ⚙️ Edytuj uprawnienia + {% if permitted_users %}
    @@ -302,5 +301,5 @@ {% endblock %} {% block scripts %} - + {% endblock %} \ No newline at end of file diff --git a/templates/admin/list_products.html b/templates/admin/list_products.html index a946f56..0be9c13 100644 --- a/templates/admin/list_products.html +++ b/templates/admin/list_products.html @@ -168,8 +168,8 @@
{% block scripts %} - - + + {% endblock %} {% endblock %} \ No newline at end of file diff --git a/templates/admin/mass_edit_categories.html b/templates/admin/mass_edit_categories.html index 2946ca8..250cf50 100644 --- a/templates/admin/mass_edit_categories.html +++ b/templates/admin/mass_edit_categories.html @@ -151,6 +151,6 @@ {% endblock %} {% block scripts %} - - + + {% endblock %} \ No newline at end of file diff --git a/templates/admin/receipts.html b/templates/admin/receipts.html index a90f165..5f3563c 100644 --- a/templates/admin/receipts.html +++ b/templates/admin/receipts.html @@ -20,27 +20,27 @@ {{ (page_filesize / 1024) | round(1) }} kB {% endif %} - {% if not (id != 'all' and (id|string).isdigit()) %} - | Łącznie: - - {% if total_filesize >= 1024*1024 %} - {{ (total_filesize / 1024 / 1024) | round(2) }} MB - {% else %} - {{ (total_filesize / 1024) | round(1) }} kB - {% endif %} - + {% if not (id != 'all' and (id|string).isdigit()) %} + | Łącznie: + + {% if total_filesize >= 1024*1024 %} + {{ (total_filesize / 1024 / 1024) | round(2) }} MB + {% else %} + {{ (total_filesize / 1024) | round(1) }} kB {% endif %} + + {% endif %}

{% if id is string and id.isdigit() and id|int > 0 %} - - Pokaż wszystkie paragony - + + Pokaż wszystkie paragony + {% else %} - - Przelicz rozmiary plików - + + Przelicz rozmiary plików + {% endif %} ← Powrót do panelu
@@ -209,9 +209,9 @@ {% block scripts %} - - - + + + {% endblock %} {% endblock %} \ No newline at end of file diff --git a/templates/admin/user_management.html b/templates/admin/user_management.html index e6ad2d7..f4c63b3 100644 --- a/templates/admin/user_management.html +++ b/templates/admin/user_management.html @@ -115,7 +115,7 @@ {% block scripts %} - + {% endblock %} diff --git a/templates/base.html b/templates/base.html index d50f9ca..3f0f0eb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,27 +9,32 @@ {# --- Bootstrap i główny css zawsze --- #} - + {# --- Style CSS ładowane tylko dla niezablokowanych --- #} {% set exclude_paths = ['/system-auth'] %} {% if (exclude_paths | select("in", request.path) | list | length == 0) and has_authorized_cookie and not is_blocked %} - - + + {% endif %} {# --- Cropper CSS tylko dla wybranych podstron --- #} {% set substrings_cropper = ['/admin/receipts', '/edit_my_list'] %} {% if substrings_cropper | select("in", request.path) | list | length > 0 %} - + {% endif %} {# --- Tom Select CSS tylko dla wybranych podstron --- #} {% set substrings_tomselect = ['/edit_my_list', '/admin/edit_list', '/admin/mass_edit_categories'] %} {% if substrings_tomselect | select("in", request.path) | list | length > 0 %} - + {% endif %} @@ -81,6 +86,7 @@

© 2025 linuxiarz.pl · source code +

v{{ APP_VERSION }}
@@ -101,14 +107,14 @@ {% if request.endpoint != 'system_auth' %} - - - - - - + + + + + + {% endif %} - + + {% endif %} {% set substrings = ['/edit_my_list', '/admin/edit_list', '/admin/mass_edit_categories'] %} {% if substrings | select("in", request.path) | list | length > 0 %} - + {% endif %} {% endif %} diff --git a/templates/edit_my_list.html b/templates/edit_my_list.html index 0f7f436..1603ff6 100644 --- a/templates/edit_my_list.html +++ b/templates/edit_my_list.html @@ -104,17 +104,17 @@ - {% if list.share_token %} -
- - Otwórz - -
+ {% if list.share_token %} +
+ + Otwórz + +
{% else %} -
Brak tokenu udostępniania.
+
Brak tokenu udostępniania.
{% endif %}
Ustawienie „🌐 Publiczna” nie jest wymagane dla dostępu z linku.
@@ -140,7 +140,8 @@ {% if permitted_users and permitted_users|length > 0 %}
    {% for u in permitted_users %} -
  • +
  • @{{ u.username }}
    @@ -277,8 +278,8 @@ {% endblock %} {% block scripts %} - - - - + + + + {% endblock %} \ No newline at end of file diff --git a/templates/expenses.html b/templates/expenses.html index 1281412..119dfac 100644 --- a/templates/expenses.html +++ b/templates/expenses.html @@ -210,13 +210,13 @@ {% endblock %} {% block scripts %} - - - - - - - - - + + + + + + + + + {% endblock %} \ No newline at end of file diff --git a/templates/list.html b/templates/list.html index 6e80d0f..158eb53 100644 --- a/templates/list.html +++ b/templates/list.html @@ -260,9 +260,9 @@ window.LIST_ID = {{ list.id }}; window.IS_OWNER = {{ 'true' if is_owner else 'false' }}; - - - + + + diff --git a/templates/list_share.html b/templates/list_share.html index 415bf22..98dfd83 100644 --- a/templates/list_share.html +++ b/templates/list_share.html @@ -244,12 +244,12 @@ var isSorting = false; } - - - - - - + + + + + + diff --git a/templates/main.html b/templates/main.html index 3b13d92..c7a006c 100644 --- a/templates/main.html +++ b/templates/main.html @@ -136,7 +136,8 @@ {% endif %} -

    {% if current_user.is_authenticated %}Udostępnione i publiczne listy innych użytkowników {% else %} Publiczne listy innych użytkowników {% endif %}

    +

    {% if current_user.is_authenticated %}Udostępnione i publiczne listy innych użytkowników {% else %} + Publiczne listy innych użytkowników {% endif %}

    {% set lists_to_show = accessible_lists %} @@ -250,8 +251,8 @@ {% block scripts %} - - + + {% endblock %} {% endblock %} \ No newline at end of file