diff --git a/nyaa/__init__.py b/nyaa/__init__.py index bea32da..aeda6be 100644 --- a/nyaa/__init__.py +++ b/nyaa/__init__.py @@ -40,6 +40,13 @@ if not app.config['DEBUG']: 'An error occured! 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 diff --git a/nyaa/templates/layout.html b/nyaa/templates/layout.html index 3f70770..be76608 100644 --- a/nyaa/templates/layout.html +++ b/nyaa/templates/layout.html @@ -221,6 +221,9 @@