docs: update comprehensive API documentation and project guides
This commit updates all documentation files throughout the project: - Updated IMPLEMENTATION_PLAN.md with new implementation details - Updated PROJECT_GUIDELINES.md with coding standards and practices - Updated README.md with current project information - Updated SCREENSHOT_AUTOMATION.md with new automation details - Added TEST_DATA.md with test fixtures data - Updated cover_image_serving_plan.md with static URL patterns Documentation API updates: - Updated API reference documentation for all endpoints including: - Authentication (login, logout, register, refresh_token) - Book matching (auto_link, bulk_link, link_book, search) - Collections (CRUD operations, shelf mappings, auto-assign rules) - Conflicts (bulk operations, resolve/dismiss) - Devices (registration, approval, shelf management) - Highlights (create, update, delete, get) - Kobo sync (bookmark, markup, initialization, sync) - KOReader sync (library, metadata, bookmarks, progress) - Libraries (CRUD, folders, media items, stats) - Media items (bulk operations, CRUD) - Notes (CRUD operations) - OPDS (acquisition, feeds, publication) - Progress (reading progress tracking) - Queue (device queue management) - Ratings (star ratings) - Scanner (watch mode, scan operations) - Sync protocols (Kobo, KOReader) - Users (profile, password, admin operations) - WebSocket protocols - Updated user guides (admin, dashboard, settings, sync) - Updated device setup guides (Kobo, KOReader) - Updated developer guides (testing, contributing, operations) - Updated scripts/README.md
This commit is contained in:
@@ -29,6 +29,7 @@ ws://localhost:8765/ws/sync?token=<your_jwt_token>
|
||||
```
|
||||
|
||||
**How to get JWT token**:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8765/api/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -36,6 +37,7 @@ curl -X POST http://localhost:8765/api/auth/login \
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "eyJhbGciOiJIUzI1NiIs...",
|
||||
@@ -65,6 +67,7 @@ Device tokens are generated when devices are registered via the API.
|
||||
### Step 1: Connect to WebSocket
|
||||
|
||||
**JavaScript Example**:
|
||||
|
||||
```javascript
|
||||
const token = "your-jwt-token";
|
||||
const ws = new WebSocket(`ws://localhost:8765/ws/sync?token=${token}`);
|
||||
@@ -83,6 +86,7 @@ ws.onclose = (event) => {
|
||||
```
|
||||
|
||||
**Go Example**:
|
||||
|
||||
```go
|
||||
import (
|
||||
"github.com/gorilla/websocket"
|
||||
@@ -97,6 +101,7 @@ defer ws.Close()
|
||||
```
|
||||
|
||||
**Python Example**:
|
||||
|
||||
```python
|
||||
import websocket
|
||||
|
||||
@@ -224,6 +229,7 @@ All messages follow this structure:
|
||||
```
|
||||
|
||||
**Fields**:
|
||||
|
||||
- `type` (string, required): Message type identifier
|
||||
- `timestamp` (string, required): ISO 8601 timestamp
|
||||
- `data` (object, required): Message payload
|
||||
@@ -240,6 +246,7 @@ All messages follow this structure:
|
||||
**Purpose**: Send current progress for all user's books
|
||||
|
||||
**Data Structure**:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "initial_state",
|
||||
@@ -263,6 +270,7 @@ All messages follow this structure:
|
||||
```
|
||||
|
||||
**Fields**:
|
||||
|
||||
- `progress` (object): Map of book UUID → progress data
|
||||
- `percentage` (number): 0.0 to 1.0
|
||||
- `current_page` (number): Current page number
|
||||
@@ -277,6 +285,7 @@ All messages follow this structure:
|
||||
**Purpose**: Notify all connected clients of progress change
|
||||
|
||||
**Data Structure**:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "progress_update",
|
||||
@@ -294,11 +303,13 @@ All messages follow this structure:
|
||||
```
|
||||
|
||||
**Fields**:
|
||||
|
||||
- `book_id` (string): UUID of book with updated progress
|
||||
- `percentage` (number): New progress value (0.0 to 1.0)
|
||||
- `source_device` (object): Device that sent the update
|
||||
|
||||
**Use Cases**:
|
||||
|
||||
- Update progress bar in real-time
|
||||
- Sync reading position across devices
|
||||
- Update "currently reading" lists
|
||||
@@ -310,6 +321,7 @@ All messages follow this structure:
|
||||
**Purpose**: Share annotations across devices
|
||||
|
||||
**Data Structure**:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "annotation_update",
|
||||
@@ -333,6 +345,7 @@ All messages follow this structure:
|
||||
```
|
||||
|
||||
**Fields**:
|
||||
|
||||
- `book_id` (string): UUID of book
|
||||
- `annotation_type` (string): Type of annotation (bookmark, highlight, note)
|
||||
- `data` (object): Annotation-specific data
|
||||
@@ -343,6 +356,7 @@ All messages follow this structure:
|
||||
- `source_device` (object): Device that created the annotation
|
||||
|
||||
**Use Cases**:
|
||||
|
||||
- Show bookmarks on all devices
|
||||
- Share highlights between devices
|
||||
- Display reading notes
|
||||
@@ -354,6 +368,7 @@ All messages follow this structure:
|
||||
**Purpose**: Notify user of conflicting updates
|
||||
|
||||
**Data Structure**:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "conflict",
|
||||
@@ -367,11 +382,13 @@ All messages follow this structure:
|
||||
```
|
||||
|
||||
**Fields**:
|
||||
|
||||
- `book_id` (string): UUID of book with conflict
|
||||
- `notification_type` (string): Type of conflict (progress_conflict, annotation_conflict)
|
||||
- `conflict_id` (string): UUID of conflict record
|
||||
|
||||
**Use Cases**:
|
||||
|
||||
- Prompt user to resolve conflict
|
||||
- Show conflict resolution UI
|
||||
- Log conflict for manual review
|
||||
@@ -383,6 +400,7 @@ All messages follow this structure:
|
||||
**Purpose**: Keep connection alive
|
||||
|
||||
**Data Structure**:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "heartbeat",
|
||||
@@ -587,6 +605,7 @@ client.connect();
|
||||
**Problem**: Can't connect to WebSocket
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. Check JWT token is valid
|
||||
2. Verify server is running: `curl http://localhost:8765/health`
|
||||
3. Check firewall settings
|
||||
@@ -597,6 +616,7 @@ client.connect();
|
||||
**Problem**: WebSocket disconnects unexpectedly
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. Check network stability
|
||||
2. Verify server keepalive settings
|
||||
3. Implement reconnection logic (see above)
|
||||
@@ -607,6 +627,7 @@ client.connect();
|
||||
**Problem**: Connected but no messages
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. Check onmessage handler is registered
|
||||
2. Verify initial_state message received
|
||||
3. Test with manual progress update via API
|
||||
@@ -617,6 +638,7 @@ client.connect();
|
||||
**Problem**: 401 Unauthorized
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. Verify JWT token is not expired
|
||||
2. Check token has correct claims (user_id)
|
||||
3. For device tokens, verify Authorization header format
|
||||
@@ -627,6 +649,7 @@ client.connect();
|
||||
**Problem**: Client memory increases over time
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. Clean up old messages
|
||||
2. Don't store entire message history
|
||||
3. Use weak references for large data
|
||||
@@ -637,6 +660,7 @@ client.connect();
|
||||
## Performance Tips
|
||||
|
||||
1. **Debounce UI Updates**: Don't update DOM on every message
|
||||
|
||||
```javascript
|
||||
const debouncedUpdate = debounce(updateUI, 100);
|
||||
client.on("progress_update", (message) => {
|
||||
@@ -664,6 +688,7 @@ client.connect();
|
||||
## Support
|
||||
|
||||
For issues or questions:
|
||||
|
||||
- GitHub Issues: [Bookhoard Repository]
|
||||
- Documentation: [Bookhoard Docs]
|
||||
- API Reference: [Bookhoard API Docs]
|
||||
|
||||
Reference in New Issue
Block a user