web: change node registration parameter order (#2607)

This change makes editing the generated command easier.
For example, after pasting into a terminal, the cursor position will be
near the username portion which requires editing.
This commit is contained in:
Greg Dietsche 2025-05-21 04:18:53 -05:00 committed by GitHub
parent a52f1df180
commit d2879b2b36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -28,7 +28,7 @@ func RegisterWeb(registrationID types.RegistrationID) *elem.Element {
elem.H2(nil, elem.Text("Machine registration")), elem.H2(nil, elem.Text("Machine registration")),
elem.P(nil, elem.Text("Run the command below in the headscale server to add this machine to your network: ")), elem.P(nil, elem.Text("Run the command below in the headscale server to add this machine to your network: ")),
elem.Code(attrs.Props{attrs.Style: codeStyleRegisterWebAPI.ToInline()}, elem.Code(attrs.Props{attrs.Style: codeStyleRegisterWebAPI.ToInline()},
elem.Text(fmt.Sprintf("headscale nodes register --user USERNAME --key %s", registrationID.String())), elem.Text(fmt.Sprintf("headscale nodes register --key %s --user USERNAME", registrationID.String())),
), ),
), ),
) )

View File

@ -842,6 +842,7 @@ func (s *Scenario) runHeadscaleRegister(userStr string, body string) error {
return errParseAuthPage return errParseAuthPage
} }
key := keySep[1] key := keySep[1]
key = strings.SplitN(key, " ", 2)[0]
log.Printf("registering node %s", key) log.Printf("registering node %s", key)
if headscale, err := s.Headscale(); err == nil { if headscale, err := s.Headscale(); err == nil {