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

Configure Feed

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

only add go meta import tag if go.mod exists in repo root

This is a multipart message in MIME format.

Pretty self-explanitory :3

Signed-off-by: Derek Stevens <nilix@nilfm.cc>

authored by

Derek Stevens and committed by
Anirudh Oppiliappan
de046690 3060c752

+9 -1
+1
routes/routes.go
··· 151 151 data["commits"] = commits 152 152 data["desc"] = getDescription(path) 153 153 data["servername"] = d.c.Server.Name 154 + data["gomod"] = isGoModule(gr) 154 155 155 156 if err := t.ExecuteTemplate(w, "repo", data); err != nil { 156 157 log.Println(err)
+7
routes/util.go
··· 3 3 import ( 4 4 "os" 5 5 "path/filepath" 6 + 7 + "git.icyphox.sh/legit/git" 6 8 ) 9 + 10 + func isGoModule(gr *git.GitRepo) bool { 11 + _, err := gr.FileContent("go.mod") 12 + return err == nil 13 + } 7 14 8 15 func getDescription(path string) (desc string) { 9 16 db, err := os.ReadFile(filepath.Join(path, "description"))
+1 -1
templates/head.html
··· 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 7 <link rel="icon" type="image/png" size="32x32" href="/static/legit.png"> 8 - {{ if .servername }} 8 + {{ if and .servername .gomod }} 9 9 <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}"> 10 10 {{ end }} 11 11 <!-- other meta tags here -->