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