From acdfb3bcebf2e230f1fe3e4f6136e97f53dce3b9 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Fri, 5 Dec 2025 10:46:01 +0800 Subject: [PATCH] feat(amp): add root-level /threads routes for CLI compatibility --- internal/api/modules/amp/routes.go | 1 + internal/api/modules/amp/routes_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/internal/api/modules/amp/routes.go b/internal/api/modules/amp/routes.go index b986a53a..9cb4ab8b 100644 --- a/internal/api/modules/amp/routes.go +++ b/internal/api/modules/amp/routes.go @@ -128,6 +128,7 @@ func (m *AmpModule) registerManagementRoutes(engine *gin.Engine, baseHandler *ha // Root-level routes that AMP CLI expects without /api prefix // These need the same security middleware as the /api/* routes (dynamic for hot-reload) rootMiddleware := []gin.HandlerFunc{noCORSMiddleware(), m.localhostOnlyMiddleware()} + engine.GET("/threads/*path", append(rootMiddleware, proxyHandler)...) engine.GET("/threads.rss", append(rootMiddleware, proxyHandler)...) // Root-level auth routes for CLI login flow diff --git a/internal/api/modules/amp/routes_test.go b/internal/api/modules/amp/routes_test.go index a40852c0..67b39190 100644 --- a/internal/api/modules/amp/routes_test.go +++ b/internal/api/modules/amp/routes_test.go @@ -47,6 +47,7 @@ func TestRegisterManagementRoutes(t *testing.T) { {"/api/meta", http.MethodGet}, {"/api/telemetry", http.MethodGet}, {"/api/threads", http.MethodGet}, + {"/threads/", http.MethodGet}, {"/threads.rss", http.MethodGet}, // Root-level route (no /api prefix) {"/api/otel", http.MethodGet}, {"/api/tab", http.MethodGet},