mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 21:10:51 +08:00
feat(amp): add root-level /threads routes for CLI compatibility
This commit is contained in:
@@ -128,6 +128,7 @@ func (m *AmpModule) registerManagementRoutes(engine *gin.Engine, baseHandler *ha
|
|||||||
// Root-level routes that AMP CLI expects without /api prefix
|
// Root-level routes that AMP CLI expects without /api prefix
|
||||||
// These need the same security middleware as the /api/* routes (dynamic for hot-reload)
|
// These need the same security middleware as the /api/* routes (dynamic for hot-reload)
|
||||||
rootMiddleware := []gin.HandlerFunc{noCORSMiddleware(), m.localhostOnlyMiddleware()}
|
rootMiddleware := []gin.HandlerFunc{noCORSMiddleware(), m.localhostOnlyMiddleware()}
|
||||||
|
engine.GET("/threads/*path", append(rootMiddleware, proxyHandler)...)
|
||||||
engine.GET("/threads.rss", append(rootMiddleware, proxyHandler)...)
|
engine.GET("/threads.rss", append(rootMiddleware, proxyHandler)...)
|
||||||
|
|
||||||
// Root-level auth routes for CLI login flow
|
// Root-level auth routes for CLI login flow
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func TestRegisterManagementRoutes(t *testing.T) {
|
|||||||
{"/api/meta", http.MethodGet},
|
{"/api/meta", http.MethodGet},
|
||||||
{"/api/telemetry", http.MethodGet},
|
{"/api/telemetry", http.MethodGet},
|
||||||
{"/api/threads", http.MethodGet},
|
{"/api/threads", http.MethodGet},
|
||||||
|
{"/threads/", http.MethodGet},
|
||||||
{"/threads.rss", http.MethodGet}, // Root-level route (no /api prefix)
|
{"/threads.rss", http.MethodGet}, // Root-level route (no /api prefix)
|
||||||
{"/api/otel", http.MethodGet},
|
{"/api/otel", http.MethodGet},
|
||||||
{"/api/tab", http.MethodGet},
|
{"/api/tab", http.MethodGet},
|
||||||
|
|||||||
Reference in New Issue
Block a user