Skip to content

Commit 994c25d

Browse files
shaedrichsyeopite
andauthored
Add link to GitHub release/tag/commit in footer (#4702)
* Add link to GitHub release/tag/commit in footer * Only show tag if there is one Co-authored-by: syeopite <[email protected]> --------- Co-authored-by: syeopite <[email protected]>
1 parent 6546333 commit 994c25d

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/invidious.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ HTTP_CHUNK_SIZE = 10485760 # ~10MB
8484
CURRENT_BRANCH = {{ "#{`git branch | sed -n '/* /s///p'`.strip}" }}
8585
CURRENT_COMMIT = {{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }}
8686
CURRENT_VERSION = {{ "#{`git log -1 --format=%ci | awk '{print $1}' | sed s/-/./g`.strip}" }}
87+
CURRENT_TAG = {{ "#{`git tag --points-at HEAD`.strip}" }}
8788

8889
# This is used to determine the `?v=` on the end of file URLs (for cache busting). We
8990
# only need to expire modified assets, so we can use this to find the last commit that changes

src/invidious/views/template.ecr

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,24 @@
150150
<i class="icon ion-ios-wallet"></i>
151151
<a href="https://invidious.io/donate/"><%= translate(locale, "footer_donate_page") %></a>
152152
</span>
153-
<span><%= translate(locale, "Current version: ") %> <%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %> @ <%= CURRENT_BRANCH %></span>
153+
<span>
154+
<%= translate(locale, "Current version: ") %>
155+
<% if CONFIG.modified_source_code_url %>
156+
<a href="<%= CONFIG.modified_source_code_url %>/commit/<%= CURRENT_COMMIT %>"><%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %></a>
157+
<% else %>
158+
<a href="https://github.com/iv-org/invidious/commit/<%= CURRENT_COMMIT %>"><%= CURRENT_VERSION %>-<%= CURRENT_COMMIT %></a>
159+
<% end %>
160+
@ <%= CURRENT_BRANCH %>
161+
<% if CURRENT_TAG != "" %>
162+
(
163+
<% if CONFIG.modified_source_code_url %>
164+
<a href="<%= CONFIG.modified_source_code_url %>/releases/tag/<%= CURRENT_TAG %>"><%= CURRENT_TAG %></a>
165+
<% else %>
166+
<a href="https://github.com/iv-org/invidious/releases/tag/<%= CURRENT_TAG %>"><%= CURRENT_TAG %></a>
167+
<% end %>
168+
)
169+
<% end %>
170+
</span>
154171
</div>
155172
</div>
156173
</footer>

0 commit comments

Comments
 (0)