mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 10:50:07 +00:00
Merge pull request #54 from sharkykh/footer-commit-hash
Display the site's commit hash
This commit is contained in:
commit
22cea7af17
|
@ -40,6 +40,13 @@ if not app.config['DEBUG']:
|
||||||
'<strong>An error occured!</strong> Debugging information has been logged.'), 'danger')
|
'<strong>An error occured!</strong> Debugging information has been logged.'), 'danger')
|
||||||
return flask.redirect('/')
|
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.
|
# Enable the jinja2 do extension.
|
||||||
app.jinja_env.add_extension('jinja2.ext.do')
|
app.jinja_env.add_extension('jinja2.ext.do')
|
||||||
app.jinja_env.lstrip_blocks = True
|
app.jinja_env.lstrip_blocks = True
|
||||||
|
|
|
@ -221,6 +221,9 @@
|
||||||
|
|
||||||
<footer style="text-align: center;">
|
<footer style="text-align: center;">
|
||||||
<p>Dark Mode: <a href="#" id="themeToggle">Toggle</a></p>
|
<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>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue