fix(v2): use rjweb-server {param} syntax for URL path parameters

rjweb-server 9.x uses {param} not :param for dynamic route segments.
All parametric routes (/webhook/{userId}, /api/previews/{id}, etc.)
were returning 404 because the server never matched them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 08:49:11 +00:00
parent d1ec1287d2
commit 3a25468f37
+8 -8
View File
@@ -54,7 +54,7 @@ server.path("/", (path) => path
// Webhook
server.path("/", (path) => path
.http("POST", "/webhook/:userId", (http) => http.onRequest(webhookHandler))
.http("POST", "/webhook/{userId}", (http) => http.onRequest(webhookHandler))
);
// User settings
@@ -73,15 +73,15 @@ server.path("/", (path) => path
.http("GET", "/api/repos", (http) => http.onRequest(listRepos))
.http("POST", "/api/repos/config", (http) => http.onRequest(saveRepoConfig))
.http("POST", "/api/repos/toggle", (http) => http.onRequest(toggleRepoEnabled))
.http("GET", "/api/repos/:owner/:repo/config", (http) => http.onRequest(getRepoConfig))
.http("GET", "/api/repos/{owner}/{repo}/config", (http) => http.onRequest(getRepoConfig))
);
// Previews
server.path("/", (path) => path
.http("GET", "/api/previews", (http) => http.onRequest(listPreviews))
.http("GET", "/api/previews/:id", (http) => http.onRequest(getPreview))
.http("POST", "/api/previews/:id/stop", (http) => http.onRequest(stopPreviewRoute))
.ws("/api/previews/:id/logs", (ws) => ws
.http("GET", "/api/previews/{id}", (http) => http.onRequest(getPreview))
.http("POST", "/api/previews/{id}/stop", (http) => http.onRequest(stopPreviewRoute))
.ws("/api/previews/{id}/logs", (ws) => ws
.onOpen(previewLogsWs)
.onMessage(async () => {})
.onClose(async () => {})
@@ -92,12 +92,12 @@ server.path("/", (path) => path
server.path("/", (path) => path
.http("GET", "/api/admin/users", (http) => http.onRequest(listUsers))
.http("POST", "/api/admin/users", (http) => http.onRequest(createUser))
.http("PATCH", "/api/admin/users/:id", (http) => http.onRequest(updateUser))
.http("DELETE", "/api/admin/users/:id", (http) => http.onRequest(deleteUser))
.http("PATCH", "/api/admin/users/{id}", (http) => http.onRequest(updateUser))
.http("DELETE", "/api/admin/users/{id}", (http) => http.onRequest(deleteUser))
.http("GET", "/api/admin/settings", (http) => http.onRequest(getSettings))
.http("PUT", "/api/admin/settings", (http) => http.onRequest(updateSettings))
.http("GET", "/api/admin/previews", (http) => http.onRequest(adminListPreviews))
.http("POST", "/api/admin/previews/:id/stop", (http) => http.onRequest(adminStopPreview))
.http("POST", "/api/admin/previews/{id}/stop", (http) => http.onRequest(adminStopPreview))
);
// Static UI — must come AFTER API routes