mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Added configurable HTTP Basic Auth.
This commit is contained in:
@@ -21,6 +21,10 @@ var cachedTeamFirstMatches map[int]string
|
||||
|
||||
// Shows the schedule editing page.
|
||||
func ScheduleGetHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if !UserIsAdmin(w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
if len(cachedScheduleBlocks) == 0 {
|
||||
tomorrow := time.Now().AddDate(0, 0, 1)
|
||||
location, _ := time.LoadLocation("Local")
|
||||
@@ -33,6 +37,10 @@ func ScheduleGetHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Generates the schedule and presents it for review without saving it to the database.
|
||||
func ScheduleGeneratePostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if !UserIsAdmin(w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
r.ParseForm()
|
||||
cachedMatchType = r.PostFormValue("matchType")
|
||||
scheduleBlocks, err := getScheduleBlocks(r)
|
||||
@@ -88,6 +96,10 @@ func ScheduleGeneratePostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Saves the generated schedule to the database.
|
||||
func ScheduleSavePostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if !UserIsAdmin(w, r) {
|
||||
return
|
||||
}
|
||||
|
||||
existingMatches, err := db.GetMatchesByType(cachedMatchType)
|
||||
if err != nil {
|
||||
handleWebErr(w, err)
|
||||
|
||||
Reference in New Issue
Block a user