| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package frontend | 5 package frontend |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "net/http" | 8 "net/http" |
| 9 | 9 |
| 10 "github.com/luci/luci-go/appengine/cmd/milo/buildbot" | 10 "github.com/luci/luci-go/appengine/cmd/milo/buildbot" |
| 11 "github.com/luci/luci-go/appengine/cmd/milo/buildbucket" |
| 11 "github.com/luci/luci-go/appengine/cmd/milo/settings" | 12 "github.com/luci/luci-go/appengine/cmd/milo/settings" |
| 12 "github.com/luci/luci-go/appengine/cmd/milo/swarming" | 13 "github.com/luci/luci-go/appengine/cmd/milo/swarming" |
| 13 "github.com/luci/luci-go/appengine/gaemiddleware" | 14 "github.com/luci/luci-go/appengine/gaemiddleware" |
| 14 "github.com/luci/luci-go/server/router" | 15 "github.com/luci/luci-go/server/router" |
| 15 ) | 16 ) |
| 16 | 17 |
| 17 // Where it all begins!!! | 18 // Where it all begins!!! |
| 18 func init() { | 19 func init() { |
| 19 // Register plain ol' http handlers. | 20 // Register plain ol' http handlers. |
| 20 r := router.New() | 21 r := router.New() |
| 21 basemw := settings.Base() | 22 basemw := settings.Base() |
| 22 gaemiddleware.InstallHandlers(r, basemw) | 23 gaemiddleware.InstallHandlers(r, basemw) |
| 23 r.GET("/", basemw, settings.Wrap(frontpage{})) | 24 r.GET("/", basemw, settings.Wrap(frontpage{})) |
| 25 |
| 26 // Swarming |
| 24 r.GET("/swarming/task/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) | 27 r.GET("/swarming/task/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) |
| 25 r.GET("/swarming/task/:id", basemw, settings.Wrap(swarming.Build{})) | 28 r.GET("/swarming/task/:id", basemw, settings.Wrap(swarming.Build{})) |
| 26 // Backward-compatible URLs: | 29 // Backward-compatible URLs: |
| 27 r.GET("/swarming/prod/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) | 30 r.GET("/swarming/prod/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) |
| 28 r.GET("/swarming/prod/:id", basemw, settings.Wrap(swarming.Build{})) | 31 r.GET("/swarming/prod/:id", basemw, settings.Wrap(swarming.Build{})) |
| 29 | 32 |
| 33 // Buildbucket |
| 34 r.GET("/buildbucket/:bucket/:builder", basemw, settings.Wrap(buildbucket
.Builder{})) |
| 35 |
| 30 // Buildbot | 36 // Buildbot |
| 31 r.GET("/buildbot/:master/:builder/:build", basemw, settings.Wrap(buildbo
t.Build{})) | 37 r.GET("/buildbot/:master/:builder/:build", basemw, settings.Wrap(buildbo
t.Build{})) |
| 32 r.GET("/buildbot/:master/:builder/", basemw, settings.Wrap(buildbot.Buil
der{})) | 38 r.GET("/buildbot/:master/:builder/", basemw, settings.Wrap(buildbot.Buil
der{})) |
| 33 | 39 |
| 34 // User settings | 40 // User settings |
| 35 r.GET("/settings", basemw, settings.Wrap(settings.Settings{})) | 41 r.GET("/settings", basemw, settings.Wrap(settings.Settings{})) |
| 36 r.POST("/settings", basemw, settings.ChangeSettings) | 42 r.POST("/settings", basemw, settings.ChangeSettings) |
| 37 | 43 |
| 38 // PubSub subscription endpoints. | 44 // PubSub subscription endpoints. |
| 39 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler) | 45 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler) |
| 40 | 46 |
| 41 http.Handle("/", r) | 47 http.Handle("/", r) |
| 42 } | 48 } |
| OLD | NEW |