diff --git a/config.yaml b/config.yaml index 820d69d..7333e95 100644 --- a/config.yaml +++ b/config.yaml @@ -14,10 +14,7 @@ dirs: meta: title: git good description: i think it's a skill issue -misc: - goImport: - prettyURL: icyphox.sh server: - fqdn: git.icyphox.sh + name: git.icyphox.sh host: 127.0.0.1 port: 5555 diff --git a/config/config.go b/config/config.go index 6867129..743b2f5 100644 --- a/config/config.go +++ b/config/config.go @@ -21,13 +21,8 @@ type Config struct { Title string `yaml:"title"` Description string `yaml:"description"` } `yaml:"meta"` - Misc struct { - GoImport struct { - PrettyURL string `yaml:"prettyURL"` - } `yaml:"goImport"` - } `yaml:"misc"` Server struct { - FQDN string `yaml:"fqdn,omitempty"` + Name string `yaml:"fqdn,omitempty"` Host string `yaml:"host"` Port int `yaml:"port"` } `yaml:"server"` diff --git a/go.mod b/go.mod index 3987517..c16525e 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module icyphox.sh/legit +module git.icyphox.sh/legit go 1.19 diff --git a/main.go b/main.go index 8a1c87e..942b9de 100644 --- a/main.go +++ b/main.go @@ -6,8 +6,8 @@ import ( "log" "net/http" - "icyphox.sh/legit/config" - "icyphox.sh/legit/routes" + "git.icyphox.sh/legit/config" + "git.icyphox.sh/legit/routes" ) func main() { diff --git a/readme b/readme index ba544f3..f6dc662 100644 --- a/readme +++ b/readme @@ -7,3 +7,7 @@ Pronounced however you like; I prefer channeling my beret-wearing Frenchman, and say "Oui, il est le git!" But yeah it's pretty legit, on god no cap fr fr. + +INSTALLING + +Clone it, 'go build' it. diff --git a/routes/handler.go b/routes/handler.go index d230773..c0b146c 100644 --- a/routes/handler.go +++ b/routes/handler.go @@ -5,9 +5,9 @@ import ( "net/http" "path/filepath" + "git.icyphox.sh/legit/config" "github.com/alexedwards/flow" "github.com/sosedoff/gitkit" - "icyphox.sh/legit/config" ) type depsWrapper struct { diff --git a/routes/routes.go b/routes/routes.go index 1edff21..7ec2178 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -1,7 +1,6 @@ package routes import ( - "fmt" "html/template" "log" "net/http" @@ -10,10 +9,10 @@ import ( "sort" "time" + "git.icyphox.sh/legit/config" + "git.icyphox.sh/legit/git" "github.com/alexedwards/flow" "github.com/dustin/go-humanize" - "icyphox.sh/legit/config" - "icyphox.sh/legit/git" ) type deps struct { @@ -113,18 +112,6 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) { return } - cloneURL := fmt.Sprintf("https://%s/%s", d.c.Server.FQDN, name) - prettyURL := d.c.Misc.GoImport.PrettyURL - - if prettyURL == "" { - prettyURL = cloneURL - } else { - prettyURL = filepath.Join(prettyURL, name) - } - - goImport := fmt.Sprintf(``, - prettyURL, cloneURL) - tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) @@ -138,8 +125,7 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) { data["readme"] = readmeContent data["commits"] = commits data["desc"] = getDescription(path) - data["clone"] = cloneURL - data["goimport"] = template.HTML(goImport) + data["servername"] = d.c.Server.Name if err := t.ExecuteTemplate(w, "repo", data); err != nil { log.Println(err) diff --git a/routes/template.go b/routes/template.go index 6af5cfe..d3e0cef 100644 --- a/routes/template.go +++ b/routes/template.go @@ -9,7 +9,7 @@ import ( "path/filepath" "strings" - "icyphox.sh/legit/git" + "git.icyphox.sh/legit/git" ) func (d *deps) Write404(w http.ResponseWriter) { diff --git a/templates/head.html b/templates/head.html index 0bde52e..1121480 100644 --- a/templates/head.html +++ b/templates/head.html @@ -4,8 +4,8 @@ - {{ if .goimport }} - {{ .goimport }} + {{ if .servername }} + {{ end }} diff --git a/templates/repo.html b/templates/repo.html index 8dc5f54..c588a0f 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -36,7 +36,7 @@
-git clone {{ .clone -}} +git clone https://{{ .servername }}/{{ .name }}