fix caching problem

This commit is contained in:
TuxCoder 2020-05-10 16:54:53 +02:00
parent 88d1eed90e
commit 5c576351c6
2 changed files with 11 additions and 2 deletions

View file

@ -5,6 +5,7 @@ from jwkest.jwk import RSAKey, rsa_load
from flask_babel import Babel from flask_babel import Babel
from flask_login import LoginManager from flask_login import LoginManager
import time import time
import subprocess
from pyop.authz_state import AuthorizationState from pyop.authz_state import AuthorizationState
from pyop.provider import Provider from pyop.provider import Provider
@ -16,6 +17,12 @@ from . import model
from .pki import Pki 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): def init_oidc_provider(app):
with app.app_context(): with app.app_context():
issuer = url_for('frontend.index')[:-1] 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('application.cfg')
app.config.from_pyfile('production.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) #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) 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) app.ldap_conn = Connection(server, app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True)

View file

@ -4,12 +4,12 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>{% block title %}{% endblock %} - Lenticular Cloud</title> <title>{% block title %}{% endblock %} - Lenticular Cloud</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="/static/main.css" /> <link rel="stylesheet" href="/static/main.css?v={{ GIT_HASH }}" />
{% block head %}{% endblock %} {% block head %}{% endblock %}
</head> </head>
<body> <body>
{% block body %}{% endblock %} {% block body %}{% endblock %}
<script type="application/javascript" src="/static/main.js" ></script> <script type="application/javascript" src="/static/main.js?v={{ GIT_HASH }}" ></script>
<script type="application/javascript" > <script type="application/javascript" >
{% block script_js %}{% endblock %} {% block script_js %}{% endblock %}
</script> </script>