From 6837ddf68f13a1633ea868ab55d71389ca5bc175 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Fri, 27 Feb 2015 04:02:15 +0100 Subject: Version 0.2. Sends E-Mails now. Also sticky post on index page to quickly inform people. Concatenated all CSS and JavaScript files. --- app/main.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'app/main.go') diff --git a/app/main.go b/app/main.go index 6190b1a..f4bddda 100644 --- a/app/main.go +++ b/app/main.go @@ -13,9 +13,11 @@ import ( var decoder = schema.NewDecoder() -var store = sessions.NewCookieStore([]byte(RandomKey())) +//var store = sessions.NewCookieStore([]byte(RandomKey())) +var store = sessions.NewCookieStore([]byte(os.Getenv("STATUS_SECRET"))) var mainTempl = template.Must(template.New("global").Funcs(template.FuncMap{"add": add}).ParseGlob("../views/*.html")) +var emailTempl = template.Must(template.New("email").Funcs(template.FuncMap{"add": add}).ParseGlob("../views/email/*.html")) var c = cron.New() @@ -33,8 +35,6 @@ func main() { checkConfig() jobRun() InitDB() - insertHost() - insertAdmin() go func() { err := FillCache() if err != nil { @@ -46,15 +46,19 @@ func main() { r.HandleFunc("/", IndexHandler) r.HandleFunc("/login", LoginHandler).Methods("POST") r.HandleFunc("/login", PrintLoginHandler).Methods("GET") - r.HandleFunc("/logout", LogoutHandler) + r.HandleFunc("/logout", LogoutHandler).Methods("POST") r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./../static")))) r.HandleFunc("/register", RegisterHandler).Methods("POST") - r.HandleFunc("/register", PrintRegisterHandler).Methods("GET") + //r.HandleFunc("/register", PrintRegisterHandler).Methods("GET") r.HandleFunc("/new", AddNewJobHandler).Methods("POST") - r.HandleFunc("/new", PrintNewJobHandler).Methods("GET") + //r.HandleFunc("/new", PrintNewJobHandler).Methods("GET") r.HandleFunc("/refresh", RefreshAllHandler).Methods("POST") - r.HandleFunc("/jobs", ShowJobHandler) + //r.HandleFunc("/jobs", ShowJobHandler) r.HandleFunc("/admin", AdminHandler) + r.HandleFunc("/register", SetupHandler) + //r.HandleFunc("/delete", DeleteHandler).Methods("POST") + r.HandleFunc("/delete", DeleteHandler) + r.HandleFunc("/sticky/new", NewStickyHandler).Methods("POST") http.Handle("/", r) -- cgit v1.2.3