3 Commits

Author SHA1 Message Date
59c401b1dc Stop setting content-type twice 2021-06-18 14:59:25 +02:00
0cce8aecc6 Set server version in correct place 2021-06-18 14:56:23 +02:00
baa3990d38 Add server version header 2021-06-18 14:51:43 +02:00
2 changed files with 3 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ import (
"runtime"
)
var Version = "v0.1.3"
var Version = "v0.1.6"
var Build string
func FullVersion() string {

View File

@@ -14,6 +14,7 @@ import (
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/google/uuid"
"github.uio.no/torjus/apiary"
"github.uio.no/torjus/apiary/config"
"github.uio.no/torjus/apiary/honeypot"
"github.uio.no/torjus/apiary/honeypot/store"
@@ -83,12 +84,12 @@ func NewServer(cfg config.FrontendConfig, hs *honeypot.HoneypotServer, store sto
r.Use(middleware.RealIP)
r.Use(middleware.RequestID)
r.Use(s.LoggingMiddleware)
r.Use(middleware.SetHeader("Server", apiary.FullVersion()))
r.Route("/", func(r chi.Router) {
r.Get("/*", s.IndexHandler("web/vue-frontend/dist"))
r.Get("/stream", s.HandlerAttemptStream)
r.Route("/api", func(r chi.Router) {
r.Use(middleware.SetHeader("Content-Type", "application/json"))
r.Get("/stats", s.HandlerStats)
r.Get("/stream", s.HandlerAttemptStream)
r.Get("/query", s.HandlerQuery)