|
|
|
@ -101,11 +101,9 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create default handlers
|
|
|
|
|
http.HandleFunc("/", createDefaultHandler())
|
|
|
|
|
http.HandleFunc("/health", createHealthHandler())
|
|
|
|
|
http.HandleFunc("/health.json", createHealthHandler())
|
|
|
|
|
http.HandleFunc("/index", createDefaultHandler())
|
|
|
|
|
http.HandleFunc("/index.htm", createDefaultHandler())
|
|
|
|
|
http.HandleFunc("/index.html", createDefaultHandler())
|
|
|
|
|
http.HandleFunc("/robots.txt", createRobotsHandler())
|
|
|
|
|
|
|
|
|
|
// Register hooks
|
|
|
|
@ -223,8 +221,16 @@ func createHealthHandler() Handler {
|
|
|
|
|
|
|
|
|
|
func createDefaultHandler() Handler {
|
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
w.WriteHeader(200)
|
|
|
|
|
fmt.Fprintf(w, "weblug - webhook receiver program\nSee https://codeberg.org/grisu48/weblug\n")
|
|
|
|
|
if r.URL.Path == "/" || r.URL.Path == "/index.txt" {
|
|
|
|
|
w.WriteHeader(200)
|
|
|
|
|
fmt.Fprintf(w, "weblug - webhook receiver program\nhttps://codeberg.org/grisu48/weblug\n")
|
|
|
|
|
} else if r.URL.Path == "/index.htm" || r.URL.Path == "/index.html" {
|
|
|
|
|
w.WriteHeader(200)
|
|
|
|
|
fmt.Fprintf(w, "<!DOCTYPE html><html><head><title>weblug</title></head>\n<body><p><a href=\"https://codeberg.org/grisu48/weblug\">weblug</a> - webhook receiver program</p>\n</body></html>")
|
|
|
|
|
} else {
|
|
|
|
|
w.WriteHeader(404)
|
|
|
|
|
fmt.Fprintf(w, "not found\n")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|