mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
client/web: remove DebugMode from GET /api/data
No longer using this! Readonly state fully managed via auth endpoint. Also getting rid of old Legacy server mode. A #cleanup Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
parent
6f7a1b51a8
commit
2dbd546766
@ -28,8 +28,6 @@ export type NodeData = {
|
|||||||
IsTagged: boolean
|
IsTagged: boolean
|
||||||
Tags: string[]
|
Tags: string[]
|
||||||
RunningSSHServer: boolean
|
RunningSSHServer: boolean
|
||||||
|
|
||||||
DebugMode: "" | "login" | "full" // empty when not running in any debug mode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type NodeState =
|
type NodeState =
|
||||||
|
@ -92,10 +92,6 @@ type Server struct {
|
|||||||
// the source's Tailscale identity. If the source browser does not have
|
// the source's Tailscale identity. If the source browser does not have
|
||||||
// a valid session, a readonly version of the app is displayed.
|
// a valid session, a readonly version of the app is displayed.
|
||||||
ManageServerMode ServerMode = "manage"
|
ManageServerMode ServerMode = "manage"
|
||||||
|
|
||||||
// LegacyServerMode serves the legacy web client, visible to users
|
|
||||||
// prior to release of tailscale/corp#14335.
|
|
||||||
LegacyServerMode ServerMode = "legacy"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -133,7 +129,7 @@ type ServerOpts struct {
|
|||||||
// and not the lifespan of the web server.
|
// and not the lifespan of the web server.
|
||||||
func NewServer(opts ServerOpts) (s *Server, err error) {
|
func NewServer(opts ServerOpts) (s *Server, err error) {
|
||||||
switch opts.Mode {
|
switch opts.Mode {
|
||||||
case LoginServerMode, ManageServerMode, LegacyServerMode:
|
case LoginServerMode, ManageServerMode:
|
||||||
// valid types
|
// valid types
|
||||||
case "":
|
case "":
|
||||||
return nil, fmt.Errorf("must specify a Mode")
|
return nil, fmt.Errorf("must specify a Mode")
|
||||||
@ -544,8 +540,6 @@ type nodeData struct {
|
|||||||
ClientVersion *tailcfg.ClientVersion
|
ClientVersion *tailcfg.ClientVersion
|
||||||
|
|
||||||
LicensesURL string
|
LicensesURL string
|
||||||
|
|
||||||
DebugMode string // empty when not running in any debug mode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -559,12 +553,6 @@ func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var debugMode string
|
|
||||||
if s.mode == ManageServerMode {
|
|
||||||
debugMode = "full"
|
|
||||||
} else if s.mode == LoginServerMode {
|
|
||||||
debugMode = "login"
|
|
||||||
}
|
|
||||||
data := &nodeData{
|
data := &nodeData{
|
||||||
ID: st.Self.ID,
|
ID: st.Self.ID,
|
||||||
Status: st.BackendState,
|
Status: st.BackendState,
|
||||||
@ -582,7 +570,6 @@ func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) {
|
|||||||
RunningSSHServer: prefs.RunSSH,
|
RunningSSHServer: prefs.RunSSH,
|
||||||
URLPrefix: strings.TrimSuffix(s.pathPrefix, "/"),
|
URLPrefix: strings.TrimSuffix(s.pathPrefix, "/"),
|
||||||
LicensesURL: licenses.LicensesURL(),
|
LicensesURL: licenses.LicensesURL(),
|
||||||
DebugMode: debugMode, // TODO(sonia,will): just pass back s.mode directly?
|
|
||||||
}
|
}
|
||||||
cv, err := s.lc.CheckUpdate(r.Context())
|
cv, err := s.lc.CheckUpdate(r.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -90,12 +90,10 @@ func runWeb(ctx context.Context, args []string) error {
|
|||||||
selfIP = st.Self.TailscaleIPs[0]
|
selfIP = st.Self.TailscaleIPs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
cliServerMode := web.LegacyServerMode
|
|
||||||
var existingWebClient bool
|
var existingWebClient bool
|
||||||
if prefs, err := localClient.GetPrefs(ctx); err == nil {
|
if prefs, err := localClient.GetPrefs(ctx); err == nil {
|
||||||
existingWebClient = prefs.RunWebClient
|
existingWebClient = prefs.RunWebClient
|
||||||
}
|
}
|
||||||
cliServerMode = web.LoginServerMode
|
|
||||||
if !existingWebClient {
|
if !existingWebClient {
|
||||||
// Also start full client in tailscaled.
|
// Also start full client in tailscaled.
|
||||||
log.Printf("starting tailscaled web client at %s:%d\n", selfIP.String(), web.ListenPort)
|
log.Printf("starting tailscaled web client at %s:%d\n", selfIP.String(), web.ListenPort)
|
||||||
@ -105,7 +103,7 @@ func runWeb(ctx context.Context, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
webServer, err := web.NewServer(web.ServerOpts{
|
webServer, err := web.NewServer(web.ServerOpts{
|
||||||
Mode: cliServerMode,
|
Mode: web.LoginServerMode,
|
||||||
CGIMode: webArgs.cgi,
|
CGIMode: webArgs.cgi,
|
||||||
PathPrefix: webArgs.prefix,
|
PathPrefix: webArgs.prefix,
|
||||||
LocalClient: &localClient,
|
LocalClient: &localClient,
|
||||||
|
@ -30,7 +30,7 @@ func main() {
|
|||||||
|
|
||||||
// Serve the Tailscale web client.
|
// Serve the Tailscale web client.
|
||||||
ws, err := web.NewServer(web.ServerOpts{
|
ws, err := web.NewServer(web.ServerOpts{
|
||||||
Mode: web.LegacyServerMode,
|
Mode: web.LoginServerMode,
|
||||||
LocalClient: lc,
|
LocalClient: lc,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user