u
This commit is contained in:
@@ -47,6 +47,8 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
|
||||
| [`routes/company/delete.md`](routes/company/delete.md) | `DELETE /company/{id}` |
|
||||
| [`routes/company/update.md`](routes/company/update.md) | `PUT /company/{id}` |
|
||||
| [`routes/health.md`](routes/health.md) | `GET /health` |
|
||||
| [`routes/image/get.md`](routes/image/get.md) | `GET /image/{fullHash}` |
|
||||
| [`routes/thumb/get.md`](routes/thumb/get.md) | `GET /thumb/{fullHash}` |
|
||||
|
||||
Machine-readable spec: [`openapi.json`](openapi.json).
|
||||
|
||||
|
||||
@@ -31,9 +31,205 @@
|
||||
{
|
||||
"name": "Company",
|
||||
"description": "Company CRUD"
|
||||
},
|
||||
{
|
||||
"name": "Image",
|
||||
"description": "Content-addressed AVIF by fullHash"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/image/{fullHash}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Image"
|
||||
],
|
||||
"summary": "Full image by hash",
|
||||
"description": "Returns the full AVIF by `pic.hash` (SHA-256 hex).\nAuth via article category access. Browser-cacheable (`private`, `immutable`, `ETag`).\n",
|
||||
"security": [
|
||||
{
|
||||
"cookieAuth": []
|
||||
}
|
||||
],
|
||||
"x-markdown": "image/get.md",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "fullHash",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-fA-F0-9]{64}$"
|
||||
},
|
||||
"description": "SHA-256 hex of the full image bytes"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "AVIF image bytes",
|
||||
"headers": {
|
||||
"Cache-Control": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"example": "private, max-age=31536000, immutable"
|
||||
}
|
||||
},
|
||||
"ETag": {
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"image/avif": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"304": {
|
||||
"description": "Not modified (If-None-Match matched ETag)"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid hash",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Not authorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Image not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/thumb/{fullHash}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Image"
|
||||
],
|
||||
"summary": "Thumb image by hash",
|
||||
"description": "Returns the thumb AVIF for `pic.hash` (fullHash — not thumbhash).\nAuth via article category access. Browser-cacheable (`private`, `immutable`, `ETag`).\n",
|
||||
"security": [
|
||||
{
|
||||
"cookieAuth": []
|
||||
}
|
||||
],
|
||||
"x-markdown": "thumb/get.md",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "fullHash",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-fA-F0-9]{64}$"
|
||||
},
|
||||
"description": "SHA-256 hex of the full image bytes"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "AVIF thumb bytes",
|
||||
"headers": {
|
||||
"Cache-Control": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"example": "private, max-age=31536000, immutable"
|
||||
}
|
||||
},
|
||||
"ETag": {
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"image/avif": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"304": {
|
||||
"description": "Not modified (If-None-Match matched ETag)"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid hash",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Not authorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Image not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
||||
33
docs/api/routes/image/get.md
Normal file
33
docs/api/routes/image/get.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# `GET /image/{fullHash}`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Full image by hash
|
||||
|
||||
Returns the full AVIF by `pic.hash` (SHA-256 hex).
|
||||
Auth via article category access. Browser-cacheable (`private`, `immutable`, `ETag`).
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `fullHash` | yes | string | SHA-256 hex of the full image bytes |
|
||||
|
||||
## Response `200`
|
||||
|
||||
AVIF image bytes
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 304 | Not modified (If-None-Match matched ETag) |
|
||||
| 400 | Invalid hash — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 403 | Not authorized — `{"error":"…"}` |
|
||||
| 404 | Image not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
33
docs/api/routes/thumb/get.md
Normal file
33
docs/api/routes/thumb/get.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# `GET /thumb/{fullHash}`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Thumb image by hash
|
||||
|
||||
Returns the thumb AVIF for `pic.hash` (fullHash — not thumbhash).
|
||||
Auth via article category access. Browser-cacheable (`private`, `immutable`, `ETag`).
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `fullHash` | yes | string | SHA-256 hex of the full image bytes |
|
||||
|
||||
## Response `200`
|
||||
|
||||
AVIF thumb bytes
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 304 | Not modified (If-None-Match matched ETag) |
|
||||
| 400 | Invalid hash — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 403 | Not authorized — `{"error":"…"}` |
|
||||
| 404 | Image not found — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
Reference in New Issue
Block a user