fix: scan status=unregistered not shown as registered; feat: config API for auto-pipeline/watcher-auto-register

This commit is contained in:
Accusys
2026-05-19 00:37:00 +08:00
parent 05e1e807c0
commit a02a83c1c3
9 changed files with 259 additions and 35 deletions
@@ -69,6 +69,8 @@ Every path segment after the resource ID is a **verb** — an action on that res
| 14 | GET | `/api/v1/progress/:file_uuid` | Processing progress |
| 15 | GET | `/api/v1/jobs` | List monitor jobs (filterable by status) |
| 16 | POST | `/api/v1/config/cache` | Toggle Redis cache |
| 17 | POST | `/api/v1/config/auto-pipeline` | Toggle auto-pipeline on register |
| 18 | POST | `/api/v1/config/watcher-auto-register` | Toggle watcher auto-register |
| 17 | POST | `/api/v1/search/visual` | Search visual chunks |
| 18 | POST | `/api/v1/search/visual/class` | Search by object class |
| 19 | POST | `/api/v1/search/visual/density` | Search by spatial density |
+3 -1
View File
@@ -16,7 +16,7 @@ owner: "Warren"
| Environment | URL |
|-------------|-----|
| Production | `http://localhost:3002` or `https://api.momentry.ddns.net` |
| Production | `http://localhost:3002` or `https://m5api.momentry.ddns.net` |
| Development | `http://localhost:3003` |
| Auth | Header `X-API-Key: <key>` (login endpoint unprotected) |
@@ -36,6 +36,8 @@ owner: "Warren"
| 6 | GET | `/api/v1/stats/sftpgo` | SFTPGo status |
| 7 | GET | `/api/v1/stats/inference` | LLM/Embedding health |
| 8 | POST | `/api/v1/config/cache` | Toggle Redis cache |
| 9 | POST | `/api/v1/config/auto-pipeline` | Toggle auto-pipeline on register |
| 10 | POST | `/api/v1/config/watcher-auto-register` | Toggle watcher auto-register |
```bash
curl http://localhost:3002/health
@@ -161,6 +161,8 @@ related_documents:
| `GET` | `/api/v1/stats/sftpgo` | Internal |
| `GET` | `/api/v1/stats/inference` | Internal |
| `POST` | `/api/v1/config/cache` | Admin |
| `POST` | `/api/v1/config/auto-pipeline` | Admin |
| `POST` | `/api/v1/config/watcher-auto-register` | Admin |
---
@@ -158,6 +158,8 @@ related_documents:
| 51 | GET | `/api/v1/stats/sftpgo` | SFTPGo 使用者狀態 | ✅ |
| 52 | GET | `/api/v1/stats/inference` | 推理叢集健康狀態 | ✅ |
| 53 | POST | `/api/v1/config/cache` | 切換快取開關 | ✅ |
| 54 | POST | `/api/v1/config/auto-pipeline` | 註冊後自動處理 | ✅ |
| 55 | POST | `/api/v1/config/watcher-auto-register` | Watcher 自動註冊 | ✅ |
---
@@ -11,7 +11,8 @@
Register a video file for processing. Returns the file's metadata and UUID.
**New in v0.1.2**: Registration now **automatically triggers the processing pipeline** — no need to call `POST /api/v1/file/:file_uuid/process` separately. The system will:
Registration can **automatically trigger the processing pipeline** if the
[auto-pipeline toggle](/api/v1/config/auto-pipeline) is enabled (disabled by default). The system will:
1. Register the file and run ffprobe
2. Auto-run offline TMDb probe (reads local identity files, no API calls)
3. Create a monitor job for the worker
@@ -125,6 +125,59 @@ curl -s -X POST "$API/api/v1/config/cache" \
-d '{"enabled": false}'
```
### `POST /api/v1/config/auto-pipeline`
**Auth**: Required
**Scope**: system-level
Toggle automatic processing pipeline trigger on file registration (disabled by default).
#### Request Parameters
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `enabled` | boolean | Yes | `true` to enable auto-pipeline, `false` to disable |
#### Example
```bash
# Enable auto-pipeline
curl -s -X POST "$API/api/v1/config/auto-pipeline" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"enabled": true}'
# Disable auto-pipeline
curl -s -X POST "$API/api/v1/config/auto-pipeline" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"enabled": false}'
```
### `POST /api/v1/config/watcher-auto-register`
**Auth**: Required
**Scope**: system-level
Toggle automatic registration of newly detected files in the watcher (disabled by default).
When enabled, the file watcher automatically pre-processes and registers new files into the database.
#### Request Parameters
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `enabled` | boolean | Yes | `true` to enable watcher auto-register, `false` to disable |
#### Example
```bash
# Enable watcher auto-register
curl -s -X POST "$API/api/v1/config/watcher-auto-register" \
-H "Content-Type: application/json" \
-H "X-API-Key: $KEY" \
-d '{"enabled": true}'
```
### Unmounted Routes
The following routes are defined in source code but are **NOT** currently mounted in the router: