all repos — goget @ 8156e331c23cb837bd08cb51c8bdf24a685f2e1c

returns a go-import meta tag

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
commit

8156e331c23cb837bd08cb51c8bdf24a685f2e1c

parent

7732a61b7775ba7448e1c69e0d577577f1e228f2

2 files changed, 10 insertions(+), 14 deletions(-)

jump to
M main.gomain.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 readmereadme

@@ -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>