Remove redirect Doesn't really work for icyphox.sh/* since httpd(8) 404s it.
Anirudh Oppiliappan x@icyphox.sh
Fri, 02 Dec 2022 17:40:35 +0530
M
main.go
→
main.go
@@ -11,8 +11,8 @@ )
type config struct { prettyurl string - giturl string - addr string + giturl string + addr string } func logger(h http.Handler) http.Handler {@@ -29,16 +29,12 @@
func (c *config) goget(w http.ResponseWriter, r *http.Request) { w.Header().Set("content-type", "text/html") - if r.URL.Query().Get("go-get") == "1" { - pretty := path.Join(c.prettyurl, r.URL.Path) - content := path.Join(c.giturl, r.URL.Path) - fmt.Fprintf( - w, `<head><meta name="go-import" content="%s git https://%s"></head>`, - pretty, content, - ) - } else { - http.Redirect(w, r, "https://"+c.giturl, http.StatusTemporaryRedirect) - } + pretty := path.Join(c.prettyurl, r.URL.Path) + content := path.Join(c.giturl, r.URL.Path) + fmt.Fprintf( + w, `<head><meta name="go-import" content="%s git https://%s"></head>`, + pretty, content, + ) return }
M
readme
→
readme
@@ -1,8 +1,8 @@
goget ----- -go-import meta tag server. Serves the below meta tag if the URL query contains -?go-get=1; else, redirects to the specified git URL (assumes https://). +go-import meta tag server. Serves the below meta tag if the URL query +contains go-get=1. <head><meta name="go-import" content="example.com git https://git.example.com"></head>