From c7ace2fb824ef982b31b1fe8dad312ac83e62c5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20H=C3=A4drich?=
<11225821+shaedrich@users.noreply.github.com>
Date: Thu, 16 May 2024 11:51:58 +0000
Subject: [PATCH] Add link to GitHub release/tag/commit in footer
---
src/invidious.cr | 1 +
src/invidious/views/template.ecr | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/invidious.cr b/src/invidious.cr
index e0bd0101..7b358042 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -78,6 +78,7 @@ HTTP_CHUNK_SIZE = 10485760 # ~10MB
CURRENT_BRANCH = {{ "#{`git branch | sed -n '/* /s///p'`.strip}" }}
CURRENT_COMMIT = {{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}
CURRENT_VERSION = {{ "#{`git log -1 --format=%ci | awk '{print $1}' | sed s/-/./g`.strip}" }}
+CURRENT_TAG = {{ "#{`git tag --points-at HEAD`.strip}" }}
# This is used to determine the `?v=` on the end of file URLs (for cache busting). We
# only need to expire modified assets, so we can use this to find the last commit that changes
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr
index 9904b4fc..cd50ef4b 100644
--- a/src/invidious/views/template.ecr
+++ b/src/invidious/views/template.ecr
@@ -149,7 +149,22 @@
<%= translate(locale, "footer_donate_page") %>
- <%= translate(locale, "Current version: ") %> <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> @ <%= CURRENT_BRANCH %>
+
+ <%= translate(locale, "Current version: ") %>
+ <% if CONFIG.modified_source_code_url %>
+ <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %>
+ <% else %>
+ <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %>
+ <% end %>
+ @ <%= CURRENT_BRANCH %>
+ (
+ <% if CONFIG.modified_source_code_url %>
+ <%= CURRENT_TAG %>
+ <% else %>
+ <%= CURRENT_TAG %>
+ <% end %>
+ )
+