vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys
keenan · 16m ago
4b8c9e1d
| 1 | {{define "code"}} |
| 2 | {{template "header" .}} |
| 3 | {{template "repohead" (nav .Page "code")}} |
| 4 | |
| 5 | <div class="page-head"> |
| 6 | <div class="page-head-main"> |
| 7 | <h1>Code</h1> |
| 8 | <p class="page-sub">{{.Count}} commit(s) on <code>{{.Ref}}</code></p> |
| 9 | </div> |
| 10 | <div class="page-head-actions"> |
| 11 | <a class="button secondary" href="/{{.Name}}/compare">{{icon "git-branch"}}Compare</a> |
| 12 | <a class="button secondary" href="/{{.Name}}/commits/{{esc .Ref}}">{{icon "history"}}History</a> |
| 13 | </div> |
| 14 | </div> |
| 15 | |
| 16 | {{/* Search and ref pickers filter the tree and the main pane, so they share the |
| 17 | standard filter row under the page header: refs on the left, search on the |
| 18 | right. */}} |
| 19 | <div class="filters"> |
| 20 | {{if .Branches}} |
| 21 | <form method="get" action="/{{.Name}}/code" class="inline"> |
| 22 | <label class="filter-field"> |
| 23 | <span class="filter-label">Branch</span> |
| 24 | <select name="ref" data-autosubmit> |
| 25 | {{if not .OnBranch}}<option value="" disabled selected>—</option>{{end}} |
| 26 | {{range .Branches}}<option value="{{.}}"{{if eq . $.Ref}} selected{{end}}>{{.}}</option>{{end}} |
| 27 | </select> |
| 28 | </label> |
| 29 | </form> |
| 30 | {{end}} |
| 31 | {{if .Tags}} |
| 32 | <form method="get" action="/{{.Name}}/code" class="inline"> |
| 33 | <label class="filter-field"> |
| 34 | <span class="filter-label">Tag</span> |
| 35 | <select name="ref" data-autosubmit> |
| 36 | {{if not .OnTag}}<option value="" disabled selected>—</option>{{end}} |
| 37 | {{range .Tags}}<option value="{{.}}"{{if eq . $.Ref}} selected{{end}}>{{.}}</option>{{end}} |
| 38 | </select> |
| 39 | </label> |
| 40 | </form> |
| 41 | {{end}} |
| 42 | <div class="filters-search"> |
| 43 | <form method="get" action="/{{.Name}}/search" class="inline" role="search"> |
| 44 | <input type="hidden" name="ref" value="{{.Ref}}"> |
| 45 | <input type="search" name="q" placeholder="Search code" aria-label="Search code"> |
| 46 | <button type="submit">{{icon "search"}}Search</button> |
| 47 | </form> |
| 48 | </div> |
| 49 | </div> |
| 50 | |
| 51 | {{range .Latest}} |
| 52 | <div class="latest"> |
| 53 | <a href="/{{$.Name}}/commit/{{.SHA}}">{{.Subject}}</a> |
| 54 | <span class="muted">{{.Author}} · {{since .When}}</span> |
| 55 | <a class="sha" href="/{{$.Name}}/commit/{{.SHA}}">{{short .SHA}}</a> |
| 56 | </div> |
| 57 | {{end}} |
| 58 | |
| 59 | <div class="code-browser"> |
| 60 | {{template "code_tree" .}} |
| 61 | {{template "code_main" .}} |
| 62 | </div> |
| 63 | |
| 64 | {{template "footer" .}} |
| 65 | {{end}} |
| 66 | |
| 67 | {{define "code_tree"}} |
| 68 | <aside class="file-tree" id="file-tree" aria-label="Files"> |
| 69 | <div class="tree-head"> |
| 70 | <span>{{icon "folder-open"}}Files</span> |
| 71 | <span class="muted">{{.Ref}}</span> |
| 72 | </div> |
| 73 | {{if .Tree}} |
| 74 | <div class="tree-scroll"> |
| 75 | {{template "tree_nodes" (treeContext .Name .Ref "" .Tree)}} |
| 76 | </div> |
| 77 | {{if .TreeTruncated}}<p class="tree-note">Showing the first 4,000 files.</p>{{end}} |
| 78 | {{else}} |
| 79 | <p class="tree-empty muted">{{if .Commit}}No files on this branch.{{else}}Push a branch to browse it.{{end}}</p> |
| 80 | {{end}} |
| 81 | </aside> |
| 82 | {{end}} |
| 83 | |
| 84 | {{define "code_main"}} |
| 85 | <section id="code-main" class="code-main" data-path="{{.Path}}" data-mode="{{.Mode}}" data-ref="{{.Ref}}"> |
| 86 | {{if eq .Mode "blob"}}{{template "code_blob" .}} |
| 87 | {{else if eq .Mode "tree"}}{{template "code_dir" .}} |
| 88 | {{else}}{{template "code_overview" .}}{{end}} |
| 89 | </section> |
| 90 | {{end}} |
| 91 | |
| 92 | {{define "code_tabbar"}} |
| 93 | <div class="code-tabbar"> |
| 94 | <span class="code-tab-icon">{{if or (eq .Mode "tree") (and (eq .Mode "overview") (not .Readme))}}{{icon "folder"}}{{else if eq .Mode "blob"}}{{icon "file"}}{{else}}{{icon "book-open"}}{{end}}</span> |
| 95 | <nav class="code-crumbs" aria-label="Breadcrumb"> |
| 96 | <a href="/{{.Name}}/code?ref={{esc .Ref}}" hx-get="/{{.Name}}/code?ref={{esc .Ref}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">{{.Ref}}</a> |
| 97 | {{range $i, $c := .Crumbs}}<span class="sep">/</span>{{if eq (inc $i) (len $.Crumbs)}}<span class="current" title="{{$c.Path}}">{{$c.Name}}</span>{{else}}<a href="/{{$.Name}}/tree/{{esc $.Ref}}/{{pathurl $c.Path}}" hx-get="/{{$.Name}}/tree/{{esc $.Ref}}/{{pathurl $c.Path}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">{{$c.Name}}</a>{{end}}{{end}} |
| 98 | {{if not .Crumbs}}<span class="sep">/</span><span class="current">Files</span>{{end}} |
| 99 | </nav> |
| 100 | <span class="code-tab-actions"> |
| 101 | {{if eq .Mode "blob"}} |
| 102 | {{if and .IsMarkdown (not .Truncated)}} |
| 103 | <a class="{{if not .Preview}}active{{end}}" href="/{{.Name}}/blob/{{esc .Ref}}/{{pathurl .Path}}" hx-get="/{{.Name}}/blob/{{esc .Ref}}/{{pathurl .Path}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">source</a> |
| 104 | <a class="{{if .Preview}}active{{end}}" href="/{{.Name}}/blob/{{esc .Ref}}/{{pathurl .Path}}?preview=1" hx-get="/{{.Name}}/blob/{{esc .Ref}}/{{pathurl .Path}}?preview=1" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">preview</a> |
| 105 | {{end}} |
| 106 | <a href="/{{.Name}}/commits/{{esc .Ref}}/{{pathurl .Path}}">history</a> |
| 107 | <a href="/{{.Name}}/blame/{{esc .Ref}}/{{pathurl .Path}}">blame</a> |
| 108 | <a href="/{{.Name}}/raw/{{esc .Ref}}/{{pathurl .Path}}">raw</a> |
| 109 | <span class="muted">{{bytes .Size}}</span> |
| 110 | {{else if and (eq .Mode "overview") .Readme}} |
| 111 | <a href="/{{.Name}}/blob/{{esc .Ref}}/{{pathurl .ReadmeName}}">source</a> |
| 112 | {{else if .Entries}} |
| 113 | <span class="muted">{{len .Entries}} item(s)</span> |
| 114 | {{end}} |
| 115 | </span> |
| 116 | </div> |
| 117 | {{end}} |
| 118 | |
| 119 | {{define "code_overview"}} |
| 120 | {{if .Readme}} |
| 121 | {{template "code_tabbar" .}} |
| 122 | <article class="md readme">{{.Readme}}</article> |
| 123 | {{else if not .Commit}} |
| 124 | {{template "code_tabbar" .}} |
| 125 | <div class="card empty-code"> |
| 126 | <h2>Empty repository</h2> |
| 127 | <p class="muted">Nothing has been pushed yet. Add this repository and push a branch:</p> |
| 128 | <pre>git remote add origin {{.SSHURL}} |
| 129 | git push -u origin {{.Ref}}</pre> |
| 130 | </div> |
| 131 | {{else}} |
| 132 | {{template "code_dir" .}} |
| 133 | {{end}} |
| 134 | {{end}} |
| 135 | |
| 136 | {{define "code_dir"}} |
| 137 | {{template "code_tabbar" .}} |
| 138 | {{if or .Entries .Path}} |
| 139 | <div class="panel dirlist"> |
| 140 | <table> |
| 141 | <tbody> |
| 142 | {{if .Path}} |
| 143 | <tr><td><a class="dir parent" href="{{if .Parent}}/{{$.Name}}/tree/{{esc $.Ref}}/{{pathurl .Parent}}{{else}}/{{$.Name}}/tree/{{esc $.Ref}}{{end}}" hx-get="{{if .Parent}}/{{$.Name}}/tree/{{esc $.Ref}}/{{pathurl .Parent}}{{else}}/{{$.Name}}/tree/{{esc $.Ref}}{{end}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">..</a></td></tr> |
| 144 | {{end}} |
| 145 | {{range .Entries}} |
| 146 | <tr> |
| 147 | <td> |
| 148 | {{if eq .Type "tree"}} |
| 149 | <a class="dir" href="/{{$.Name}}/tree/{{esc $.Ref}}/{{pathurl (pathjoin $.Path .Name)}}" hx-get="/{{$.Name}}/tree/{{esc $.Ref}}/{{pathurl (pathjoin $.Path .Name)}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">{{icon "folder"}}{{.Name}}/</a> |
| 150 | {{else}} |
| 151 | <a class="file {{fileclass .Name}}" href="/{{$.Name}}/blob/{{esc $.Ref}}/{{pathurl (pathjoin $.Path .Name)}}" hx-get="/{{$.Name}}/blob/{{esc $.Ref}}/{{pathurl (pathjoin $.Path .Name)}}" hx-target="#code-main" hx-swap="outerHTML" hx-push-url="true">{{icon (fileicon .Name)}}{{.Name}}</a> |
| 152 | {{end}} |
| 153 | </td> |
| 154 | </tr> |
| 155 | {{end}} |
| 156 | </tbody> |
| 157 | </table> |
| 158 | </div> |
| 159 | {{else}} |
| 160 | <div class="empty-state"><p>This directory is empty.</p></div> |
| 161 | {{end}} |
| 162 | {{end}} |
| 163 | |
| 164 | {{define "code_blob"}} |
| 165 | {{template "code_tabbar" .}} |
| 166 | {{if .Binary}} |
| 167 | <div class="card"> |
| 168 | <p class="muted">Binary file · {{bytes .Size}}. It is not shown inline.</p> |
| 169 | <p><a class="button secondary" href="/{{.Name}}/raw/{{esc .Ref}}/{{pathurl .Path}}">Download</a></p> |
| 170 | </div> |
| 171 | {{else}} |
| 172 | {{if .Truncated}}<p class="muted">Showing the first 1 MiB.</p>{{end}} |
| 173 | {{if .LineCut}}<p class="muted">Showing the first 5,000 lines.</p>{{end}} |
| 174 | {{if .Markdown}}<div class="md filebody">{{.Markdown}}</div> |
| 175 | {{else}} |
| 176 | <div class="panel blob"{{if .Language}} data-highlight="{{.Language}}"{{end}}> |
| 177 | <table class="code"> |
| 178 | <tbody> |
| 179 | {{range $i, $line := .Lines}} |
| 180 | <tr id="L{{inc $i}}"><td class="ln">{{inc $i}}</td><td class="code">{{$line}}</td></tr> |
| 181 | {{end}} |
| 182 | </tbody> |
| 183 | </table> |
| 184 | </div> |
| 185 | {{end}} |
| 186 | {{end}} |
| 187 | {{end}} |
| 188 |