github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/webapp/routes.go (about)

     1  // Copyright 2017 The WPT Dashboard Project. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  
     5  package webapp
     6  
     7  import (
     8  	"github.com/web-platform-tests/wpt.fyi/shared"
     9  )
    10  
    11  // RegisterRoutes adds the route handlers for the webapp.
    12  func RegisterRoutes() {
    13  	// GitHub OAuth login
    14  	shared.AddRoute("/login", "login", loginHandler)
    15  	shared.AddRoute("/logout", "logout", logoutHandler)
    16  	shared.AddRoute("/oauth", "oauth", oauthHandler)
    17  
    18  	// About wpt.fyi
    19  	shared.AddRoute("/about", "about", aboutHandler)
    20  
    21  	// Reftest analyzer
    22  	shared.AddRoute("/analyzer", "analyzer", analyzerHandler)
    23  
    24  	// Feature flags for wpt.fyi
    25  	shared.AddRoute("/flags", "flags", flagsHandler)
    26  	shared.AddRoute("/dynamic-components/wpt-env-flags.js", "flags-component", flagsComponentHandler)
    27  
    28  	shared.AddRoute("/node_modules/{path:.*}", "components", componentsHandler)
    29  
    30  	// A list of useful/insightful queries
    31  	shared.AddRoute("/insights", "insights", insightsHandler)
    32  
    33  	// List of all pending/in-flight runs
    34  	shared.AddRoute("/status", "processor-status", processorStatusHandler)
    35  
    36  	// List of all test runs, by SHA[0:10]
    37  	shared.AddRoute("/runs", "test-runs", testRunsHandler)
    38  	shared.AddRoute("/test-runs", "test-runs", testRunsHandler) // Legacy name
    39  
    40  	// Dashboard for the interop effort, by year.
    41  	shared.AddRoute("/{name:(?:compat|interop-)}{year:[0-9]+}", "interop-dashboard", interopHandler)
    42  
    43  	// Redirect to current year's interop effort.
    44  	shared.AddRoute("/interop", "interop-dashboard", interopHandler)
    45  
    46  	// Admin-only manual results upload.
    47  	shared.AddRoute("/admin/results/upload", "admin-results-upload", adminUploadHandler)
    48  
    49  	// Admin-only manual cache flush.
    50  	shared.AddRoute("/admin/cache/flush", "admin-cache-flush", adminCacheFlushHandler)
    51  
    52  	// Admin-only environment flag management
    53  	shared.AddRoute("/admin/flags", "admin-flags", adminFlagsHandler)
    54  
    55  	// Test run results, viewed by browser (default view)
    56  	// For run results diff view, 'before' and 'after' params can be given.
    57  	shared.AddRoute("/results/", "results", testResultsHandler)
    58  	shared.AddRoute("/results/{path:.*}", "results", testResultsHandler)
    59  
    60  	// Legacy wildcard match
    61  	shared.AddRoute("/", "results-legacy", testResultsHandler)
    62  	shared.AddRoute("/{path:.*}", "results-legacy", testResultsHandler)
    63  }