From d83b2fc139c16f08269c8799c69fd2bcfef1c1ae Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 2 Mar 2014 22:37:29 -0800 Subject: [PATCH] Move handler to established URI. Add CORS wildcard. --- cmd/unread/unread.go | 3 ++- static/index.html | 43 +++++++++---------------------------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/cmd/unread/unread.go b/cmd/unread/unread.go index d2764d7..d4a7806 100644 --- a/cmd/unread/unread.go +++ b/cmd/unread/unread.go @@ -93,6 +93,7 @@ func newMailCounter() *mailCounter { } func (mc *mailCounter) ServeHTTP(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") c := map[string]int{} for k, v := range mc.counts { if v != 0 { @@ -269,7 +270,7 @@ func main() { mc := newMailCounter() go func() { - http.Handle("/", mc) + http.Handle("/unread", mc) err := http.ListenAndServe(*addr, nil) if err != nil { log.Fatal(err) diff --git a/static/index.html b/static/index.html index 8ec04af..b83588f 100755 --- a/static/index.html +++ b/static/index.html @@ -4,46 +4,16 @@ - Email – Layout Examples – Pure - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - -