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

@@ -66,3 +66,45 @@ func TestNormalizeServerURL(t *testing.T) {
})
}
}
func TestConsoleEnrollURL(t *testing.T) {
t.Parallel()
tests := []struct {
name string
input string
want string
wantErr bool
}{
{
name: "hosted US console",
input: USConsoleURL,
want: USConsoleURL + "/enroll",
},
{
name: "local dev console",
input: "http://localhost:3000",
want: "http://localhost:3000/enroll",
},
{
name: "rejects whitespace-only input",
input: " ",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got, err := ConsoleEnrollURL(tt.input)
if tt.wantErr {
require.Error(t, err)
return
}
require.NoError(t, err)
assert.Equal(t, tt.want, got)
})
}
}