From 5c576351c629c07c4d7daba8845b5cfa25d7c696 Mon Sep 17 00:00:00 2001 From: TuxCoder Date: Sun, 10 May 2020 16:54:53 +0200 Subject: [PATCH] fix caching problem --- lenticular_cloud/app.py | 9 +++++++++ templates/skelet.html.j2 | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lenticular_cloud/app.py b/lenticular_cloud/app.py index 50f00fd..70e0f89 100644 --- a/lenticular_cloud/app.py +++ b/lenticular_cloud/app.py @@ -5,6 +5,7 @@ from jwkest.jwk import RSAKey, rsa_load from flask_babel import Babel from flask_login import LoginManager import time +import subprocess from pyop.authz_state import AuthorizationState from pyop.provider import Provider @@ -16,6 +17,12 @@ from . import model from .pki import Pki +def get_git_hash(): + try: + return subprocess.check_output(['git', 'rev-parse', 'HEAD'])[:10].decode() + except Exception: + return '' + def init_oidc_provider(app): with app.app_context(): issuer = url_for('frontend.index')[:-1] @@ -127,6 +134,8 @@ def oidc_provider_init_app(name=None): app.config.from_pyfile('application.cfg') app.config.from_pyfile('production.cfg') + app.jinja_env.globals['GIT_HASH'] = get_git_hash() + #app.ldap_orm = Connection(app.config['LDAP_URL'], app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True) server = Server(app.config['LDAP_URL'], get_info=ALL) app.ldap_conn = Connection(server, app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True) diff --git a/templates/skelet.html.j2 b/templates/skelet.html.j2 index c231879..cc120c9 100644 --- a/templates/skelet.html.j2 +++ b/templates/skelet.html.j2 @@ -4,12 +4,12 @@ {% block title %}{% endblock %} - Lenticular Cloud - + {% block head %}{% endblock %} {% block body %}{% endblock %} - +