MCPcopy Create free account
hub / github.com/tailscale/tailscale / serveLoginAPI

Method serveLoginAPI

client/web/web.go:519–530  ·  view source on GitHub ↗

serveLoginAPI serves requests for the web login client. It should only be called by Server.ServeHTTP, via Server.apiHandler, which protects the handler using gorilla csrf.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

517// It should only be called by Server.ServeHTTP, via Server.apiHandler,
518// which protects the handler using gorilla csrf.
519func (s *Server) serveLoginAPI(w http.ResponseWriter, r *http.Request) {
520 switch {
521 case r.URL.Path == "/api/data" && r.Method == httpm.GET:
522 s.serveGetNodeData(w, r)
523 case r.URL.Path == "/api/up" && r.Method == httpm.POST:
524 s.serveTailscaleUp(w, r)
525 case r.URL.Path == "/api/device-details-click" && r.Method == httpm.POST:
526 s.serveDeviceDetailsClick(w, r)
527 default:
528 http.Error(w, "invalid endpoint or method", http.StatusNotFound)
529 }
530}
531
532// handleJSON manages decoding the request's body JSON as data and passing it
533// on to the provided handler function.

Callers

nothing calls this directly

Calls 4

serveGetNodeDataMethod · 0.95
serveTailscaleUpMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected