Compare commits
2 Commits
883535c4f7
...
bc04d1c44a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc04d1c44a | ||
|
|
832dc2c45b |
@@ -245,6 +245,48 @@ curl -s -X POST "$API/api/v1/identity/$IDENTITY_UUID/bind" \
|
||||
|
||||
---
|
||||
|
||||
### `POST /api/v1/identity/:identity_uuid/bind/trace`
|
||||
|
||||
**Auth**: Required
|
||||
**Scope**: identity-level
|
||||
|
||||
Bind all face detections of a trace to an identity. Updates all rows in `face_detections` with the matching `file_uuid` and `trace_id`.
|
||||
|
||||
#### Request Parameters
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `file_uuid` | string | Yes | File where trace exists |
|
||||
| `trace_id` | integer | Yes | Trace ID (from `face_detections.trace_id`) |
|
||||
|
||||
#### Example
|
||||
|
||||
```bash
|
||||
curl -s -X POST "$API/api/v1/identity/$IDENTITY_UUID/bind/trace" \
|
||||
-H "X-API-Key: $KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"file_uuid": "'"$FILE_UUID"'", "trace_id": 919}'
|
||||
```
|
||||
|
||||
#### Response (200)
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Bound trace 919 of aeed71342... to Cary Grant",
|
||||
"data": { "rows_affected": 53 }
|
||||
}
|
||||
```
|
||||
|
||||
#### Error Responses
|
||||
|
||||
| HTTP | When |
|
||||
|------|------|
|
||||
| `404` | Identity not found |
|
||||
| `500` | Database error |
|
||||
|
||||
---
|
||||
|
||||
### `POST /api/v1/identity/:identity_uuid/unbind`
|
||||
|
||||
**Auth**: Required
|
||||
|
||||
@@ -228,6 +228,7 @@ function showSearchResult(module, q) {
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
sessionStorage.removeItem('doc_search_q');
|
||||
var el = document.getElementById('search');
|
||||
el.value = '';
|
||||
el.focus();
|
||||
@@ -290,6 +291,8 @@ async function initApp() {
|
||||
var clearEl = document.getElementById('search-clear');
|
||||
searchEl.oninput = function() {
|
||||
var q = this.value.toLowerCase().trim();
|
||||
if (q) { sessionStorage.setItem('doc_search_q', q); }
|
||||
else { sessionStorage.removeItem('doc_search_q'); }
|
||||
clearEl.style.display = q ? 'block' : 'none';
|
||||
if (q.length < 2) {
|
||||
moduleListEl.style.display = '';
|
||||
@@ -327,6 +330,7 @@ async function initApp() {
|
||||
try {
|
||||
await fetch('/api/v1/auth/logout', {method:'POST', credentials:'include'});
|
||||
} catch(_) {}
|
||||
sessionStorage.removeItem('doc_search_q');
|
||||
// Clear client-side cookies
|
||||
document.cookie.split(';').forEach(function(c) {
|
||||
document.cookie = c.trim().split('=')[0] + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
|
||||
@@ -335,9 +339,20 @@ async function initApp() {
|
||||
showLoginForm();
|
||||
};
|
||||
|
||||
// Load initial module from hash or default
|
||||
var hash = location.hash.slice(1);
|
||||
await loadDoc(hash || '01_auth');
|
||||
// Restore search query across page refresh
|
||||
var savedQ = sessionStorage.getItem('doc_search_q');
|
||||
if (savedQ) {
|
||||
searchEl.value = savedQ;
|
||||
clearEl.style.display = 'block';
|
||||
moduleListEl.style.display = 'none';
|
||||
searchResultsEl.style.display = 'block';
|
||||
searchResultsEl.innerHTML = '<p style="font-size:13px;color:#888">Restoring search...</p>';
|
||||
fulltextSearch(savedQ);
|
||||
} else {
|
||||
// Load initial module from hash or default
|
||||
var hash = location.hash.slice(1);
|
||||
await loadDoc(hash || '01_auth');
|
||||
}
|
||||
} catch(e) {
|
||||
el.innerHTML = '<p style="color:red">Init error: ' + e.message + '</p><pre>'+e.stack+'</pre>';
|
||||
}
|
||||
|
||||
@@ -245,6 +245,48 @@ curl -s -X POST "$API/api/v1/identity/$IDENTITY_UUID/bind" \
|
||||
|
||||
---
|
||||
|
||||
### `POST /api/v1/identity/:identity_uuid/bind/trace`
|
||||
|
||||
**Auth**: Required
|
||||
**Scope**: identity-level
|
||||
|
||||
Bind all face detections of a trace to an identity. Updates all rows in `face_detections` with the matching `file_uuid` and `trace_id`.
|
||||
|
||||
#### Request Parameters
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `file_uuid` | string | Yes | File where trace exists |
|
||||
| `trace_id` | integer | Yes | Trace ID (from `face_detections.trace_id`) |
|
||||
|
||||
#### Example
|
||||
|
||||
```bash
|
||||
curl -s -X POST "$API/api/v1/identity/$IDENTITY_UUID/bind/trace" \
|
||||
-H "X-API-Key: $KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"file_uuid": "'"$FILE_UUID"'", "trace_id": 919}'
|
||||
```
|
||||
|
||||
#### Response (200)
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Bound trace 919 of aeed71342... to Cary Grant",
|
||||
"data": { "rows_affected": 53 }
|
||||
}
|
||||
```
|
||||
|
||||
#### Error Responses
|
||||
|
||||
| HTTP | When |
|
||||
|------|------|
|
||||
| `404` | Identity not found |
|
||||
| `500` | Database error |
|
||||
|
||||
---
|
||||
|
||||
### `POST /api/v1/identity/:identity_uuid/unbind`
|
||||
|
||||
**Auth**: Required
|
||||
|
||||
Reference in New Issue
Block a user