From d8c7ec22951a798d7f1ead745f80de528b525370 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Thu, 21 May 2015 22:59:28 -0700 Subject: [PATCH] favicon --- favicon.ico | Bin 0 -> 1150 bytes route_handlers.go | 9 +++++++++ templates/layout.html | 2 ++ 3 files changed, 11 insertions(+) create mode 100644 favicon.ico diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..72bb6a1403cc78621b7af7e1a0b74e66bf0052af GIT binary patch literal 1150 zcmZ`&OG{f(5T4IkP+D78g3v$~B2wH`veHHWM-ge83dtgiXj|=0-K0ta3L#krxo%1| z3C7n#rNo61sqd;_1wo0TF~%41J)Uz+5J9}9r6j&)vK11Q5mA*O zArcZL7r*~M^Yd99?Dkg}9CRQW^<#QEj94tB^O1-H&CQmKAsQPM%bXDvk>B5prKMj; zr5MclbaceJPSZYu=$Qn;W>Z*;<*~qekW60cxUn&Y+s)|iR^;)p$VvH2B(Bik@6Pxr zXlMXhTHZtYmvMW08Ka|&^>xO^hN87K#^fZ!>t&puGxqmy5eV2t@B*re240_>ozQfg( zlFORv>t$Z*Y_l=i+7vJPOJ*}e#*j57lPr4IK-JY{n3+lFvV#NFo7q`q?6>g!vQX?VIy*lg9#TK+%Zii)RVpBz|NIK$oDzx^yPr^)5|g!1yDEVi~b%j!%` zjS21TpAia0#XiR|F%d^N97RXR7c!Y%Q0~4G6&KUZYogS1q939XNo}GiNyaB5&)7+f G#NGph_&fyw literal 0 HcmV?d00001 diff --git a/route_handlers.go b/route_handlers.go index ee73ca8..0f17eae 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -15,6 +15,7 @@ import ( "github.com/dballard/transmet/news" "bytes" txtTemplate "text/template" + "path" ) func GetFlashes(session *sessions.Session) map[string]interface{} { @@ -250,10 +251,18 @@ func addedHandler(w http.ResponseWriter, r *http.Request, user *user.User) { ShowTemplate("added", w, map[string]interface{}{"user": user, "flashes": flashes}) } + + +func ServeFileHandler(res http.ResponseWriter, req *http.Request) { + fname := path.Base(req.URL.Path) + http.ServeFile(res, req, "./"+fname) + } + func init_route_handlers() { http.Handle("/js/", http.StripPrefix("/js/", http.FileServer(http.Dir("js/")))) http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css/")))) http.Handle("/fonts/", http.StripPrefix("/fonts", http.FileServer(http.Dir("fonts/")))) + http.HandleFunc("/favicon.ico", ServeFileHandler) r := mux.NewRouter() diff --git a/templates/layout.html b/templates/layout.html index a4a5488..e0bbe25 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -12,6 +12,8 @@ + +