shorten footer and link directly to the running commit
This commit is contained in:
parent
6bd769e21e
commit
069a8ab9fb
2
app.py
2
app.py
|
@ -20,6 +20,8 @@ default_config = {
|
|||
"HTTPS": True,
|
||||
"SENTRY_CONFIG": {},
|
||||
"RATELIMIT_STORAGE_URL": "redis://",
|
||||
"REPO_URL": "https://github.com/codl/forget",
|
||||
"COMMIT_URL": "https://github.com/codl/forget/commit/{hash}",
|
||||
}
|
||||
|
||||
app.config.update(default_config)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
from app import app
|
||||
import re
|
||||
|
||||
version_re = re.compile('(?P<tag>.+)-(?P<commits>[0-9]+)-g(?P<hash>[0-9a-f]+)')
|
||||
|
||||
def url_for_version(ver):
|
||||
match = version_re.match(ver)
|
||||
if not match:
|
||||
return app.config['REPO_URL']
|
||||
return app.config['COMMIT_URL'].format(hash=match.group('hash'))
|
||||
|
|
@ -13,6 +13,7 @@ from zipfile import BadZipFile
|
|||
from twitter import TwitterError
|
||||
from urllib.error import URLError
|
||||
import version
|
||||
import lib.version
|
||||
|
||||
@app.before_request
|
||||
def load_viewer():
|
||||
|
@ -26,7 +27,10 @@ def load_viewer():
|
|||
|
||||
@app.context_processor
|
||||
def inject_version():
|
||||
return dict(version=version.version)
|
||||
return dict(
|
||||
version=version.version,
|
||||
repo_url=lib.version.url_for_version(version.version),
|
||||
)
|
||||
|
||||
@app.context_processor
|
||||
def inject_sentry():
|
||||
|
|
|
@ -33,9 +33,8 @@
|
|||
</header>
|
||||
{% block body %}{% endblock %}
|
||||
<footer>
|
||||
<p>Forget {{version or "dev"}}</p>
|
||||
<p>Forget <a href='{{repo_url}}'>{{version or "dev"}}</a></p>
|
||||
<p>A <a href="https://twitter.com/codl">codl</a> joint</p>
|
||||
<p><a href="https://github.com/codl/forget">Code on Github</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue