all repos — legit @ 80ba8a576b5adaed426580a26318bf540f44feb2

legit - simple git web interface in go (fork)

Merge branch 'go.mod'
Iris Lightshard nilix@nilfm.cc
commit

80ba8a576b5adaed426580a26318bf540f44feb2

parent

9b99bc7cb8cd30c12698436d1121fc322df74ef6

3 files changed, 9 insertions(+), 1 deletions(-)

jump to
M routes/routes.goroutes/routes.go

@@ -151,6 +151,7 @@ data["readme"] = readmeContent

data["commits"] = commits data["desc"] = getDescription(path) data["servername"] = d.c.Server.Name + data["gomod"] = isGoModule(gr) if err := t.ExecuteTemplate(w, "repo", data); err != nil { log.Println(err)
M routes/util.goroutes/util.go

@@ -3,7 +3,14 @@

import ( "os" "path/filepath" + + "git.icyphox.sh/legit/git" ) + +func isGoModule(gr *git.GitRepo) bool { + _, err := gr.FileContent("go.mod") + return err == nil +} func getDescription(path string) (desc string) { db, err := os.ReadFile(filepath.Join(path, "description"))
M templates/head.htmltemplates/head.html

@@ -5,7 +5,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="/static/style.css" type="text/css"> <link rel="stylesheet" href="https://cdn.icyphox.sh/fonts/inter.css" type="text/css"> <link rel="icon" type="image/png" size="32x32" href="/static/legit.png"> - {{ if .servername }} + {{ if and .servername .gomod }} <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}"> {{ end }} <!-- other meta tags here -->