Compare commits

...
This repository has been archived on 2022-10-30. You can view files and clone it, but cannot push or open issues or pull requests.

3 Commits

Author SHA1 Message Date
79f5117e63
Status OK
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-09-27 15:41:14 +01:00
0cdcadb27b
Uuuh yeah Status OK is better here.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-09-24 16:30:27 +01:00
fcf66afb14
Quick fix + Modularity + New form option.
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2022-09-24 16:26:47 +01:00
2 changed files with 12 additions and 3 deletions

View File

@ -24,11 +24,14 @@ func AnnCheck() {
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
})
http.HandleFunc("/api/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
http.HandleFunc("/api/set/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"false\"}", http.StatusOK)
})
} else {
AnnPage()
http.HandleFunc("/api/set/announcements", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "{\"enabled\": \"true\"}", http.StatusOK)
})
Announcements()
}
}
@ -61,7 +64,6 @@ 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,8 +27,15 @@ 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()
}
}