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
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
data/config.toml
|
data/config.toml
|
||||||
data/options.json
|
|
@ -18,12 +18,12 @@ var (
|
|||||||
resAnn = config.OptAnn()
|
resAnn = config.OptAnn()
|
||||||
)
|
)
|
||||||
|
|
||||||
func CheckAnn() {
|
func AnnCheck() {
|
||||||
if resAnn == "true" {
|
if resAnn == "true" {
|
||||||
AnnPage()
|
AnnPage()
|
||||||
Announcements()
|
Announcements()
|
||||||
} else {
|
} else {
|
||||||
log.Println("Announcements disabled")
|
log.Println("[Segfautils] ℹ Announcements are disabled")
|
||||||
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)
|
||||||
})
|
})
|
||||||
@ -61,6 +61,7 @@ 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"),
|
||||||
|
@ -26,13 +26,10 @@ func FormCheck() {
|
|||||||
FormPage()
|
FormPage()
|
||||||
Form()
|
Form()
|
||||||
} else {
|
} else {
|
||||||
log.Println("Forms disabled")
|
log.Println("[Segfautils] ℹ Contact form is disabled")
|
||||||
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/form", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
http.Error(w, "{\"enabled\": \"false\"}", http.StatusServiceUnavailable)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
main.go
2
main.go
@ -28,7 +28,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
log.Println("[HTTP] Starting server")
|
log.Println("[HTTP] Starting server")
|
||||||
api.CheckAnn()
|
api.AnnCheck()
|
||||||
api.FormCheck()
|
api.FormCheck()
|
||||||
|
|
||||||
http.HandleFunc("/api/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/api/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Reference in New Issue
Block a user