Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

auth: link the sign-in page button to /dashboard, not the site root

Claudef11afc854f95
diff --git a/cli/beacon/cmd/endpoint_connect.go b/cli/beacon/cmd/endpoint_connect.go
index 2fa3dbee..befd0555 100644
--- a/cli/beacon/cmd/endpoint_connect.go
+++ b/cli/beacon/cmd/endpoint_connect.go
@@ -352,14 +352,7 @@ func scriptForwarderStatusLine(status service.Status) string {
// /dashboard/telemetry have no route behind them, so anything printed here has to
// stop at the dashboard itself.
func dashboardHomeURL(base string) string {
- base = strings.TrimRight(strings.TrimSpace(base), "/")
- if base == "" {
- return auth.DefaultDashboardURL + "/dashboard"
- }
- if strings.HasSuffix(base, "/dashboard") {
- return base
- }
- return base + "/dashboard"
+ return auth.DashboardHomeURL(base)
}
func managedIngestStatusLine(status asymptote.ManagedIngestStatus) string {
diff --git a/cli/beacon/internal/account/login.go b/cli/beacon/internal/account/login.go
index 13da25f8..2f5c5fd1 100644
--- a/cli/beacon/internal/account/login.go
+++ b/cli/beacon/internal/account/login.go
@@ -176,7 +176,7 @@ func Login(ctx context.Context, opts LoginOptions) (*Session, error) {
return nil, err
}
callback.SetSuccessPage("Signed in to Beacon", "Return to your terminal to finish setting up this machine.")
- callback.SetSuccessLink("Go to dashboard", baseURL)
+ callback.SetSuccessLink("Go to dashboard", auth.DashboardHomeURL(baseURL))
defer callback.Shutdown()
callback.Start()
diff --git a/cli/beacon/internal/auth/auth_test.go b/cli/beacon/internal/auth/auth_test.go
index ebd84824..3669363c 100644
--- a/cli/beacon/internal/auth/auth_test.go
+++ b/cli/beacon/internal/auth/auth_test.go
@@ -292,3 +292,16 @@ func TestCallbackServerSuccessPageLinksToTheDashboard(t *testing.T) {
t.Fatalf("success page should contain %s, got %s", want, page)
}
}
+
+func TestDashboardHomeURL(t *testing.T) {
+ for base, want := range map[string]string{
+ "https://beacon.sh": "https://beacon.sh/dashboard",
+ "https://beacon.sh/": "https://beacon.sh/dashboard",
+ "https://beacon.sh/dashboard": "https://beacon.sh/dashboard",
+ "": "https://beacon.sh/dashboard",
+ } {
+ if got := DashboardHomeURL(base); got != want {
+ t.Fatalf("DashboardHomeURL(%q) = %q, want %q", base, got, want)
+ }
+ }
+}
diff --git a/cli/beacon/internal/auth/dashboard.go b/cli/beacon/internal/auth/dashboard.go
index 77e5b1b5..2b45dc8d 100644
--- a/cli/beacon/internal/auth/dashboard.go
+++ b/cli/beacon/internal/auth/dashboard.go
@@ -49,6 +49,20 @@ func NormalizeDashboardURL(raw string) string {
return strings.TrimRight(raw, "/")
}
+// DashboardHomeURL turns a service URL into the page a person can actually open.
+// The service root serves the marketing site and the dashboard is a single page
+// at /dashboard, so a base that already ends there is returned as is.
+func DashboardHomeURL(base string) string {
+ base = strings.TrimRight(strings.TrimSpace(base), "/")
+ if base == "" {
+ base = DefaultDashboardURL
+ }
+ if strings.HasSuffix(base, "/dashboard") {
+ return base
+ }
+ return base + "/dashboard"
+}
+
// PostJSON sends body as JSON to url and decodes a 2xx response into out. Error
// responses are reduced to the dashboard's `detail` or `error` text when present,
// so callers can show the server's own explanation.