| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Package chromiumbuildstats implements chromium-build-stats.appspot.com servic
es. | 5 // Package chromiumbuildstats implements chromium-build-stats.appspot.com servic
es. |
| 6 package chromiumbuildstats | 6 package chromiumbuildstats |
| 7 | 7 |
| 8 import ( | 8 import ( |
| 9 "fmt" | 9 "fmt" |
| 10 "net/http" | 10 "net/http" |
| 11 "strings" |
| 12 ) |
| 13 |
| 14 const ( |
| 15 topHTML = ` |
| 16 <html> |
| 17 <head><title>chromium-build-stats</title></head> |
| 18 <body> |
| 19 <h1>chromium-build-stats</h1> |
| 20 <form action="/"> |
| 21 <label for="gsuri">gs URI:</label><input type="text" name="gsuri" /> |
| 22 <input type="submit" value="submit"><input type="reset"> |
| 23 </form> |
| 24 |
| 25 <hr /> |
| 26 See <a href="https://docs.google.com/a/chromium.org/document/d/16TdPTIIZbtAarXZI
MJdiT9CePG5WYCrdxm5u9UuHXNY/edit?pli=1#heading=h.xgjl2srtytjt">design doc</a> |
| 27 </body> |
| 28 </html> |
| 29 ` |
| 11 ) | 30 ) |
| 12 | 31 |
| 13 func init() { | 32 func init() { |
| 14 http.HandleFunc("/", handler) | 33 http.HandleFunc("/", handler) |
| 34 |
| 15 } | 35 } |
| 16 | 36 |
| 17 func handler(w http.ResponseWriter, r *http.Request) { | 37 func handler(w http.ResponseWriter, req *http.Request) { |
| 38 » gsuri := req.FormValue("gsuri") |
| 39 » if gsuri != "" { |
| 40 » » if strings.HasPrefix(gsuri, "gs://chrome-goma-log") { |
| 41 » » » http.Redirect(w, req, "/ninja_log"+strings.TrimPrefix(gs
uri, "gs://chrome-goma-log"), http.StatusSeeOther) |
| 42 » » » return |
| 43 » » } |
| 44 » » http.NotFound(w, req) |
| 45 » » return |
| 46 » } |
| 18 w.Header().Set("Content-Type", "text/html") | 47 w.Header().Set("Content-Type", "text/html") |
| 19 » fmt.Fprintf(w, `<p>Under construction. | 48 » fmt.Fprintf(w, topHTML) |
| 20 See <a href="https://docs.google.com/a/chromium.org/document/d/16TdPTIIZbtAarXZI
MJdiT9CePG5WYCrdxm5u9UuHXNY/edit?pli=1#heading=h.xgjl2srtytjt">design doc</a>`) | |
| 21 } | 49 } |
| OLD | NEW |