commit 74442cfbab63ae5fd7926c9f4c80361c73dcfc96 Author: Arlo Breault arlolra@gmail.com Date: Mon May 5 19:13:33 2014 -0700
Have the uptodate url always say you're out of date
* If the uptodate querystring parameter is set, you're probably using an old TBB and should be warned.
* This is trac 11666. --- handlers.go | 6 +++--- utils.go | 11 ++--------- 2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/handlers.go b/handlers.go index e806048..db5fe0b 100644 --- a/handlers.go +++ b/handlers.go @@ -50,7 +50,7 @@ func RootHandler(Layout *template.Template, Exits *Exits, domain *gettext.Domain }
// short circuit for torbutton - if len(r.URL.Query().Get("TorButton")) > 0 { + if IsParamSet(r, "TorButton") { WriteHTMLBuf(w, r, Layout, domain, "torbutton.html", Page{IsTor: isTor}) return } @@ -66,8 +66,8 @@ func RootHandler(Layout *template.Template, Exits *Exits, domain *gettext.Domain // instance of your page model p := Page{ isTor, - !UpToDate(r), - Small(r), + IsParamSet(r, "uptodate"), + IsParamSet(r, "small"), fingerprint, onOff, Lang(r), diff --git a/utils.go b/utils.go index 0a642db..79ba81e 100644 --- a/utils.go +++ b/utils.go @@ -17,15 +17,8 @@ import ( "strings" )
-func UpToDate(r *http.Request) bool { - if r.URL.Query().Get("uptodate") == "0" { - return false - } - return true -} - -func Small(r *http.Request) bool { - if len(r.URL.Query().Get("small")) > 0 { +func IsParamSet(r *http.Request, param string) bool { + if len(r.URL.Query().Get(param)) > 0 { return true } return false
tor-commits@lists.torproject.org