feat(api): make /api/v1/stats public and point the landing at it
Unify the monitoring stats on the versioned API: /api/v1/stats is now public (no auth) and CORS-enabled, mirroring the legacy /api/stats. The marketing landing (docs/index.html) now fetches /api/v1/stats; /api/stats is kept as a deprecated alias for existing monitors. Feed/email routes remain token-gated. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
45d2a14a12
commit
daa93d8093
5 files changed
+36
-24
No files matched your search
@@ -61,7 +61,9 @@ Main routes:
|
||||
|
||||
### Monitoring
|
||||
|
||||
`GET /api/stats` returns JSON counters (public, no auth) for uptime/monitoring tools:
|
||||
`GET /api/v1/stats` returns JSON counters (public, no auth, CORS-enabled) for
|
||||
uptime/monitoring tools and the landing page. `GET /api/stats` is a deprecated alias kept
|
||||
for backward compatibility — prefer the versioned path. Both expose the same fields:
|
||||
|
||||
| Field | Meaning |
|
||||
| ----------------------------- | -------------------------------------------------------- |
|
||||
@@ -84,23 +86,25 @@ A versioned REST API lets you automate feed and email management without scrapin
|
||||
admin UI. The OpenAPI 3.1 spec is served at `GET /api/openapi.json` and a rendered
|
||||
reference (Scalar) at `GET /api/docs` — both public.
|
||||
|
||||
All `/api/v1/*` endpoints require authentication, using either:
|
||||
The feed and email endpoints require authentication, using either:
|
||||
|
||||
- **Bearer token**: `Authorization: Bearer <ADMIN_PASSWORD>`, or
|
||||
- **Reverse-proxy auth**: the same trusted-IP + `X-Auth-Proxy-Secret` + `Remote-User`
|
||||
headers as the admin UI (see [INSTALL.md](INSTALL.md)).
|
||||
|
||||
| Method | Path | Purpose |
|
||||
| -------- | ------------------------------------ | ------------------------ |
|
||||
| `GET` | `/api/v1/feeds` | List feeds |
|
||||
| `POST` | `/api/v1/feeds` | Create a feed |
|
||||
| `GET` | `/api/v1/feeds/{feedId}` | Get a feed |
|
||||
| `PATCH` | `/api/v1/feeds/{feedId}` | Update a feed |
|
||||
| `DELETE` | `/api/v1/feeds/{feedId}` | Delete a feed |
|
||||
| `GET` | `/api/v1/feeds/{feedId}/emails` | List a feed's emails |
|
||||
| `GET` | `/api/v1/feeds/{feedId}/emails/{id}` | Get a single email |
|
||||
| `DELETE` | `/api/v1/feeds/{feedId}/emails/{id}` | Delete a single email |
|
||||
| `GET` | `/api/v1/stats` | Read monitoring counters |
|
||||
`GET /api/v1/stats`, the OpenAPI spec, and the docs page are public.
|
||||
|
||||
| Method | Path | Auth | Purpose |
|
||||
| -------- | ------------------------------------ | ------ | ------------------------ |
|
||||
| `GET` | `/api/v1/feeds` | yes | List feeds |
|
||||
| `POST` | `/api/v1/feeds` | yes | Create a feed |
|
||||
| `GET` | `/api/v1/feeds/{feedId}` | yes | Get a feed |
|
||||
| `PATCH` | `/api/v1/feeds/{feedId}` | yes | Update a feed |
|
||||
| `DELETE` | `/api/v1/feeds/{feedId}` | yes | Delete a feed |
|
||||
| `GET` | `/api/v1/feeds/{feedId}/emails` | yes | List a feed's emails |
|
||||
| `GET` | `/api/v1/feeds/{feedId}/emails/{id}` | yes | Get a single email |
|
||||
| `DELETE` | `/api/v1/feeds/{feedId}/emails/{id}` | yes | Delete a single email |
|
||||
| `GET` | `/api/v1/stats` | public | Read monitoring counters |
|
||||
|
||||
The email `{id}` is the email's `receivedAt` timestamp (as returned by the list endpoint).
|
||||
|
||||
|
||||
Reference in new issue
Block a user