From 2be052201762ccee75e09b69c95405b9415cef72 Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Fri, 20 Dec 2013 17:57:37 -0800 Subject: [PATCH] Use https for badge. --- database/index.go | 3 ++- gddo-server/assets/templates/tools.html | 6 +++--- gddo-server/main.go | 8 ++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/database/index.go b/database/index.go index 83612c96..acfe9ebb 100644 --- a/database/index.go +++ b/database/index.go @@ -32,7 +32,8 @@ func normalizeProjectRoot(projectRoot string) string { } var synonyms = map[string]string{ - "redis": "redisdb", + "redis": "redisdb", // append db to avoid stemming to 'red' + "rand": "random", "postgres": "postgresql", "mongo": "mongodb", } diff --git a/gddo-server/assets/templates/tools.html b/gddo-server/assets/templates/tools.html index 04814afd..0689b9ca 100644 --- a/gddo-server/assets/templates/tools.html +++ b/gddo-server/assets/templates/tools.html @@ -6,16 +6,16 @@

Tools for {{$.pdoc.PageName}}

Badge

-

GoDoc +

GoDoc

Use one of the snippets below to add a link to GoDoc from your project website or README file:

HTML
- +
Markdown
- + {{if .pdoc.Name}}

Lint

diff --git a/gddo-server/main.go b/gddo-server/main.go index f503684a..d09cf2cc 100644 --- a/gddo-server/main.go +++ b/gddo-server/main.go @@ -294,10 +294,13 @@ func servePackage(resp http.ResponseWriter, req *http.Request) error { "pdoc": newTDoc(pdoc), }) case isView(req, "tools"): + proto := "http" + if req.Host == "godoc.org" { + proto = "https" + } return executeTemplate(resp, "tools.html", http.StatusOK, nil, map[string]interface{}{ - "uri": fmt.Sprintf("http://%s/%s?status.png", req.Host, importPath), + "uri": fmt.Sprintf("%s://%s/%s", proto, req.Host, importPath), "pdoc": newTDoc(pdoc), - "host": req.Host, }) case isView(req, "redir"): if srcFiles == nil { @@ -890,6 +893,7 @@ func main() { mux.Handle("/robots.txt", staticServer.FileHandler("robots.txt")) mux.Handle("/BingSiteAuth.xml", staticServer.FileHandler("BingSiteAuth.xml")) mux.Handle("/C", http.RedirectHandler("http://golang.org/doc/articles/c_go_cgo.html", 301)) + mux.Handle("/ajax.googleapis.com/", http.NotFoundHandler()) mux.Handle("/", handler(serveHome)) cacheBusters.Handler = mux