diff --git a/.forgejo/workflows/docker.yml b/.forgejo/workflows/docker.yml
index 0b980f9..809b661 100644
--- a/.forgejo/workflows/docker.yml
+++ b/.forgejo/workflows/docker.yml
@@ -38,3 +38,4 @@ jobs:
context: .
push: true
tags: fg.creamfresh.xyz/mrwnslz/diora-web:${{ steps.tag.outputs.tag }}
+ build-args: BUILD_TIME=${{ github.event.head_commit.timestamp }}
diff --git a/Dockerfile b/Dockerfile
index 1664430..fa1b4f0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,6 +9,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt gunicorn
+ARG BUILD_TIME
+ENV BUILD_TIME=${BUILD_TIME}
+
COPY . .
RUN python manage.py collectstatic --noinput && mkdir -p /app/data
diff --git a/diora/context_processors.py b/diora/context_processors.py
new file mode 100644
index 0000000..1cb8fde
--- /dev/null
+++ b/diora/context_processors.py
@@ -0,0 +1,5 @@
+from django.conf import settings
+
+
+def build_info(request):
+ return {'BUILD_TIME': getattr(settings, 'BUILD_TIME', '')}
diff --git a/diora/settings.py b/diora/settings.py
index d19a9dc..b1fd840 100644
--- a/diora/settings.py
+++ b/diora/settings.py
@@ -60,6 +60,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
+ 'diora.context_processors.build_info',
],
},
},
@@ -113,3 +114,5 @@ LASTFM_API_SECRET = os.environ.get('LASTFM_API_SECRET', '')
# Amazon affiliate
AMAZON_AFFILIATE_TAG = os.environ.get('AMAZON_AFFILIATE_TAG', 'diora-20')
AMAZON_AFFILIATE_ENABLED = os.environ.get('AMAZON_AFFILIATE_ENABLED', 'True') == 'True'
+
+BUILD_TIME = os.environ.get('BUILD_TIME', '')
diff --git a/static/css/app.css b/static/css/app.css
index 7630fb2..699420a 100644
--- a/static/css/app.css
+++ b/static/css/app.css
@@ -1587,3 +1587,13 @@ mark.reader-search-match.active { background:rgba(230,57,70,.7); }
/* Toast */
.reader-toast { position:fixed; bottom:calc(var(--bar-h) + 16px); left:50%; transform:translateX(-50%); background:var(--fg); color:var(--bg); padding:6px 14px; border-radius:var(--radius); font-size:13px; z-index:600; animation:toast-fade 2s ease forwards; pointer-events:none; }
@keyframes toast-fade { 0%,70%{opacity:1} 100%{opacity:0} }
+
+.build-time {
+ position: fixed;
+ bottom: 4px;
+ right: 6px;
+ font-size: 0.65rem;
+ color: #444;
+ pointer-events: none;
+ z-index: 1;
+}
diff --git a/templates/base.html b/templates/base.html
index 3c93ae1..a4b6247 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -48,6 +48,7 @@
{% block content %}{% endblock %}
+ {% if BUILD_TIME %}{{ BUILD_TIME|slice:":16"|cut:"T" }}{% endif %}
{% block extra_js %}{% endblock %}