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

Configure Feed

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

all: no more pretty urls

+17 -35
+1 -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 20 17 server: 21 - fqdn: git.icyphox.sh 18 + name: git.icyphox.sh 22 19 host: 127.0.0.1 23 20 port: 5555
+1 -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:"prettyURL"` 27 - } `yaml:"goImport"` 28 - } `yaml:"misc"` 29 24 Server struct { 30 - FQDN string `yaml:"fqdn,omitempty"` 25 + Name string `yaml:"fqdn,omitempty"` 31 26 Host string `yaml:"host"` 32 27 Port int `yaml:"port"` 33 28 } `yaml:"server"`
+1 -1
go.mod
··· 1 - module icyphox.sh/legit 1 + module git.icyphox.sh/legit 2 2 3 3 go 1.19 4 4
+2 -2
main.go
··· 6 6 "log" 7 7 "net/http" 8 8 9 - "icyphox.sh/legit/config" 10 - "icyphox.sh/legit/routes" 9 + "git.icyphox.sh/legit/config" 10 + "git.icyphox.sh/legit/routes" 11 11 ) 12 12 13 13 func main() {
+4
readme
··· 7 7 Frenchman, and say "Oui, il est le git!" 8 8 9 9 But yeah it's pretty legit, on god no cap fr fr. 10 + 11 + INSTALLING 12 + 13 + Clone it, 'go build' it.
+1 -1
routes/handler.go
··· 5 5 "net/http" 6 6 "path/filepath" 7 7 8 + "git.icyphox.sh/legit/config" 8 9 "github.com/alexedwards/flow" 9 10 "github.com/sosedoff/gitkit" 10 - "icyphox.sh/legit/config" 11 11 ) 12 12 13 13 type depsWrapper struct {
+3 -17
routes/routes.go
··· 1 1 package routes 2 2 3 3 import ( 4 - "fmt" 5 4 "html/template" 6 5 "log" 7 6 "net/http" ··· 10 9 "sort" 11 10 "time" 12 11 12 + "git.icyphox.sh/legit/config" 13 + "git.icyphox.sh/legit/git" 13 14 "github.com/alexedwards/flow" 14 15 "github.com/dustin/go-humanize" 15 - "icyphox.sh/legit/config" 16 - "icyphox.sh/legit/git" 17 16 ) 18 17 19 18 type deps struct { ··· 113 112 return 114 113 } 115 114 116 - cloneURL := fmt.Sprintf("https://%s/%s", d.c.Server.FQDN, name) 117 - prettyURL := d.c.Misc.GoImport.PrettyURL 118 - 119 - if prettyURL == "" { 120 - prettyURL = cloneURL 121 - } else { 122 - prettyURL = filepath.Join(prettyURL, name) 123 - } 124 - 125 - goImport := fmt.Sprintf(`<meta name="go-import" content="%s git %s">`, 126 - prettyURL, cloneURL) 127 - 128 115 tpath := filepath.Join(d.c.Dirs.Templates, "*") 129 116 t := template.Must(template.ParseGlob(tpath)) 130 117 ··· 138 125 data["readme"] = readmeContent 139 126 data["commits"] = commits 140 127 data["desc"] = getDescription(path) 141 - data["clone"] = cloneURL 142 - data["goimport"] = template.HTML(goImport) 128 + data["servername"] = d.c.Server.Name 143 129 144 130 if err := t.ExecuteTemplate(w, "repo", data); err != nil { 145 131 log.Println(err)
+1 -1
routes/template.go
··· 9 9 "path/filepath" 10 10 "strings" 11 11 12 - "icyphox.sh/legit/git" 12 + "git.icyphox.sh/legit/git" 13 13 ) 14 14 15 15 func (d *deps) Write404(w http.ResponseWriter) {
+2 -2
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 }} 7 + {{ if .servername }} 8 + <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}"> 9 9 {{ end }} 10 10 <!-- other meta tags here --> 11 11 </head>
+1 -1
templates/repo.html
··· 36 36 <div class="clone-url"> 37 37 <strong>clone</strong> 38 38 <pre> 39 - git clone {{ .clone -}} 39 + git clone https://{{ .servername }}/{{ .name }} 40 40 </pre> 41 41 </div> 42 42 </main>