func main() { common.InitWithMetrics("push", graphiteServer) Init() // By default use a set of credentials setup for localhost access. var cookieSalt = "notverysecret" var clientID = "31977622648-1873k0c1e5edaka4adpv1ppvhr5id3qm.apps.googleusercontent.com" var clientSecret = "cw0IosPu4yjaG2KWmppj2guj" var redirectURL = fmt.Sprintf("http://localhost%s/oauth2callback/", *port) if !*local { cookieSalt = metadata.Must(metadata.ProjectGet(metadata.COOKIESALT)) clientID = metadata.Must(metadata.ProjectGet(metadata.CLIENT_ID)) clientSecret = metadata.Must(metadata.ProjectGet(metadata.CLIENT_SECRET)) redirectURL = "https://push.skia.org/oauth2callback/" } login.Init(clientID, clientSecret, redirectURL, cookieSalt, login.DEFAULT_SCOPE, login.DEFAULT_DOMAIN_WHITELIST, *local) r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", mainHandler) r.HandleFunc("/_/change", changeHandler) r.HandleFunc("/_/state", stateHandler) r.HandleFunc("/_/status", statusHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Infoln("Ready to serve.") glog.Fatal(http.ListenAndServe(*port, nil)) }
func runServer(serverURL string) { r := mux.NewRouter() r.HandleFunc("/", commitsHandler) r.HandleFunc("/buildbots", buildbotDashHandler) r.HandleFunc("/hosts", hostsHandler) r.HandleFunc("/infra", infraHandler) r.HandleFunc("/json/builds", buildsJsonHandler) r.HandleFunc("/json/goldStatus", goldJsonHandler) r.HandleFunc("/json/perfAlerts", perfJsonHandler) r.HandleFunc("/json/slaveHosts", slaveHostsJsonHandler) r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc("/json/{repo}/buildProgress", buildProgressHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) builds := r.PathPrefix("/json/{repo}/builds/{master}/{builder}/{number:[0-9]+}").Subrouter() builds.HandleFunc("/comments", addBuildCommentHandler).Methods("POST") builds.HandleFunc("/comments/{commentId:[0-9]+}", deleteBuildCommentHandler).Methods("DELETE") builders := r.PathPrefix("/json/{repo}/builders/{builder}").Subrouter() builders.HandleFunc("/comments", addBuilderCommentHandler).Methods("POST") builders.HandleFunc("/comments/{commentId:[0-9]+}", deleteBuilderCommentHandler).Methods("DELETE") commits := r.PathPrefix("/json/{repo}/commits").Subrouter() commits.HandleFunc("/", commitsJsonHandler) commits.HandleFunc("/{commit:[a-f0-9]+}/comments", addCommitCommentHandler).Methods("POST") commits.HandleFunc("/{commit:[a-f0-9]+}/comments/{commentId:[0-9]+}", deleteCommitCommentHandler).Methods("DELETE") http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Infof("Ready to serve on %s", serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }
func main() { defer common.LogPanic() common.InitWithMetrics("push", graphiteServer) Init() redirectURL := fmt.Sprintf("http://localhost%s/oauth2callback/", *port) if !*local { redirectURL = "https://push.skia.org/oauth2callback/" } if err := login.InitFromMetadataOrJSON(redirectURL, login.DEFAULT_SCOPE, login.DEFAULT_DOMAIN_WHITELIST); err != nil { glog.Fatalf("Failed to initialize the login system: %s", err) } r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", mainHandler) r.HandleFunc("/_/change", changeHandler) r.HandleFunc("/_/state", stateHandler) r.HandleFunc("/_/status", statusHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Infoln("Ready to serve.") glog.Fatal(http.ListenAndServe(*port, nil)) }
func runServer() { serverURL := "https://" + *host if *local { serverURL = "http://" + *host + *port } r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc(OAUTH2_CALLBACK_PATH, login.OAuth2CallbackHandler) r.HandleFunc("/", indexHandler) r.HandleFunc("/details", detailsPageHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc("/json/fuzz-list", fuzzListHandler) r.HandleFunc("/json/details", detailedReportsHandler) r.HandleFunc("/status", statusHandler) r.HandleFunc(`/fuzz/{kind:(binary|api)}/{name:[0-9a-f]+\.(skp)}`, fuzzHandler) r.HandleFunc(`/metadata/{kind:(binary|api)}/{type:(skp)}/{name:[0-9a-f]+_(debug|release)\.(err|dump)}`, metadataHandler) r.HandleFunc("/fuzz_count", fuzzCountHandler) r.HandleFunc("/newBug", newBugHandler) rootHandler := login.ForceAuth(util.LoggingGzipRequestResponse(r), OAUTH2_CALLBACK_PATH) http.Handle("/", rootHandler) glog.Infof("Ready to serve on %s", serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }
func runServer(serverURL string) { r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", makeBugChomperPage).Methods("GET") r.HandleFunc("/", submitData).Methods("POST") r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc(OAUTH_CALLBACK_PATH, login.OAuth2CallbackHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Info("Server is running at " + serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }
func runServer(serverURL string) { r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", mainHandler) r.HandleFunc("/json/mode", modeJsonHandler).Methods("POST") r.HandleFunc("/json/status", util.CorsHandler(statusJsonHandler)) r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Infof("Ready to serve on %s", serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }
func main() { common.InitWithMetrics("pulld", graphiteServer) Init() pullInit() r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", mainHandler).Methods("GET") r.HandleFunc("/_/list", listHandler).Methods("GET") r.HandleFunc("/_/change", changeHandler).Methods("POST") r.HandleFunc("/pullpullpull", pullHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Infoln("Ready to serve.") glog.Fatal(http.ListenAndServe(*port, nil)) }
func runServer(serverURL string) { r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", alertHandler) r.HandleFunc("/infra", infraAlertHandler) r.HandleFunc("/rules", rulesHandler) alerts := r.PathPrefix("/json/alerts").Subrouter() alerts.HandleFunc("/", util.CorsHandler(alertJsonHandler)) alerts.HandleFunc("/{alertId:[0-9]+}/{action}", postAlertsJsonHandler).Methods("POST") alerts.HandleFunc("/multi/{action}", postMultiAlertsJsonHandler).Methods("POST") r.HandleFunc("/json/rules", rulesJsonHandler) r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) glog.Infof("Ready to serve on %s", serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }
func main() { defer common.LogPanic() common.InitWithMetrics("mathserv", graphiteServer) Init() // By default use a set of credentials setup for localhost access. var cookieSalt = "notverysecret" var clientID = "952643138919-5a692pfevie766aiog15io45kjpsh33v.apps.googleusercontent.com" var clientSecret = "QQfqRYU1ELkds90ku8xlIGl1" var redirectURL = fmt.Sprintf("http://localhost%s/oauth2callback/", *port) if !*local { cookieSalt = metadata.Must(metadata.ProjectGet(metadata.COOKIESALT)) clientID = metadata.Must(metadata.ProjectGet(metadata.CLIENT_ID)) clientSecret = metadata.Must(metadata.ProjectGet(metadata.CLIENT_SECRET)) redirectURL = "https://mathinate.com/oauth2callback/" } login.Init(clientID, clientSecret, redirectURL, cookieSalt, login.DEFAULT_SCOPE, "", *local) r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc("/", mainHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) http.Handle("/", util.LoggingGzipRequestResponse(r)) AttemptLoadCertFromMetadata() glog.Infoln("Ready to serve.") if *certChainFile != "" { glog.Infof("Serving TLS") go func() { redir := mux.NewRouter() redir.HandleFunc("/", redirHandler) glog.Fatal(http.ListenAndServe(*httpPort, redir)) }() glog.Fatal(http.ListenAndServeTLS(*port, *certChainFile, *keyFile, nil)) } else { glog.Infof("Only serving HTTP") glog.Fatal(http.ListenAndServe(*port, nil)) } }
func runServer(serverURL string) { r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(skutil.MakeResourceHandler(*resourcesDir)) chromium_perf.AddHandlers(r) capture_skps.AddHandlers(r) lua_scripts.AddHandlers(r) chromium_builds.AddHandlers(r) admin_tasks.AddHandlers(r) pending_tasks.AddHandlers(r) task_common.AddHandlers(r) // Common handlers used by different pages. r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) r.HandleFunc("/login/", loginHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) http.Handle("/", skutil.LoggingGzipRequestResponse(r)) glog.Infof("Ready to serve on %s", serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }
func runServer() { serverURL := "https://" + *host if *local { serverURL = "http://" + *host + *port } r := mux.NewRouter() r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir)) r.HandleFunc(OAUTH2_CALLBACK_PATH, login.OAuth2CallbackHandler) r.HandleFunc("/", indexHandler) r.HandleFunc("/details", detailHandler) r.HandleFunc("/loginstatus/", login.StatusHandler) r.HandleFunc("/logout/", login.LogoutHandler) r.HandleFunc("/json/version", skiaversion.JsonHandler) r.HandleFunc("/json/fuzz-list", fuzzListHandler) r.HandleFunc("/json/details", detailsHandler) rootHandler := login.ForceAuth(util.LoggingGzipRequestResponse(r), OAUTH2_CALLBACK_PATH) http.Handle("/", rootHandler) glog.Infof("Ready to serve on %s", serverURL) glog.Fatal(http.ListenAndServe(*port, nil)) }