A minimal self-hosted git browser on Rust axum: bare repos rendered as a website with commits, diffs, syntax-highlighted blobs, atom feeds, and clone over HTTPS.
axumdockergitgit-browsergitoxidegixrustself-hosted
1{% extends "base.html" %}
2{% block title %}{{ repo.name }} ยท {{ path }}{% endblock %}
3
4{% block breadcrumbs %}
5<div class="breadcrumbs">
6 <div class="container">
7 <a href="/">repos</a>
8 <span class="breadcrumbs__sep">/</span>
9 <a href="/{{ repo.name }}">{{ repo.name }}</a>
10 <span class="breadcrumbs__sep">/</span>
11 <a href="/{{ repo.name }}/tree/{{ rev|urlencode }}">tree</a>
12 {% set parts = path|split('/') %}
13 {% set cumulative = '' %}
14 {% for part in parts %}
15 <span class="breadcrumbs__sep">/</span>
16 {% if not loop.last %}
17 {% set cumulative = cumulative ~ '/' ~ (part|urlencode) %}
18 <a href="/{{ repo.name }}/tree/{{ rev|urlencode }}{{ cumulative }}">{{ part }}</a>
19 {% else %}
20 <strong>{{ part }}</strong>
21 {% endif %}
22 {% endfor %}
23 <span class="breadcrumbs__ref">@ {{ rev }}</span>
24 </div>
25</div>
26{% endblock %}
27
28{% block main %}
29<div class="blob-head">
30 <span class="blob-head__size">{{ size|filesize }}</span>
31 <a class="blob-head__raw" href="/{{ repo.name }}/raw/{{ rev|urlencode }}/{{ path|urlencode_path }}">raw</a>
32</div>
33
34{% if is_binary %}
35<p class="empty">binary file. <a href="/{{ repo.name }}/raw/{{ rev|urlencode }}/{{ path|urlencode_path }}">download raw</a></p>
36{% elif too_large %}
37<p class="empty">too large to display. <a href="/{{ repo.name }}/raw/{{ rev|urlencode }}/{{ path|urlencode_path }}">view raw</a></p>
38{% else %}
39<div class="blob">{{ highlighted }}</div>
40{% endif %}
41{% endblock %}