Add public API key signup
This commit is contained in:
@@ -64,6 +64,7 @@ curl -s -X POST localhost:8787/v1/clones -H 'content-type: application/json' \
|
||||
|
||||
```
|
||||
POST /v1/clones { url, options? } → 202 {jobId,status} | 200 {cached result | inline result}
|
||||
POST /v1/signup { email, label? } → 201 {apiKey,message} (public when enabled)
|
||||
GET /v1/clones → list (metadata)
|
||||
GET /v1/clones/:id → status + metadata (fileCount, totalBytes, capture, timings)
|
||||
GET /v1/clones/:id/result → the eager CloneResult (text files inline; binaries by URL)
|
||||
@@ -73,6 +74,13 @@ DELETE /v1/clones/:id → purge artifacts
|
||||
GET /healthz → { ok: true } (unauthenticated)
|
||||
```
|
||||
|
||||
`/v1/clones*` and `/mcp` are authenticated when `API_KEYS` is set or DB-backed
|
||||
keys exist. Use `Authorization: Bearer <key>` or `x-api-key: <key>`.
|
||||
`/v1/signup` is intentionally public only when `SIGNUP_ENABLED=true` **and**
|
||||
`DATABASE_URL` is set. It mints a `dtto_live_...` key, stores only its SHA-256
|
||||
hash in Postgres, stores the submitted email in the key label for attribution,
|
||||
and returns the raw key once.
|
||||
|
||||
Normal product `options` are `{ mode?: "single" | "multi", styling?: "tailwind" | "css", framework?: "next" | "vite" }`.
|
||||
`mode` defaults to `"single"`, `styling` defaults to `"tailwind"`, and `framework` defaults to `"next"`. Operational options
|
||||
remain `{ verify?, asyncVerify?, maxRoutes?, maxCollection?, captureConcurrency?, validationConcurrency?, viewportConcurrency?, noCache? }`; `noCache` is service-level and
|
||||
@@ -124,6 +132,9 @@ List-then-read so a clone never floods the agent's context:
|
||||
| `PUBLIC_BASE_URL` | api | — | absolute base for MCP-returned URLs |
|
||||
| `API_KEYS` | api | — | comma-separated keys; empty = open |
|
||||
| `RATE_LIMIT_PER_MINUTE` | api | `0` | per key/IP cap (0 = unlimited) |
|
||||
| `SIGNUP_ENABLED` | api | `false` | DB mode only: expose public `POST /v1/signup` for API-key minting |
|
||||
| `SIGNUP_RATE_LIMIT_PER_HOUR` | api | `3` | per-IP signup cap; `0` disables signup throttling |
|
||||
| `DEFAULT_SIGNUP_KEY_RATE_LIMIT` | api | `30` | stored on keys minted by signup; service-wide enforcement still uses `RATE_LIMIT_PER_MINUTE` |
|
||||
| `SSRF_DISABLE` | api | `false` | turn off the SSRF guard (not recommended) |
|
||||
| `SSRF_ALLOW_LOOPBACK` | api | `false` | allow cloning localhost (local dev) |
|
||||
| `S3_BUCKET` / `S3_ENDPOINT` / `S3_REGION` / `S3_ACCESS_KEY_ID` / `S3_SECRET_ACCESS_KEY` / `S3_FORCE_PATH_STYLE` / `S3_PUBLIC_URL` | api, worker | — | set `S3_BUCKET` ⇒ object storage |
|
||||
|
||||
Reference in New Issue
Block a user