refactor(http): refactoring http server
This commit is contained in:
+4
-6
@@ -4,14 +4,13 @@ import (
|
||||
"github.com/go-macaron/binding"
|
||||
"github.com/grafana/grafana/pkg/api/avatar"
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/api/live"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
// Register adds http routes
|
||||
func Register(r *macaron.Macaron) {
|
||||
func (hs *HttpServer) registerRoutes() {
|
||||
r := hs.macaron
|
||||
reqSignedIn := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true})
|
||||
reqGrafanaAdmin := middleware.Auth(&middleware.AuthOptions{ReqSignedIn: true, ReqGrafanaAdmin: true})
|
||||
reqEditorRole := middleware.RoleAuth(m.ROLE_EDITOR, m.ROLE_ADMIN)
|
||||
@@ -303,11 +302,10 @@ func Register(r *macaron.Macaron) {
|
||||
r.Get("/avatar/:hash", avt.ServeHTTP)
|
||||
|
||||
// Websocket
|
||||
liveConn := live.New()
|
||||
r.Any("/ws", liveConn.Serve)
|
||||
r.Any("/ws", hs.streamManager.Serve)
|
||||
|
||||
// streams
|
||||
r.Post("/api/streams/push", reqSignedIn, bind(dtos.StreamMessage{}), liveConn.PushToStream)
|
||||
//r.Post("/api/streams/push", reqSignedIn, bind(dtos.StreamMessage{}), liveConn.PushToStream)
|
||||
|
||||
InitAppPluginRoutes(r)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user