Skip to content

Commit 246b9b0

Browse files
author
claude
committed
cloud: wire routing for /cloud pages and /api/cloud/desktop/* endpoints
Two fixes found during post-deploy verification: 1. /cloud/login/ returned 404 because internal/site/site.go serves a hardcoded list of static page paths and /cloud/* wasn't on it. Added both /cloud/ and /cloud/login/ to the list. 2. /api/cloud/desktop/* endpoints returned 401 with 'admin key required' because the engine auth middleware (internal/engine/auth.go) gates every /api/ path behind admin auth unless it's in the public allowlist. The new Cloud routes aren't admin endpoints — they're cookie-session-authed at the handler level via requireSession — so they go on the public list. The handlers themselves still enforce auth on the protected endpoints (me, backup*). With this push, turning STOCKYARD_CLOUD_ENABLED=1 on will actually expose the skeleton routes instead of 404/401-ing silently.
1 parent 0d4e313 commit 246b9b0

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

internal/engine/auth.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,5 +385,12 @@ func isPublicRoute(method, path string) bool {
385385
if method == "GET" && path == "/api/install/stats" {
386386
return true
387387
}
388+
// Cloud desktop backend — public at the engine level. The handlers
389+
// themselves enforce session-cookie auth (see CloudService.requireSession
390+
// in internal/apiserver/cloud_handlers.go). Login/verify/logout don't
391+
// need any auth; the others 401 internally without a session cookie.
392+
if strings.HasPrefix(path, "/api/cloud/desktop/") {
393+
return true
394+
}
388395
return false
389396
}

internal/site/site.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ func Register(mux *http.ServeMux, db *sql.DB) {
288288
"/billing/cancel/",
289289
"/desktop/",
290290
"/desktop/success/",
291+
"/cloud/",
292+
"/cloud/login/",
291293
}
292294

293295
// Homepage: exact match only (GET /{$} prevents catch-all)

0 commit comments

Comments
 (0)