1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 10:00:01 +00:00

Merge pull request #54 from sharkykh/footer-commit-hash

Display the site's commit hash
This commit is contained in:
Anna-Maria Meriniemi 2017-05-14 13:55:55 +03:00 committed by GitHub
commit 22cea7af17
2 changed files with 10 additions and 0 deletions

View file

@ -40,6 +40,13 @@ if not app.config['DEBUG']:
'<strong>An error occured!</strong> Debugging information has been logged.'), 'danger')
return flask.redirect('/')
# Get git commit hash
app.config['COMMIT_HASH'] = None
master_head = os.path.abspath(os.path.join(os.path.dirname(__file__), '../.git/refs/heads/master'))
if os.path.isfile(master_head):
with open(master_head, 'r') as head:
app.config['COMMIT_HASH'] = head.readline().strip()
# Enable the jinja2 do extension.
app.jinja_env.add_extension('jinja2.ext.do')
app.jinja_env.lstrip_blocks = True

View file

@ -221,6 +221,9 @@
<footer style="text-align: center;">
<p>Dark Mode: <a href="#" id="themeToggle">Toggle</a></p>
{% if config.COMMIT_HASH %}
<p>Commit: <a href="https://github.com/nyaadevs/nyaa/tree/{{ config.COMMIT_HASH }}">{{ config.COMMIT_HASH[:7] }}</a></p>
{% endif %}
</footer>
</body>
</html>