Chore: replace macaron with web package (#40136)
* replace macaron with web package * add web.go
This commit is contained in:
@@ -43,8 +43,8 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tsdb/cloudwatch"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -333,7 +333,7 @@ func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, r
|
||||
g.pushWebsocketHandler = func(ctx *models.ReqContext) {
|
||||
user := ctx.SignedInUser
|
||||
newCtx := livecontext.SetContextSignedUser(ctx.Req.Context(), user)
|
||||
newCtx = livecontext.SetContextStreamID(newCtx, macaron.Params(ctx.Req)[":streamId"])
|
||||
newCtx = livecontext.SetContextStreamID(newCtx, web.Params(ctx.Req)[":streamId"])
|
||||
r := ctx.Req.WithContext(newCtx)
|
||||
pushWSHandler.ServeHTTP(ctx.Resp, r)
|
||||
}
|
||||
@@ -968,7 +968,7 @@ func (g *GrafanaLive) HandleListHTTP(c *models.ReqContext) response.Response {
|
||||
|
||||
// HandleInfoHTTP special http response for
|
||||
func (g *GrafanaLive) HandleInfoHTTP(ctx *models.ReqContext) response.Response {
|
||||
path := macaron.Params(ctx.Req)["*"]
|
||||
path := web.Params(ctx.Req)["*"]
|
||||
if path == "grafana/dashboards/gitops" {
|
||||
return response.JSON(200, util.DynMap{
|
||||
"active": g.GrafanaScope.Dashboards.HasGitOpsObserver(ctx.SignedInUser.OrgId),
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
|
||||
liveDto "github.com/grafana/grafana-plugin-sdk-go/live"
|
||||
"gopkg.in/macaron.v1"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -46,7 +46,7 @@ func (g *Gateway) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (g *Gateway) Handle(ctx *models.ReqContext) {
|
||||
streamID := macaron.Params(ctx.Req)[":streamId"]
|
||||
streamID := web.Params(ctx.Req)[":streamId"]
|
||||
|
||||
stream, err := g.GrafanaLive.ManagedStreamRunner.GetOrCreateStream(ctx.SignedInUser.OrgId, liveDto.ScopeStream, streamID)
|
||||
if err != nil {
|
||||
@@ -97,8 +97,8 @@ func (g *Gateway) Handle(ctx *models.ReqContext) {
|
||||
}
|
||||
|
||||
func (g *Gateway) HandlePath(ctx *models.ReqContext) {
|
||||
streamID := macaron.Params(ctx.Req)[":streamId"]
|
||||
path := macaron.Params(ctx.Req)[":path"]
|
||||
streamID := web.Params(ctx.Req)[":streamId"]
|
||||
path := web.Params(ctx.Req)[":path"]
|
||||
|
||||
body, err := io.ReadAll(ctx.Req.Body)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user