web frontend for git (tangled's grandpa)
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

all: go-import, clone url

+54 -9
+4
config.yaml
··· 14 14 meta: 15 15 title: git good 16 16 description: i think it's a skill issue 17 + misc: 18 + goImport: 19 + prettyURL: icyphox.sh 17 20 server: 21 + fqdn: git.icyphox.sh 18 22 host: 127.0.0.1 19 23 port: 5555
+6
config/config.go
··· 21 21 Title string `yaml:"title"` 22 22 Description string `yaml:"description"` 23 23 } `yaml:"meta"` 24 + Misc struct { 25 + GoImport struct { 26 + PrettyURL string `yaml:"string"` 27 + } `yaml:"goImport"` 28 + } `yaml:"misc"` 24 29 Server struct { 30 + FQDN string `yaml:"fqdn,omitempty"` 25 31 Host string `yaml:"host"` 26 32 Port int `yaml:"port"` 27 33 } `yaml:"server"`
+12
routes/routes.go
··· 1 1 package routes 2 2 3 3 import ( 4 + "fmt" 4 5 "html/template" 5 6 "log" 6 7 "net/http" ··· 112 113 return 113 114 } 114 115 116 + cloneURL := fmt.Sprintf("https://%s/%s", d.c.Server.FQDN, name) 117 + 118 + if d.c.Misc.GoImport.PrettyURL == "" { 119 + d.c.Misc.GoImport.PrettyURL = cloneURL 120 + } 121 + 122 + goImport := fmt.Sprintf(`<meta name="go-import" content="%s git %s">`, 123 + d.c.Misc.GoImport.PrettyURL, cloneURL) 124 + 115 125 tpath := filepath.Join(d.c.Dirs.Templates, "*") 116 126 t := template.Must(template.ParseGlob(tpath)) 117 127 ··· 125 135 data["readme"] = readmeContent 126 136 data["commits"] = commits 127 137 data["desc"] = getDescription(path) 138 + data["clone"] = cloneURL 139 + data["goimport"] = template.HTML(goImport) 128 140 129 141 if err := t.ExecuteTemplate(w, "repo", data); err != nil { 130 142 log.Println(err)
+14 -5
static/style.css
··· 111 111 min-width: 0; 112 112 } 113 113 114 + .clone-url { 115 + padding-top: 2rem; 116 + } 117 + 118 + .clone-url pre { 119 + color: var(--dark); 120 + } 121 + 114 122 .desc { 115 123 color: var(--gray); 116 124 font-style: italic; ··· 146 154 white-space: pre-wrap; 147 155 } 148 156 157 + .readme { 158 + padding-bottom: 2rem; 159 + border-bottom: 1.5px solid var(--medium-gray); 160 + } 161 + 149 162 .diff { 150 163 margin: 1rem 0 1rem 0; 151 164 padding: 1rem 0 1rem 0; ··· 158 171 159 172 .diff-stat { 160 173 padding: 1rem 0 1rem 0; 161 - } 162 - 163 - .commit-email { 164 - color: var(--gray); 165 174 } 166 175 167 176 .commit-email:before { ··· 230 239 231 240 .commit-info { 232 241 color: var(--gray); 233 - font-size: 14px; 242 + padding-bottom: 1.5rem; 234 243 } 235 244 236 245 @media (max-width: 600px) {
+5 -2
templates/commit.html
··· 10 10 <pre> 11 11 {{- .commit.Message -}} 12 12 </pre> 13 - <p>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</p> 14 - <p>{{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span></p> 13 + <div class="commit-info"> 14 + {{ .commit.Author.Name }} <span class="commit-email">{{ .commit.Author.Email}}</span> 15 + <div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> 16 + </div> 17 + 15 18 <p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}"> 16 19 {{ .commit.This }} 17 20 </a>
+3
templates/head.html
··· 4 4 <meta name="viewport" content="width=device-width, initial-scale=1"> 5 5 <link rel="stylesheet" href="/static/style.css" type="text/css"> 6 6 <link rel="stylesheet" href="https://cdn.icyphox.sh/fonts/inter.css" type="text/css"> 7 + {{ if .goimport }} 8 + {{ .goimport }} 9 + {{ end }} 7 10 <!-- other meta tags here --> 8 11 </head> 9 12 {{ end }}
+10 -2
templates/repo.html
··· 25 25 </div> 26 26 {{ end }} 27 27 </div> 28 - 28 + {{- if .readme }} 29 29 <article class="readme"> 30 30 <pre> 31 - {{- if .readme }}{{ .readme }}{{- end -}} 31 + {{- .readme -}} 32 32 </pre> 33 33 </article> 34 + {{- end -}} 35 + 36 + <div class="clone-url"> 37 + <strong>clone</strong> 38 + <pre> 39 + git clone {{ .clone -}} 40 + </pre> 41 + </div> 34 42 </main> 35 43 </body> 36 44 </html>