fix: simplify whitelist entries and update logs API

- Change whitelist response format to use single `entry` field instead of `ip` + `reason`
- Update auth endpoint to return 204 No Content instead of 200 with body
- Add 405 Method Not Allowed response for auth endpoint
- Fix operationId for permanent whitelist endpoint (was `listTempWhitelist`)
- Add query parameters for logs endpoint: action, ip, limit, offset
- Update documentation in docs/api.md and openapi.yaml
This commit is contained in:
db123-test
2026-05-04 13:27:06 +03:30
parent 252c617769
commit a281012fc4
2 changed files with 50 additions and 20 deletions

View File

@@ -91,8 +91,7 @@ List all currently active permanent whitelisted IPs.
```json
[
{
"ip": "1.2.3.4",
"reason": "my laptop",
"entry": "203.0.113.10"
}
]
```
@@ -111,6 +110,15 @@ Retrieve audit log entries.
**Authorization:** Bearer `{API_TOKEN}`
**Query parameters:**
| Parameter | Type | Required | Default | Description |
|-----------|--------|----------|---------|---------------------------------------------------------------------|
| `action` | string | No | | Filter by action type (`add_temp`, `delete_temp`, `add_perm`, etc.) |
| `ip` | string | No | | Filter by IP address |
| `limit` | int | No | 200 | Number of entries to return (max 1000) |
| `offset` | int | No | 0 | Number of entries to skip |
**Response body:**
```json
@@ -137,7 +145,7 @@ curl -X GET http://127.0.0.1:8080/api/logs \
The NGINX auth_request endpoint. Do NOT call this directly.
**Response:** 200 (allow) or 401 (deny)
**Response:** 204 No Content (allow) or 401 (deny)
### GET /status