forked from tangled.org/core
Monorepo for Tangled

appview/{pages,middleware}: serve go-import tags for tangled.org as well

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

anirudh.fi f9e599fd 11737c53

verified
Changed files
+10 -1
appview
middleware
pages
templates
repo
fragments
+6 -1
appview/middleware/middleware.go
··· 317 317 318 318 // this should serve the go-import meta tag even if the path is technically 319 319 // a 404 like tangled.sh/oppi.li/go-git/v5 320 + // 321 + // we're keeping the tangled.sh go-import tag too to maintain backward 322 + // compatiblity for modules that still point there. they will be redirected 323 + // to fetch source from tangled.org 320 324 func (mw Middleware) GoImport() middlewareFunc { 321 325 return func(next http.Handler) http.Handler { 322 326 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ··· 332 336 if r.Header.Get("User-Agent") == "Go-http-client/1.1" { 333 337 if r.URL.Query().Get("go-get") == "1" { 334 338 html := fmt.Sprintf( 335 - `<meta name="go-import" content="tangled.sh/%s git https://tangled.sh/%s"/>`, 339 + `<meta name="go-import" content="tangled.sh/%s git https://tangled.sh/%s"/> 340 + <meta name="go-import" content="tangled.org/%s git https://tangled.org/%s"/>`, 336 341 fullName, 337 342 fullName, 338 343 )
+4
appview/pages/templates/repo/fragments/meta.html
··· 23 23 name="go-import" 24 24 content="tangled.sh/{{ .RepoInfo.FullNameWithoutAt }} git https://tangled.sh/{{ .RepoInfo.FullName }}" 25 25 /> 26 + <meta 27 + name="go-import" 28 + content="tangled.org/{{ .RepoInfo.FullNameWithoutAt }} git https://tangled.org/{{ .RepoInfo.FullName }}" 29 + /> 26 30 {{ end }}