Settings are now given through TEAMS/settings.json instead of been given through command line arguments

This commit is contained in:
nemunaire 2016-12-30 12:45:14 +01:00 committed by Pierre-Olivier Mercier
parent 37310e41f5
commit 10fe40e4a8
9 changed files with 209 additions and 69 deletions

View file

@ -9,12 +9,12 @@ import (
"time"
)
type SubmissionHandler struct {
ChallengeEnd time.Time
}
var challengeEnd time.Time = time.Unix(0, 0)
type SubmissionHandler struct {}
func (s SubmissionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Printf("Handling %s request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
log.Printf("Handling %s submission request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
w.Header().Set("Content-Type", "application/json")
@ -36,7 +36,7 @@ func (s SubmissionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
team := sURL[0]
if time.Now().Sub(s.ChallengeEnd) > 0 {
if time.Now().Sub(challengeEnd) > 0 {
http.Error(w, "{\"errmsg\":\"Vous ne pouvez plus soumettre, le challenge est terminé.\"}", http.StatusForbidden)
return
}