diff --git a/Dockerfile b/Dockerfile index c65665f..67af954 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,7 @@ ENV MAX_PRODUCTION=1 # Owned by root, so the app cannot modify its own code COPY max/ ./max COPY scripts/prod/ . +COPY VERSION . # Precompile, since the app cannot write __pycache__ at runtime RUN python -m compileall -q max diff --git a/max/app.py b/max/app.py index 7453a3a..49588ba 100644 --- a/max/app.py +++ b/max/app.py @@ -19,6 +19,7 @@ from .routes import init_routes from .security_headers import init_security_headers from .sessions import SessionInterface from .translations import TranslationHandler +from .version import init_version class Rule(WerkzeugRule): @@ -29,7 +30,7 @@ class Rule(WerkzeugRule): def main(): app = Flask(__name__) init_logging(app) - app.logger.info("Max started.") + app.logger.info("Max starting.") if app.debug and os.environ.get("MAX_PRODUCTION") == "1": raise RuntimeError( "Debug mode is not allowed in production (MAX_PRODUCTION=1), unset FLASK_DEBUG" @@ -39,6 +40,7 @@ def main(): else: app.logger.info("App is in production mode") TranslationHandler.init(app) + init_version(app) app.jinja_env.trim_blocks = True app.jinja_env.lstrip_blocks = True app.url_rule_class = Rule @@ -70,6 +72,7 @@ def main(): init_auth(app) init_routes(app) init_security_headers(app) + app.logger.info("Max initialized, version %s.", app.config["VERSION"]) return app diff --git a/max/static/base.css b/max/static/base.css index 9b6c0a5..256bd64 100644 --- a/max/static/base.css +++ b/max/static/base.css @@ -108,6 +108,13 @@ form { background-color: #FFFFFF; border: 1px solid #CCCCCC; } +footer { + width: calc(60% + 32px); + margin: -14px auto 20px auto; + text-align: right; + font-size: 0.8em; + color: #888888; +} .top-row-button { margin: 1.1em 0; @@ -210,6 +217,11 @@ form { width: calc(100% - 72px); margin: 60px 20px 20px 20px; } + + footer { + width: calc(100% - 40px); + margin: -14px 20px 20px 20px; + } } @media (max-width: 900px) { diff --git a/max/templates/base.html b/max/templates/base.html index 7bd8fb4..68258ac 100644 --- a/max/templates/base.html +++ b/max/templates/base.html @@ -62,6 +62,11 @@
{% block content %}{% endblock %}
+ {% if session['user_id'] %} + + {% endif %} \ No newline at end of file diff --git a/max/version.py b/max/version.py new file mode 100644 index 0000000..5ceb8bf --- /dev/null +++ b/max/version.py @@ -0,0 +1,9 @@ +from pathlib import Path + +VERSION_FILE = Path(__file__).resolve().parent.parent / "VERSION" + + +def init_version(app): + version = VERSION_FILE.read_text(encoding="utf-8").strip() + app.config["VERSION"] = version + app.context_processor(lambda: dict(version=version))