Compare commits

..

1 Commits

Author SHA1 Message Date
Midou36O
daf1ffe95c
Merge pull request #11 from ProjectSegfault/options-pub
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Options pub
2022-09-18 18:21:57 +00:00
2 changed files with 3 additions and 12 deletions

View File

@ -24,14 +24,11 @@ func AnnCheck() {
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
})
http.HandleFunc("/api/set/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"false\"}", http.StatusOK)
http.HandleFunc("/api/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
})
} else {
AnnPage()
http.HandleFunc("/api/set/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"true\"}", http.StatusOK)
})
Announcements()
}
}
@ -64,6 +61,7 @@ func handleAnnouncements(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
now := time.Now().Unix()
data := map[string]interface{}{
"enabled": "true",
"title": r.FormValue("title"),
"link": r.FormValue("link"),
"severity": r.FormValue("severity"),

View File

@ -27,15 +27,8 @@ func FormCheck() {
http.HandleFunc("/form", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Form is disabled.", http.StatusServiceUnavailable)
})
http.HandleFunc("/api/set/form", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"false\"}", http.StatusOK)
})
} else {
FormPage()
http.HandleFunc("/api/set/form", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"true\"}", http.StatusOK)
})
Form()
}
}