| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Package som implements HTTP server that handles requests to default module. | 5 // Package som implements HTTP server that handles requests to default module. |
| 6 package som | 6 package som |
| 7 | 7 |
| 8 import ( | 8 import ( |
| 9 "crypto/sha1" | 9 "crypto/sha1" |
| 10 "encoding/json" | 10 "encoding/json" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 server.CookieAuth, | 567 server.CookieAuth, |
| 568 &server.InboundAppIDAuthMethod{}, | 568 &server.InboundAppIDAuthMethod{}, |
| 569 } | 569 } |
| 570 return gaemiddleware.BaseProd().Extend( | 570 return gaemiddleware.BaseProd().Extend( |
| 571 auth.Use(methods), | 571 auth.Use(methods), |
| 572 ) | 572 ) |
| 573 } | 573 } |
| 574 | 574 |
| 575 //// Routes. | 575 //// Routes. |
| 576 func init() { | 576 func init() { |
| 577 |
| 577 settings.RegisterUIPage(settingsKey, settingsUIPage{}) | 578 settings.RegisterUIPage(settingsKey, settingsUIPage{}) |
| 578 | 579 |
| 579 r := router.New() | 580 r := router.New() |
| 580 basemw := base() | 581 basemw := base() |
| 581 authmw := basemw.Extend(auth.Authenticate) | 582 authmw := basemw.Extend(auth.Authenticate) |
| 582 | 583 |
| 583 gaemiddleware.InstallHandlers(r, basemw) | 584 gaemiddleware.InstallHandlers(r, basemw) |
| 584 r.GET("/api/v1/trees/", authmw, getTreesHandler) | 585 r.GET("/api/v1/trees/", authmw, getTreesHandler) |
| 585 r.GET("/api/v1/alerts/:tree", authmw, getAlertsHandler) | 586 r.GET("/api/v1/alerts/:tree", authmw, getAlertsHandler) |
| 586 r.POST("/api/v1/alerts/:tree", authmw, postAlertsHandler) | 587 r.POST("/api/v1/alerts/:tree", authmw, postAlertsHandler) |
| 587 r.GET("/api/v1/annotations/", authmw, getAnnotationsHandler) | 588 r.GET("/api/v1/annotations/", authmw, getAnnotationsHandler) |
| 588 r.POST("/api/v1/annotations/:annKey/:action", authmw, postAnnotationsHan
dler) | 589 r.POST("/api/v1/annotations/:annKey/:action", authmw, postAnnotationsHan
dler) |
| 589 r.GET("/api/v1/bugqueue/:tree", authmw, getBugQueueHandler) | 590 r.GET("/api/v1/bugqueue/:tree", authmw, getBugQueueHandler) |
| 590 r.GET("/api/v1/revrange/:start/:end", basemw, getRevRangeHandler) | 591 r.GET("/api/v1/revrange/:start/:end", basemw, getRevRangeHandler) |
| 591 | 592 |
| 592 rootRouter := router.New() | 593 rootRouter := router.New() |
| 593 rootRouter.GET("/*path", authmw, indexPage) | 594 rootRouter.GET("/*path", authmw, indexPage) |
| 594 | 595 |
| 595 http.DefaultServeMux.Handle("/api/", r) | 596 http.DefaultServeMux.Handle("/api/", r) |
| 596 http.DefaultServeMux.Handle("/admin/", r) | 597 http.DefaultServeMux.Handle("/admin/", r) |
| 597 http.DefaultServeMux.Handle("/auth/", r) | 598 http.DefaultServeMux.Handle("/auth/", r) |
| 598 http.DefaultServeMux.Handle("/_ah/", r) | 599 http.DefaultServeMux.Handle("/_ah/", r) |
| 600 http.DefaultServeMux.Handle("/internal/", r) |
| 601 |
| 599 http.DefaultServeMux.Handle("/", rootRouter) | 602 http.DefaultServeMux.Handle("/", rootRouter) |
| 600 } | 603 } |
| OLD | NEW |