diff options
author | terminaldweller <thabogre@gmail.com> | 2021-07-22 02:31:43 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-07-22 02:31:43 +0000 |
commit | 018d77f1c44e0d08025ce5240b1ed5c3c2887b0d (patch) | |
tree | 96e89a8a37962adbef8608208a88d8238dabf6d0 /hived.go | |
parent | added graceful shutdown.fixed the -help crashing problem. wasnt setting the c... (diff) | |
download | hived-018d77f1c44e0d08025ce5240b1ed5c3c2887b0d.tar.gz hived-018d77f1c44e0d08025ce5240b1ed5c3c2887b0d.zip |
want to switch to grpc for the telegram bot. obviously take the telegram bot out of hived. added a robots.txt hadnler
Diffstat (limited to 'hived.go')
-rw-r--r-- | hived.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -21,7 +21,7 @@ import ( "github.com/Knetic/govaluate" "github.com/go-redis/redis/v8" - "github.com/go-telegram-bot-api/telegram-bot-api" + tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api" "github.com/gorilla/mux" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -591,6 +591,13 @@ func healthHandler(w http.ResponseWriter, r *http.Request) { }{IsHivedOk: IsHivedOk, HivedError: HivedError, IsRedisOk: IsRedisOk, RedisError: RedisError}) } +func robotsHandler(w http.ResponseWriter, r *http.Request) { + json.NewEncoder(w).Encode(struct { + UserAgents string `json:"User-Agents"` + Disallow string `json:"Disallow"` + }{"*", "/"}) +} + func startServer(gracefulWait time.Duration) { r := mux.NewRouter() srv := &http.Server{ @@ -604,6 +611,7 @@ func startServer(gracefulWait time.Duration) { r.HandleFunc("/pair", pairHandler) r.HandleFunc("/alert", alertHandler) r.HandleFunc("/ex", exHandler) + r.HandleFunc("/robots.txt", robotsHandler) go func() { if err := srv.ListenAndServe(); err != nil { |