Add tray browser enrollment with region picker
The tray helper carried a ServerURL default that nothing read. Unenrolled users can now open the console /enroll page from the menu: US, EU, or self-hosted in production, or --server for dev. Signed-off-by: Ludovic Vielle <ludovic@probo.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -77,3 +77,18 @@ func NormalizeServerURL(host string) (string, error) {
|
||||
|
||||
return (&url.URL{Scheme: scheme, Host: strings.ToLower(parsed.Host)}).String(), nil
|
||||
}
|
||||
|
||||
// ConsoleEnrollURL returns the browser enrollment page URL for serverURL.
|
||||
func ConsoleEnrollURL(serverURL string) (string, error) {
|
||||
normalized, err := NormalizeServerURL(serverURL)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
enrollURL, err := url.JoinPath(normalized, "enroll")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot build console enroll URL: %w", err)
|
||||
}
|
||||
|
||||
return enrollURL, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user