admin: add missing default settings
This commit is contained in:
parent
ba5642da8f
commit
3e5b4ebad2
|
@ -35,7 +35,7 @@ func (r ResponseWriterPrefix) Header() http.Header {
|
|||
|
||||
func (r ResponseWriterPrefix) WriteHeader(s int) {
|
||||
if v, exists := r.real.Header()["Location"]; exists {
|
||||
r.real.Header().Set("Location", r.prefix + v[0])
|
||||
r.real.Header().Set("Location", r.prefix+v[0])
|
||||
}
|
||||
r.real.WriteHeader(s)
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func StripPrefix(prefix string, h http.Handler) http.Handler {
|
|||
}
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if prefix != "/" && r.URL.Path == "/" {
|
||||
http.Redirect(w, r, prefix + "/", http.StatusFound)
|
||||
http.Redirect(w, r, prefix+"/", http.StatusFound)
|
||||
} else if p := strings.TrimPrefix(r.URL.Path, prefix); len(p) < len(r.URL.Path) {
|
||||
r2 := new(http.Request)
|
||||
*r2 = *r
|
||||
|
@ -169,12 +169,18 @@ func main() {
|
|||
Authors: "Laboratoire SRS, ÉPITA",
|
||||
FirstBlood: fic.FirstBlood,
|
||||
SubmissionCostBase: fic.SubmissionCostBase,
|
||||
ExerciceCurCoefficient: 1,
|
||||
HintCurCoefficient: 1,
|
||||
WChoiceCurCoefficient: 1,
|
||||
AllowRegistration: false,
|
||||
CanJoinTeam: false,
|
||||
DenyNameChange: false,
|
||||
EnableResolutionRoute: false,
|
||||
PartialValidation: true,
|
||||
UnlockedChallengeDepth:0,
|
||||
UnlockedChallengeDepth: 0,
|
||||
SubmissionUniqueness: false,
|
||||
DisplayAllFlags: false,
|
||||
EventKindness: false,
|
||||
}); err != nil {
|
||||
log.Fatal("Unable to initialize settings.json:", err)
|
||||
}
|
||||
|
@ -200,12 +206,12 @@ func main() {
|
|||
}
|
||||
|
||||
// Update base URL on main page
|
||||
log.Println("Changing base URL to", *baseURL + "/", "...")
|
||||
log.Println("Changing base URL to", *baseURL+"/", "...")
|
||||
if file, err := os.OpenFile(path.Join(StaticDir, "index.html"), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0644)); err != nil {
|
||||
log.Println("Unable to open index.html: ", err)
|
||||
} else if indexTmpl, err := template.New("index").Parse(indextpl); err != nil {
|
||||
log.Println("Cannot create template: ", err)
|
||||
} else if err = indexTmpl.Execute(file, map[string]string{"urlbase": path.Clean(path.Join(*baseURL + "/", "nuke"))[:len(path.Clean(path.Join(*baseURL + "/", "nuke"))) - 4]}); err != nil {
|
||||
} else if err = indexTmpl.Execute(file, map[string]string{"urlbase": path.Clean(path.Join(*baseURL+"/", "nuke"))[:len(path.Clean(path.Join(*baseURL+"/", "nuke")))-4]}); err != nil {
|
||||
log.Println("An error occurs during template execution: ", err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user