Fix everything odyssey pointed out.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
65d35747fc
commit
1c2e6e3da9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
||||
data/config.toml
|
||||
data/options.json
|
@ -18,12 +18,12 @@ var (
|
||||
resAnn = config.OptAnn()
|
||||
)
|
||||
|
||||
func CheckAnn() {
|
||||
func AnnCheck() {
|
||||
if resAnn == "true" {
|
||||
AnnPage()
|
||||
Announcements()
|
||||
} else {
|
||||
log.Println("Announcements disabled")
|
||||
log.Println("[Segfautils] ℹ Announcements are disabled")
|
||||
http.HandleFunc("/announcements", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "Announcements are disabled.", http.StatusServiceUnavailable)
|
||||
})
|
||||
@ -61,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"),
|
||||
|
@ -26,13 +26,10 @@ func FormCheck() {
|
||||
FormPage()
|
||||
Form()
|
||||
} else {
|
||||
log.Println("Forms disabled")
|
||||
log.Println("[Segfautils] ℹ Contact form is disabled")
|
||||
http.HandleFunc("/form", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "Form is disabled.", http.StatusServiceUnavailable)
|
||||
})
|
||||
http.HandleFunc("/api/form", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user