| 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/buildbucket" |
| 12 "github.com/luci/luci-go/appengine/cmd/milo/console" |
| 12 "github.com/luci/luci-go/appengine/cmd/milo/logdog" | 13 "github.com/luci/luci-go/appengine/cmd/milo/logdog" |
| 13 "github.com/luci/luci-go/appengine/cmd/milo/settings" | 14 "github.com/luci/luci-go/appengine/cmd/milo/settings" |
| 14 "github.com/luci/luci-go/appengine/cmd/milo/swarming" | 15 "github.com/luci/luci-go/appengine/cmd/milo/swarming" |
| 15 "github.com/luci/luci-go/appengine/gaemiddleware" | 16 "github.com/luci/luci-go/appengine/gaemiddleware" |
| 16 "github.com/luci/luci-go/server/router" | 17 "github.com/luci/luci-go/server/router" |
| 17 ) | 18 ) |
| 18 | 19 |
| 19 // Where it all begins!!! | 20 // Where it all begins!!! |
| 20 func init() { | 21 func init() { |
| 21 // Register plain ol' http handlers. | 22 // Register plain ol' http handlers. |
| 22 r := router.New() | 23 r := router.New() |
| 23 basemw := settings.Base() | 24 basemw := settings.Base() |
| 24 gaemiddleware.InstallHandlers(r, basemw) | 25 gaemiddleware.InstallHandlers(r, basemw) |
| 25 r.GET("/", basemw, settings.Wrap(frontpage{})) | 26 r.GET("/", basemw, settings.Wrap(frontpage{})) |
| 26 | 27 |
| 28 // Console |
| 29 r.GET("/console/:name", basemw, settings.Wrap(console.Console{})) |
| 30 |
| 27 // Swarming | 31 // Swarming |
| 28 r.GET("/swarming/task/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) | 32 r.GET("/swarming/task/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) |
| 29 r.GET("/swarming/task/:id", basemw, settings.Wrap(swarming.Build{})) | 33 r.GET("/swarming/task/:id", basemw, settings.Wrap(swarming.Build{})) |
| 30 // Backward-compatible URLs: | 34 // Backward-compatible URLs: |
| 31 r.GET("/swarming/prod/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) | 35 r.GET("/swarming/prod/:id/steps/*logname", basemw, settings.Wrap(swarmin
g.Log{})) |
| 32 r.GET("/swarming/prod/:id", basemw, settings.Wrap(swarming.Build{})) | 36 r.GET("/swarming/prod/:id", basemw, settings.Wrap(swarming.Build{})) |
| 33 | 37 |
| 34 // Buildbucket | 38 // Buildbucket |
| 35 r.GET("/buildbucket/:bucket/:builder", basemw, settings.Wrap(buildbucket
.Builder{})) | 39 r.GET("/buildbucket/:bucket/:builder", basemw, settings.Wrap(buildbucket
.Builder{})) |
| 36 | 40 |
| 37 // Buildbot | 41 // Buildbot |
| 38 r.GET("/buildbot/:master/:builder/:build", basemw, settings.Wrap(buildbo
t.Build{})) | 42 r.GET("/buildbot/:master/:builder/:build", basemw, settings.Wrap(buildbo
t.Build{})) |
| 39 r.GET("/buildbot/:master/:builder/", basemw, settings.Wrap(buildbot.Buil
der{})) | 43 r.GET("/buildbot/:master/:builder/", basemw, settings.Wrap(buildbot.Buil
der{})) |
| 40 | 44 |
| 41 // LogDog Milo Annotation Streams. | 45 // LogDog Milo Annotation Streams. |
| 42 r.GET("/logdog/build/:project/*path", basemw, settings.Wrap(&logdog.Anno
tationStream{})) | 46 r.GET("/logdog/build/:project/*path", basemw, settings.Wrap(&logdog.Anno
tationStream{})) |
| 43 | 47 |
| 44 // User settings | 48 // User settings |
| 45 r.GET("/settings", basemw, settings.Wrap(settings.Settings{})) | 49 r.GET("/settings", basemw, settings.Wrap(settings.Settings{})) |
| 46 r.POST("/settings", basemw, settings.ChangeSettings) | 50 r.POST("/settings", basemw, settings.ChangeSettings) |
| 47 | 51 |
| 48 // PubSub subscription endpoints. | 52 // PubSub subscription endpoints. |
| 49 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler) | 53 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler) |
| 50 | 54 |
| 51 http.Handle("/", r) | 55 http.Handle("/", r) |
| 52 } | 56 } |
| OLD | NEW |