git-preview @ main

static git web frontend but with images and html previews + code truncation

git: hide .git extension

Fri, 05 Jul 2024
4 files changed, 25 insertions(+), 8 deletions(-)
M routes/routes.go

@@ -33,8 +33,8 @@ return

} type info struct { - Name, Desc, Idle string - d time.Time + DisplayName, Name, Desc, Idle string + d time.Time } infos := []info{}

… preview truncated

M routes/util.go

@@ -16,6 +16,14 @@ _, err := gr.FileContent("go.mod")

return err == nil } +func getDisplayName(name string) string { + l := len(name) - 4 + if name[l:] == ".git" { + name = name[:l] + } + return name +}

… preview truncated

M templates/index.html

@@ -10,7 +10,7 @@ <body>

<main> <div class="index"> {{ range .info }} - <div class="index-name"><a href="/{{ .Name }}">{{ .Name }}</a></div> + <div class="index-name"><a href="/{{ .Name }}">{{ .DisplayName }}</a></div> <div class="desc">{{ .Desc }}</div> <div>{{ .Idle }}</div> {{ end }}

… and 1 more changed files not shown in this preview