|
|
|
@@ -33,7 +33,7 @@ tests/ # Test suites
|
|
|
|
## Technology Stack
|
|
|
|
## Technology Stack
|
|
|
|
|
|
|
|
|
|
|
|
| Layer | Technology |
|
|
|
|
| Layer | Technology |
|
|
|
|
| ---------- | --------------------------------------------------- |
|
|
|
|
| --------- | ---------------------------------------------- |
|
|
|
|
| Backend | FastAPI, Uvicorn, SQLAlchemy, SQLite, Pydantic |
|
|
|
|
| Backend | FastAPI, Uvicorn, SQLAlchemy, SQLite, Pydantic |
|
|
|
|
| Frontend | HTML5, CSS3, Vanilla JS, Bootstrap 5, HTMX |
|
|
|
|
| Frontend | HTML5, CSS3, Vanilla JS, Bootstrap 5, HTMX |
|
|
|
|
| Security | JWT (python-jose), bcrypt (passlib) |
|
|
|
|
| Security | JWT (python-jose), bcrypt (passlib) |
|
|
|
|
@@ -51,11 +51,13 @@ All lookups, events, and API operations use `key`. The `folder` is metadata for
|
|
|
|
## API Endpoints
|
|
|
|
## API Endpoints
|
|
|
|
|
|
|
|
|
|
|
|
### Authentication (`/api/auth`)
|
|
|
|
### Authentication (`/api/auth`)
|
|
|
|
|
|
|
|
|
|
|
|
- `POST /login` - Master password authentication (returns JWT)
|
|
|
|
- `POST /login` - Master password authentication (returns JWT)
|
|
|
|
- `POST /logout` - Invalidate session
|
|
|
|
- `POST /logout` - Invalidate session
|
|
|
|
- `GET /status` - Check authentication status
|
|
|
|
- `GET /status` - Check authentication status
|
|
|
|
|
|
|
|
|
|
|
|
### Configuration (`/api/config`)
|
|
|
|
### Configuration (`/api/config`)
|
|
|
|
|
|
|
|
|
|
|
|
- `GET /` - Get configuration
|
|
|
|
- `GET /` - Get configuration
|
|
|
|
- `PUT /` - Update configuration
|
|
|
|
- `PUT /` - Update configuration
|
|
|
|
- `POST /validate` - Validate without applying
|
|
|
|
- `POST /validate` - Validate without applying
|
|
|
|
@@ -63,6 +65,7 @@ All lookups, events, and API operations use `key`. The `folder` is metadata for
|
|
|
|
- `POST /backups/{name}/restore` - Restore backup
|
|
|
|
- `POST /backups/{name}/restore` - Restore backup
|
|
|
|
|
|
|
|
|
|
|
|
### Anime (`/api/anime`)
|
|
|
|
### Anime (`/api/anime`)
|
|
|
|
|
|
|
|
|
|
|
|
- `GET /` - List anime with missing episodes (returns `key` as identifier)
|
|
|
|
- `GET /` - List anime with missing episodes (returns `key` as identifier)
|
|
|
|
- `GET /{anime_id}` - Get anime details (accepts `key` or `folder` for backward compatibility)
|
|
|
|
- `GET /{anime_id}` - Get anime details (accepts `key` or `folder` for backward compatibility)
|
|
|
|
- `POST /search` - Search for anime (returns `key` as identifier)
|
|
|
|
- `POST /search` - Search for anime (returns `key` as identifier)
|
|
|
|
@@ -70,10 +73,12 @@ All lookups, events, and API operations use `key`. The `folder` is metadata for
|
|
|
|
- `POST /rescan` - Trigger library rescan
|
|
|
|
- `POST /rescan` - Trigger library rescan
|
|
|
|
|
|
|
|
|
|
|
|
**Response Models:**
|
|
|
|
**Response Models:**
|
|
|
|
|
|
|
|
|
|
|
|
- `AnimeSummary`: `key` (primary identifier), `name`, `site`, `folder` (metadata), `missing_episodes`, `link`
|
|
|
|
- `AnimeSummary`: `key` (primary identifier), `name`, `site`, `folder` (metadata), `missing_episodes`, `link`
|
|
|
|
- `AnimeDetail`: `key` (primary identifier), `title`, `folder` (metadata), `episodes`, `description`
|
|
|
|
- `AnimeDetail`: `key` (primary identifier), `title`, `folder` (metadata), `episodes`, `description`
|
|
|
|
|
|
|
|
|
|
|
|
### Download Queue (`/api/queue`)
|
|
|
|
### Download Queue (`/api/queue`)
|
|
|
|
|
|
|
|
|
|
|
|
- `GET /status` - Queue status and statistics
|
|
|
|
- `GET /status` - Queue status and statistics
|
|
|
|
- `POST /add` - Add episodes to queue
|
|
|
|
- `POST /add` - Add episodes to queue
|
|
|
|
- `DELETE /{item_id}` - Remove item
|
|
|
|
- `DELETE /{item_id}` - Remove item
|
|
|
|
@@ -82,6 +87,7 @@ All lookups, events, and API operations use `key`. The `folder` is metadata for
|
|
|
|
- `DELETE /completed` - Clear completed items
|
|
|
|
- `DELETE /completed` - Clear completed items
|
|
|
|
|
|
|
|
|
|
|
|
### WebSocket (`/ws/connect`)
|
|
|
|
### WebSocket (`/ws/connect`)
|
|
|
|
|
|
|
|
|
|
|
|
Real-time updates for downloads, scans, and queue operations.
|
|
|
|
Real-time updates for downloads, scans, and queue operations.
|
|
|
|
|
|
|
|
|
|
|
|
**Rooms**: `downloads`, `download_progress`, `scan_progress`
|
|
|
|
**Rooms**: `downloads`, `download_progress`, `scan_progress`
|
|
|
|
@@ -102,9 +108,11 @@ Real-time updates for downloads, scans, and queue operations.
|
|
|
|
## Core Services
|
|
|
|
## Core Services
|
|
|
|
|
|
|
|
|
|
|
|
### SeriesApp (`src/core/SeriesApp.py`)
|
|
|
|
### SeriesApp (`src/core/SeriesApp.py`)
|
|
|
|
|
|
|
|
|
|
|
|
Main engine for anime series management with async support, progress callbacks, and cancellation.
|
|
|
|
Main engine for anime series management with async support, progress callbacks, and cancellation.
|
|
|
|
|
|
|
|
|
|
|
|
### Callback System (`src/core/interfaces/callbacks.py`)
|
|
|
|
### Callback System (`src/core/interfaces/callbacks.py`)
|
|
|
|
|
|
|
|
|
|
|
|
- `ProgressCallback`, `ErrorCallback`, `CompletionCallback`
|
|
|
|
- `ProgressCallback`, `ErrorCallback`, `CompletionCallback`
|
|
|
|
- Context classes include `key` + optional `folder` fields
|
|
|
|
- Context classes include `key` + optional `folder` fields
|
|
|
|
- Thread-safe `CallbackManager` for multiple callback registration
|
|
|
|
- Thread-safe `CallbackManager` for multiple callback registration
|
|
|
|
@@ -112,7 +120,7 @@ Main engine for anime series management with async support, progress callbacks,
|
|
|
|
### Services (`src/server/services/`)
|
|
|
|
### Services (`src/server/services/`)
|
|
|
|
|
|
|
|
|
|
|
|
| Service | Purpose |
|
|
|
|
| Service | Purpose |
|
|
|
|
| ----------------- | ------------------------------------------- |
|
|
|
|
| ---------------- | ----------------------------------------- |
|
|
|
|
| AnimeService | Series management, scans (uses SeriesApp) |
|
|
|
|
| AnimeService | Series management, scans (uses SeriesApp) |
|
|
|
|
| DownloadService | Queue management, download execution |
|
|
|
|
| DownloadService | Queue management, download execution |
|
|
|
|
| ScanService | Library scan operations with callbacks |
|
|
|
|
| ScanService | Library scan operations with callbacks |
|
|
|
|
@@ -124,18 +132,24 @@ Main engine for anime series management with async support, progress callbacks,
|
|
|
|
## Frontend
|
|
|
|
## Frontend
|
|
|
|
|
|
|
|
|
|
|
|
### Static Files
|
|
|
|
### Static Files
|
|
|
|
|
|
|
|
|
|
|
|
- CSS: `styles.css` (Fluent UI design), `ux_features.css` (accessibility)
|
|
|
|
- CSS: `styles.css` (Fluent UI design), `ux_features.css` (accessibility)
|
|
|
|
- JS: `app.js`, `queue.js`, `websocket_client.js`, accessibility modules
|
|
|
|
- JS: `app.js`, `queue.js`, `websocket_client.js`, accessibility modules
|
|
|
|
|
|
|
|
|
|
|
|
### WebSocket Client
|
|
|
|
### WebSocket Client
|
|
|
|
|
|
|
|
|
|
|
|
Native WebSocket wrapper with Socket.IO-compatible API:
|
|
|
|
Native WebSocket wrapper with Socket.IO-compatible API:
|
|
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
```javascript
|
|
|
|
const socket = io();
|
|
|
|
const socket = io();
|
|
|
|
socket.join('download_progress');
|
|
|
|
socket.join("download_progress");
|
|
|
|
socket.on('download_progress', (data) => { /* ... */ });
|
|
|
|
socket.on("download_progress", (data) => {
|
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
|
|
|
});
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Authentication
|
|
|
|
### Authentication
|
|
|
|
|
|
|
|
|
|
|
|
JWT tokens stored in localStorage, included as `Authorization: Bearer <token>`.
|
|
|
|
JWT tokens stored in localStorage, included as `Authorization: Bearer <token>`.
|
|
|
|
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
## Testing
|
|
|
|
@@ -154,11 +168,13 @@ conda run -n AniWorld python -m pytest tests/api/ -v
|
|
|
|
## Production Notes
|
|
|
|
## Production Notes
|
|
|
|
|
|
|
|
|
|
|
|
### Current (Single-Process)
|
|
|
|
### Current (Single-Process)
|
|
|
|
|
|
|
|
|
|
|
|
- SQLite with WAL mode
|
|
|
|
- SQLite with WAL mode
|
|
|
|
- In-memory WebSocket connections
|
|
|
|
- In-memory WebSocket connections
|
|
|
|
- File-based config and queue persistence
|
|
|
|
- File-based config and queue persistence
|
|
|
|
|
|
|
|
|
|
|
|
### Multi-Process Deployment
|
|
|
|
### Multi-Process Deployment
|
|
|
|
|
|
|
|
|
|
|
|
- Switch to PostgreSQL/MySQL
|
|
|
|
- Switch to PostgreSQL/MySQL
|
|
|
|
- Move WebSocket registry to Redis
|
|
|
|
- Move WebSocket registry to Redis
|
|
|
|
- Use distributed locking for queue operations
|
|
|
|
- Use distributed locking for queue operations
|
|
|
|
|