From df0962a39ebef3853cbe90b3f7b07f7d2fce96d6 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Mon, 19 Dec 2022 09:02:23 +0530 Subject: all: no more pretty urls --- routes/handler.go | 2 +- routes/routes.go | 20 +++----------------- routes/template.go | 2 +- 3 files changed, 5 insertions(+), 19 deletions(-) (limited to 'routes') 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) { -- cgit