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:
Ludovic Vielle
2026-07-15 16:56:33 +02:00
parent 952851c743
commit 1329f2a28e
9 changed files with 477 additions and 11 deletions

View File

@@ -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
}