Quick fix + Modularity + New form option.
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
6bdbf3b83d
commit
fcf66afb14
@ -24,11 +24,14 @@ func AnnCheck() {
|
|||||||
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
|
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
|
||||||
})
|
})
|
||||||
http.HandleFunc("/api/announcements", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/api/set/announcements", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
|
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
AnnPage()
|
AnnPage()
|
||||||
|
http.HandleFunc("/api/set/announcements", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.Error(w, "{\"enabled\": \"true\"}", http.StatusServiceUnavailable)
|
||||||
|
})
|
||||||
Announcements()
|
Announcements()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +64,6 @@ func handleAnnouncements(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"enabled": "true",
|
|
||||||
"title": r.FormValue("title"),
|
"title": r.FormValue("title"),
|
||||||
"link": r.FormValue("link"),
|
"link": r.FormValue("link"),
|
||||||
"severity": r.FormValue("severity"),
|
"severity": r.FormValue("severity"),
|
||||||
|
@ -27,8 +27,15 @@ func FormCheck() {
|
|||||||
http.HandleFunc("/form", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/form", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "Form is disabled.", http.StatusServiceUnavailable)
|
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.StatusServiceUnavailable)
|
||||||
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FormPage()
|
FormPage()
|
||||||
|
http.HandleFunc("/api/set/form", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.Error(w, "{\"enabled\": \"true\"}", http.StatusServiceUnavailable)
|
||||||
|
})
|
||||||
Form()
|
Form()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user