Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f10414498 | |||
| 1e3926b206 | |||
| 5fde69fcf5 | |||
| a562cfe9aa | |||
| 8549746721 | |||
| 63fc370262 | |||
| 6362441dd5 | |||
| 76f9e87b44 | |||
| 8c461de72a | |||
| d11f11be69 | |||
| 05d11975e6 | |||
| cd3480c0ce | |||
| 712c98d817 | |||
| ff7ace9f4f | |||
| 73500751a0 | |||
| 82a9df134b | |||
| 67fa79796b | |||
| f06d945358 | |||
| f5883d4929 | |||
| 80cf3eaa39 | |||
| 1ab7e52167 | |||
| 544c168b82 | |||
| 747a14ebd3 | |||
| 49d66c07ee | |||
| be791ed044 | |||
| 7195a09562 | |||
| 720de6688b | |||
| 3e06bdf8cd | |||
| ca1c136d4f | |||
| a04f2c9b25 | |||
| 743b169989 | |||
| 794cb7268e | |||
| d310d101ed | |||
| 96f24eb3b7 | |||
| abcb9bfded | |||
| e5920b207f | |||
| d3483f3be7 | |||
| 252cc50aa4 | |||
| 57908e2b9e | |||
| e2757768c7 | |||
| 2469c3e3f4 | |||
| 6c8c333c6a | |||
| 5dfe0b1216 | |||
| 77beef787f | |||
| 235a866ec8 | |||
| f1d9de2a92 | |||
| 9d0e31ec9a | |||
| 42c3eebf18 | |||
| f295e1c90d | |||
| c5e8281440 | |||
| f22dd0d1f6 | |||
| 5159a83475 | |||
| ccc3b6ffec | |||
| 4ec7d734b8 | |||
| 2e85fae57a | |||
| aeacadbe68 | |||
| 3ef35a8c43 | |||
| 0f3c02e52d | |||
| 9fd60bcfed | |||
| af58e1bf2a | |||
| 2d04402284 | |||
| 0310f10e5d |
+43
-1
@@ -460,6 +460,21 @@ When a browser opens `GET /api/dashboard/stream`:
|
|||||||
|
|
||||||
The browser's native `EventSource` API handles reconnection automatically on network interruption.
|
The browser's native `EventSource` API handles reconnection automatically on network interruption.
|
||||||
|
|
||||||
|
**SSE Payload Structure**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
user: string, // Username
|
||||||
|
isAdmin: boolean, // Admin flag
|
||||||
|
downloads: DownloadObject[], // Matched download objects (see Section 5.4)
|
||||||
|
downloadClients: { // Configured download clients for ordering/filtering
|
||||||
|
id: string, // Instance identifier
|
||||||
|
name: string, // Instance display name
|
||||||
|
type: string // Client type ('sabnzbd', 'qbittorrent', 'transmission', 'rtorrent')
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### 5.4 Download Matching Pipeline
|
### 5.4 Download Matching Pipeline
|
||||||
|
|
||||||
For each connected user the server:
|
For each connected user the server:
|
||||||
@@ -495,6 +510,14 @@ Users are matched to downloads via Sonarr/Radarr tags:
|
|||||||
1. **Exact match** — tag label (lowercased) === username (lowercased).
|
1. **Exact match** — tag label (lowercased) === username (lowercased).
|
||||||
2. **Sanitised match** — handles Ombi tag mangling: `sanitizeTagLabel()` converts to lowercase, replaces non-alphanumeric chars with hyphens, collapses runs, trims.
|
2. **Sanitised match** — handles Ombi tag mangling: `sanitizeTagLabel()` converts to lowercase, replaces non-alphanumeric chars with hyphens, collapses runs, trims.
|
||||||
|
|
||||||
|
#### Client ordering and filtering
|
||||||
|
|
||||||
|
Matched download objects include `client`, `instanceId`, and `instanceName` fields. The frontend:
|
||||||
|
1. Receives a `downloadClients` array from the SSE payload with all configured clients in configuration order
|
||||||
|
2. Displays a multi-select filter allowing users to choose which clients to view
|
||||||
|
3. Sorts downloads by client order (downloads from the first configured client appear first)
|
||||||
|
4. Filters downloads to show only those from selected client instances
|
||||||
|
|
||||||
#### Matched download object fields
|
#### Matched download object fields
|
||||||
|
|
||||||
| Field | Type | Description |
|
| Field | Type | Description |
|
||||||
@@ -523,6 +546,9 @@ Users are matched to downloads via Sonarr/Radarr tags:
|
|||||||
| `arrInstanceKey` | string/null | (Admin) API key for the *arr instance |
|
| `arrInstanceKey` | string/null | (Admin) API key for the *arr instance |
|
||||||
| `arrContentId` | number/null | (Admin) `episodeId` or `movieId` for triggering a new search |
|
| `arrContentId` | number/null | (Admin) `episodeId` or `movieId` for triggering a new search |
|
||||||
| `arrContentType` | `'episode'`/`'movie'`/null | (Admin) Content type for search command |
|
| `arrContentType` | `'episode'`/`'movie'`/null | (Admin) Content type for search command |
|
||||||
|
| `client` | string | Download client type ('sabnzbd', 'qbittorrent', 'transmission', 'rtorrent') |
|
||||||
|
| `instanceId` | string | Instance identifier matching the configured client ID |
|
||||||
|
| `instanceName` | string | Instance display name from configuration |
|
||||||
| `addedOn` | number/null | (qBittorrent) Unix timestamp when torrent was added |
|
| `addedOn` | number/null | (qBittorrent) Unix timestamp when torrent was added |
|
||||||
| `availableForUpgrade` | boolean/undefined | (History) `true` when outcome is `failed` but content is on disk |
|
| `availableForUpgrade` | boolean/undefined | (History) `true` when outcome is `failed` but content is on disk |
|
||||||
|
|
||||||
@@ -683,7 +709,7 @@ stateDiagram-v2
|
|||||||
| `handleLogin()` | Authenticate, fade login → splash → dashboard |
|
| `handleLogin()` | Authenticate, fade login → splash → dashboard |
|
||||||
| `startSSE()` | Open `EventSource` to `/stream`; handle incoming data |
|
| `startSSE()` | Open `EventSource` to `/stream`; handle incoming data |
|
||||||
| `stopSSE()` | Close `EventSource` and cancel reconnect timer |
|
| `stopSSE()` | Close `EventSource` and cancel reconnect timer |
|
||||||
| `renderDownloads()` | Diff-based card rendering (create/update/remove) |
|
| `renderDownloads()` | Diff-based card rendering (create/update/remove); filters by selected download clients; sorts by client order |
|
||||||
| `createDownloadCard()` | Build DOM for a single card; renders tag badges, import-issue badge, blocklist button |
|
| `createDownloadCard()` | Build DOM for a single card; renders tag badges, import-issue badge, blocklist button |
|
||||||
| `updateDownloadCard()` | Update existing card in-place (progress, speed, etc.) |
|
| `updateDownloadCard()` | Update existing card in-place (progress, speed, etc.) |
|
||||||
| `handleBlocklistSearch()` | Confirm dialog → POST `/blocklist-search` → update button state |
|
| `handleBlocklistSearch()` | Confirm dialog → POST `/blocklist-search` → update button state |
|
||||||
@@ -698,6 +724,22 @@ stateDiagram-v2
|
|||||||
- **Regular user view** — a single accent-coloured badge showing the tag label that matched the current user's username (via `matchedUserTag`).
|
- **Regular user view** — a single accent-coloured badge showing the tag label that matched the current user's username (via `matchedUserTag`).
|
||||||
- **Admin `showAll` view** — all tags on the download are rendered using `tagBadges[]`: tags with no matching Emby user → amber badge (leftmost); tags matched to a known Emby user → accent badge showing the Emby display name (rightmost).
|
- **Admin `showAll` view** — all tags on the download are rendered using `tagBadges[]`: tags with no matching Emby user → amber badge (leftmost); tags matched to a known Emby user → accent badge showing the Emby display name (rightmost).
|
||||||
|
|
||||||
|
#### Download Client Filter
|
||||||
|
|
||||||
|
The Active Downloads tab includes a multi-select dropdown filter that allows users to:
|
||||||
|
- View all download clients with their type displayed as "Client Name (type)"
|
||||||
|
- Select multiple clients to filter the downloads list
|
||||||
|
- Use "Select All" / "Deselect All" buttons for bulk operations
|
||||||
|
- Persist selection across sessions via localStorage
|
||||||
|
|
||||||
|
Downloads are sorted by client order (matching the configuration order) and filtered by the selected client IDs.
|
||||||
|
|
||||||
|
Related functions:
|
||||||
|
- `initDownloadClientFilter()` — Sets up dropdown toggle, click-outside handler, Select/Deselect All buttons
|
||||||
|
- `updateDownloadClientFilter()` — Populates checkbox list with client name + type badges
|
||||||
|
- `toggleClientSelection()` — Updates selection array and localStorage
|
||||||
|
- `updateSelectedCountDisplay()` — Updates button text to show "All clients" / "1 selected" / "N selected"
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 8. Directory Structure
|
## 8. Directory Structure
|
||||||
|
|||||||
@@ -6,6 +6,59 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## [1.5.5] - 2026-05-20
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- **Download client logos** — Added SVG logos for all supported download clients (SABnzbd, qBittorrent, Transmission, rTorrent, Deluge). Logos appear in the download client filter picker and on download cards.
|
||||||
|
- **Download client logo in filter picker** — Multi-select download client filter now displays client logos alongside names for visual identification.
|
||||||
|
- **Download client logo in download cards** — Download cards now display the client logo in the bottom-right corner (32×32px). Positioned absolutely within the card.
|
||||||
|
- **SABnzbd speed display** — SABnzbd downloads now display the overall queue speed for the currently active download only. Speed is fetched from the client status API and applied to the downloading slot.
|
||||||
|
- **Speed formatting** — Speed values are now formatted with appropriate units (B/s, KB/s, MB/s, GB/s) instead of raw bytes.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Missing pieces display for SABnzbd** — Removed incorrect "missing x of y" text display for SABnzbd downloads. This information is only relevant for torrent clients (qBittorrent, rTorrent) and is now only shown for those clients.
|
||||||
|
- **Logo duplication on page reload** — Fixed download client logos and user tags appearing twice during page load. Updated `updateDownloadCard()` to remove old elements before adding new ones.
|
||||||
|
- **Logo positioning** — Fixed download client logos appearing stacked at bottom-right of browser window instead of bottom-right of each card. Added `position: relative` to `.download-card` to provide proper positioning context.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.5.4] - 2026-05-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- **Multi-select download client filter** — Active Downloads tab now includes a dropdown filter that allows users to select multiple download clients. Shows client name and type (e.g., "Main (qbitt)"). Includes Select All / Deselect All buttons. Selection persists across sessions via localStorage.
|
||||||
|
- **Download client ordering** — Downloads are now sorted by client order (matching the configuration order). Downloads from the first configured client appear first.
|
||||||
|
- **Client metadata in downloads** — Download objects now include `client`, `instanceId`, and `instanceName` fields for client identification and filtering.
|
||||||
|
- **SSE payload extension** — SSE stream now includes `downloadClients` array with all configured clients for UI ordering/filtering.
|
||||||
|
- **Automatic migration** — Existing single-select filter selection automatically migrates to new multi-select format on first load.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **SABnzbd size and speed display** — Fixed SABnzbd downloads showing undefined size and speed values. Now correctly uses `slot.mb` for size calculation and `slot.kbpersec` for per-slot speed from cached data.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.5.3] - 2026-05-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Status panel rendering regression** — the status panel was rendering as a small blank box due to an undefined `--background` CSS variable. Added the missing variable to all three themes (light, dark, mono).
|
||||||
|
- **Status panel content destruction** — `showDashboard()` was calling `sp.innerHTML = ''` which destroyed the `status-content` div inside the status panel. Removed this destructive line.
|
||||||
|
- **Webhooks panel visibility sync** — the webhooks panel was incorrectly visible on app load. Added explicit hiding of `webhooks-section` in `showDashboard()` to keep it in sync with the status panel (both show/hide together via `toggleStatusPanel()`).
|
||||||
|
- **Webhooks panel DOM structure** — reverted webhooks-section to be a sibling of status-panel (not nested inside it), preventing innerHTML operations from affecting webhook elements.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.5.2] - 2026-05-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Status panel close button CSP compliance** — replaced inline `onclick` handler with `addEventListener` to comply with CSP nonce policy.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [1.5.1] - 2026-05-19
|
## [1.5.1] - 2026-05-19
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
**sofarr** is a personal media download dashboard that aggregates and displays real-time download progress from all your media automation services. Named for the experience of checking what has downloaded "so far" while you wait comfortably on your "sofa" for Sonarr, Radarr, and your download clients to do their thing!
|
**sofarr** is a personal media download dashboard that aggregates and displays real-time download progress from all your media automation services. Named for the experience of checking what has downloaded "so far" while you wait comfortably on your "sofa" for Sonarr, Radarr, and your download clients to do their thing!
|
||||||
|
|
||||||
Version 1.4.x adds **real-time webhook integration**: Sonarr and Radarr can push events directly to sofarr, eliminating polling latency and automatically reducing background API calls when webhooks are active.
|
Version 1.5.x adds **real-time webhook integration**: Sonarr and Radarr can push events directly to sofarr, eliminating polling latency and automatically reducing background API calls when webhooks are active.
|
||||||
|
|
||||||
## What It Does
|
## What It Does
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -44,13 +44,17 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# Persistent volume for token store and log file
|
# Persistent volume for token store and log file
|
||||||
- sofarr-data:/app/data
|
- sofarr-data:/app/data
|
||||||
|
# Mount code for development (comment out in production)
|
||||||
|
- ./server:/app/server
|
||||||
|
- ./public:/app/public
|
||||||
# Mount your own TLS certificate and key (optional — snakeoil used if omitted)
|
# Mount your own TLS certificate and key (optional — snakeoil used if omitted)
|
||||||
# - /path/to/your/server.crt:/app/certs/server.crt:ro
|
# - /path/to/your/server.crt:/app/certs/server.crt:ro
|
||||||
# - /path/to/your/server.key:/app/certs/server.key:ro
|
# - /path/to/your/server.key:/app/certs/server.key:ro
|
||||||
# Run as the built-in non-root 'node' user (UID/GID 1000)
|
# Run as the built-in non-root 'node' user (UID/GID 1000)
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
# Read-only root filesystem; only the data volume is writable
|
# Read-only root filesystem; only the data volume is writable
|
||||||
read_only: true
|
# Comment out for development when mounting code volumes
|
||||||
|
# read_only: true
|
||||||
tmpfs:
|
tmpfs:
|
||||||
- /tmp # Node.js needs a writable /tmp
|
- /tmp # Node.js needs a writable /tmp
|
||||||
security_opt:
|
security_opt:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sofarr",
|
"name": "sofarr",
|
||||||
"version": "1.5.2",
|
"version": "1.5.5",
|
||||||
"description": "A personal media download dashboard that shows your downloads 'so far' while you relax on the sofa waiting for your *arr services to finish",
|
"description": "A personal media download dashboard that shows your downloads 'so far' while you relax on the sofa waiting for your *arr services to finish",
|
||||||
"main": "server/index.js",
|
"main": "server/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+1875
-48
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 512 512"><path d="m256.1 2.6 142 217.2c91 139.2-4.7 289.6-142.1 289.6S22.8 358.9 113.9 219.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#4c90e8;stroke:#094491;stroke-width:3.1904"/><path d="M306.7 255.2c-77.6-31.7-118.4 49.2-105.4 87C229.5 424.4 335.8 445 414.2 308c0 0 .8 16.5 1.7 24.4 10.5 99.9-73.5 163.4-158.6 162.2s-111.1-34.3-136.2-72.3C80.4 360.6 90.5 260 145.2 212.9c62.5-51.6 131.2-24 161.5 42.3" style="fill-rule:evenodd;clip-rule:evenodd;fill:#094491"/><path d="M257.9 225.3c-87 2.1-103.5 102.3-79.4 145.3 33.5 59.7 84.3 71.2 153.8 49.1-39.7 43.2-121.2 54.6-176.5-7.1-38.1-42.4-41.4-101.6-15-151.1 26.5-49.4 79.2-63.2 117.1-36.2" style="fill-rule:evenodd;clip-rule:evenodd;fill:#83b8f9"/></svg>
|
||||||
|
After Width: | Height: | Size: 786 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg height="1024" viewBox="0 0 1024 1024" width="1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="348.2829" x2="782.05951" y1="0" y2="786.48322"><stop offset="0" stop-color="#72b4f5"/><stop offset="1" stop-color="#356ebf"/></linearGradient><g fill="none" fill-rule="evenodd" transform="matrix(.97656268 0 0 .9765624 11.999908 12.000051)"><circle cx="512" cy="512" fill="url(#a)" r="496" stroke="#daefff" stroke-width="32"/><path d="m712.898 332.399q66.657 0 103.38 45.671 37.03 45.364 37.03 128.684 0 83.32-37.34 129.61-37.03 45.98-103.07 45.98-33.02 0-60.484-12.035-27.156-12.344-45.672-37.649h-3.703l-10.8 43.512h-36.724v-480.172h51.227v116.65q0 39.191-2.469 70.359h2.47q35.796-50.61 106.155-50.61zm-7.406 42.894q-52.46 0-75.605 30.242-23.145 29.934-23.145 101.219 0 71.285 23.762 102.145 23.761 30.55 76.222 30.55 47.215 0 70.36-34.254 23.144-34.562 23.144-99.058 0-66.04-23.144-98.442-23.145-32.402-71.594-32.402z" fill="#fff"/><path d="m317.273 639.45q51.227 0 74.68-27.466 23.453-27.464 24.996-92.578v-11.418q0-70.976-24.07-102.144-24.07-31.168-76.223-31.168-45.055 0-69.125 35.18-23.762 34.87-23.762 98.75 0 63.879 23.454 97.515 23.761 33.328 70.05 33.328zm-7.715 42.894q-65.421 0-102.144-45.98-36.723-45.981-36.723-128.376 0-83.011 37.032-129.609 37.03-46.598 103.07-46.598 69.433 0 106.773 52.461h2.778l7.406-46.289h40.426v490.047h-51.227v-144.73q0-30.86 3.395-52.461h-4.012q-35.488 51.535-106.774 51.535z" fill="#c8e8ff"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path fill="#f5f5f5000" stroke="#f5f5f5" stroke-linejoin="round" stroke-width="74" d="M200.4 39.3h598.1v437.8h161l-460.1 483L39.4 477h161z"/><path fill="#ffb300" fill-rule="evenodd" d="M200.4 39.3h598.1v437.8h161l-460.1 483-460-483h161z"/><path fill="#ffca28" fill-rule="evenodd" d="M499.4 960.2 201.1 39.4h596.7z"/><path fill="#f5f5f5000" stroke="#f5f5f5" stroke-linecap="round" stroke-linejoin="round" stroke-width="74" d="M329.2 843.5H83v-51.8h146.1v-45.9H83V596.9h246.2v51.5H183.1v45.9h146.1zm292.2 0H375.2V694.3h146.1v-45.9H375.2v-51.5h246.2zm-146.1-97.8h46v46h-46zm192.1 97.8v-344h100.1v97.4h146.1v246.6zm100.1-195.2h46v143.4h-46z"/><path fill="#0f0f0f" fill-rule="evenodd" d="M329.2 843.5H83v-51.8h146.1v-45.9H83V596.9h246.2v51.5H183.1v45.9h146.1zm292.2 0H375.2V694.3h146.1v-45.9H375.2v-51.5h246.2zm-146.1-51.8h46v-46h-46zm192.1 51.9v-344h100.1V597h146.1v246.6zm100.1-51.9h46V648.4h-46z"/></svg>
|
||||||
|
After Width: | Height: | Size: 966 B |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 7.8 KiB |
+204
-10
@@ -1,14 +1,208 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Media Download Dashboard</title>
|
<title>sofarr - Your Downloads Dashboard</title>
|
||||||
<script type="module" crossorigin src="app.js"></script>
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32.png">
|
||||||
|
<link rel="apple-touch-icon" sizes="192x192" href="favicon-192.png">
|
||||||
|
<meta name="theme-color" content="#1a1a2e">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<!-- Splash Screen -->
|
||||||
|
<div id="splash-screen" class="splash-screen">
|
||||||
</body>
|
<img src="images/sofarr-flashscreen.png" alt="sofarr" class="splash-logo">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="app">
|
||||||
|
<!-- Login Form -->
|
||||||
|
<div id="login-container" class="login-container" style="display: none;">
|
||||||
|
<div class="login-box">
|
||||||
|
<img src="images/sofarr-flashscreen.png" alt="sofarr" class="login-logo">
|
||||||
|
<p class="login-subtitle">Login with your Emby credentials</p>
|
||||||
|
<form id="login-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="username">Username:</label>
|
||||||
|
<input type="text" id="username" name="username" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">Password:</label>
|
||||||
|
<input type="password" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group form-group--checkbox">
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" id="remember-me" name="rememberMe">
|
||||||
|
<span>Keep me logged in</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="login-btn">Login</button>
|
||||||
|
</form>
|
||||||
|
<div id="login-error" class="error-message" style="display: none;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Dashboard -->
|
||||||
|
<div id="dashboard-container" class="dashboard-container" style="display: none;">
|
||||||
|
<header class="app-header">
|
||||||
|
<h1><a href="#" class="title-link" id="title-home-link"><img src="favicon-192.png" alt="" class="title-logo">sofarr</a></h1>
|
||||||
|
<div class="header-controls">
|
||||||
|
<div class="theme-switcher">
|
||||||
|
<button class="theme-btn active" data-theme="light">Light</button>
|
||||||
|
<button class="theme-btn" data-theme="dark">Dark</button>
|
||||||
|
<button class="theme-btn" data-theme="mono">Mono</button>
|
||||||
|
</div>
|
||||||
|
<div id="admin-controls" class="admin-controls" style="display: none;">
|
||||||
|
<label class="toggle-label">
|
||||||
|
<input type="checkbox" id="show-all-toggle">
|
||||||
|
<span>Show all users</span>
|
||||||
|
</label>
|
||||||
|
<button id="status-btn" class="status-btn">Status</button>
|
||||||
|
</div>
|
||||||
|
<div class="user-info">
|
||||||
|
<span class="user-label">Current User:</span>
|
||||||
|
<span class="user-name" id="currentUser">-</span>
|
||||||
|
<button id="logout-btn" class="logout-btn">Logout</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div id="status-panel" class="status-panel" style="display: none;">
|
||||||
|
<!-- Status content gets rendered here -->
|
||||||
|
<div id="status-content"><p class="status-loading">Loading status...</p></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Webhooks Configuration Panel (sibling to status-panel) -->
|
||||||
|
<div class="webhooks-section" id="webhooks-section" style="display: none;">
|
||||||
|
<div class="webhooks-header" id="webhooks-header">
|
||||||
|
<h2>⚡ Webhooks Configuration</h2>
|
||||||
|
<span class="webhooks-toggle" id="webhooks-toggle">▼</span>
|
||||||
|
</div>
|
||||||
|
<div class="webhooks-content" id="webhooks-content" style="display: none;">
|
||||||
|
<div id="webhook-loading" class="webhook-loading" style="display: none;">Loading webhook status...</div>
|
||||||
|
|
||||||
|
<!-- Sonarr Webhook -->
|
||||||
|
<div class="webhook-instance">
|
||||||
|
<h3>Sonarr</h3>
|
||||||
|
<div class="webhook-status">
|
||||||
|
<span class="status-indicator" id="sonarr-status">○ Disabled</span>
|
||||||
|
<button id="enable-sonarr-webhook" class="enable-webhook-btn" style="display: none;">Enable Sofarr Webhooks</button>
|
||||||
|
<button id="test-sonarr-webhook" class="test-webhook-btn" style="display: none;">Test</button>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-triggers" id="sonarr-triggers" style="display: none;">
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Grab</span><span class="trigger-value" id="sonarr-onGrab">✗</span></div>
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Download</span><span class="trigger-value" id="sonarr-onDownload">✗</span></div>
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Import</span><span class="trigger-value" id="sonarr-onImport">✗</span></div>
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Upgrade</span><span class="trigger-value" id="sonarr-onUpgrade">✗</span></div>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-stats" id="sonarr-stats" style="display: none;">
|
||||||
|
<div class="webhook-stats-title">Statistics</div>
|
||||||
|
<div class="webhook-stats-grid">
|
||||||
|
<div class="webhook-stat"><span class="webhook-stat-label">Events Received</span><span class="webhook-stat-value" id="sonarr-events">0</span></div>
|
||||||
|
<div class="webhook-stat"><span class="webhook-stat-label">Polls Skipped</span><span class="webhook-stat-value" id="sonarr-polls">0</span></div>
|
||||||
|
<div class="webhook-stat"><span class="webhook-stat-label">Last Event</span><span class="webhook-stat-value" id="sonarr-last">Never</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Radarr Webhook -->
|
||||||
|
<div class="webhook-instance">
|
||||||
|
<h3>Radarr</h3>
|
||||||
|
<div class="webhook-status">
|
||||||
|
<span class="status-indicator" id="radarr-status">○ Disabled</span>
|
||||||
|
<button id="enable-radarr-webhook" class="enable-webhook-btn" style="display: none;">Enable Sofarr Webhooks</button>
|
||||||
|
<button id="test-radarr-webhook" class="test-webhook-btn" style="display: none;">Test</button>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-triggers" id="radarr-triggers" style="display: none;">
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Grab</span><span class="trigger-value" id="radarr-onGrab">✗</span></div>
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Download</span><span class="trigger-value" id="radarr-onDownload">✗</span></div>
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Import</span><span class="trigger-value" id="radarr-onImport">✗</span></div>
|
||||||
|
<div class="trigger-item"><span class="trigger-label">On Upgrade</span><span class="trigger-value" id="radarr-onUpgrade">✗</span></div>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-stats" id="radarr-stats" style="display: none;">
|
||||||
|
<div class="webhook-stats-title">Statistics</div>
|
||||||
|
<div class="webhook-stats-grid">
|
||||||
|
<div class="webhook-stat"><span class="webhook-stat-label">Events Received</span><span class="webhook-stat-value" id="radarr-events">0</span></div>
|
||||||
|
<div class="webhook-stat"><span class="webhook-stat-label">Polls Skipped</span><span class="webhook-stat-value" id="radarr-polls">0</span></div>
|
||||||
|
<div class="webhook-stat"><span class="webhook-stat-label">Last Event</span><span class="webhook-stat-value" id="radarr-last">Never</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="error-message" class="error-message" style="display: none;"></div>
|
||||||
|
|
||||||
|
<div id="loading" class="loading" style="display: none;">Loading downloads...</div>
|
||||||
|
|
||||||
|
<div class="main-tabs">
|
||||||
|
<div class="tab-bar">
|
||||||
|
<button class="tab-btn active" data-tab="downloads">Active Downloads</button>
|
||||||
|
<button class="tab-btn" data-tab="history">Recently Completed</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-panel" id="tab-downloads">
|
||||||
|
<div class="downloads-container">
|
||||||
|
<div class="downloads-header">
|
||||||
|
<div class="downloads-controls">
|
||||||
|
<label class="download-client-label" for="download-client-filter">Download client:</label>
|
||||||
|
<div class="download-client-filter" id="download-client-filter">
|
||||||
|
<button class="download-client-dropdown-btn" id="download-client-dropdown-btn" type="button" aria-expanded="false">
|
||||||
|
<span id="download-client-selected-text">All clients</span>
|
||||||
|
<span class="dropdown-arrow">▼</span>
|
||||||
|
</button>
|
||||||
|
<div class="download-client-dropdown" id="download-client-dropdown">
|
||||||
|
<div class="download-client-dropdown-header">
|
||||||
|
<button class="download-client-dropdown-btn-small" id="download-client-select-all" type="button">Select All</button>
|
||||||
|
<button class="download-client-dropdown-btn-small" id="download-client-deselect-all" type="button">Deselect All</button>
|
||||||
|
</div>
|
||||||
|
<div class="download-client-options" id="download-client-options">
|
||||||
|
<!-- Options will be populated by JavaScript -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="no-downloads" class="no-downloads" style="display: none;">
|
||||||
|
<p>No downloads found for your user.</p>
|
||||||
|
<p>Make sure your shows and movies are tagged with your username in Sonarr/Radarr.</p>
|
||||||
|
</div>
|
||||||
|
<div id="downloads-list" class="downloads-list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-panel" id="tab-history" style="display: none;">
|
||||||
|
<div class="history-container" id="history-container">
|
||||||
|
<div class="history-header">
|
||||||
|
<div class="history-controls">
|
||||||
|
<label class="history-days-label" for="history-days">Last</label>
|
||||||
|
<input type="number" id="history-days" class="history-days-input" value="7" min="1" max="90">
|
||||||
|
<span class="history-days-label">days</span>
|
||||||
|
<button id="history-refresh-btn" class="history-refresh-btn" title="Refresh history">↻</button>
|
||||||
|
<label class="history-toggle-label" id="ignore-available-label" data-tooltip="Hide failed downloads where the item is already available on disk (i.e. a failed upgrade attempt)">
|
||||||
|
<input type="checkbox" id="ignore-available-toggle">
|
||||||
|
<span>Hide upgrade failures</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="history-loading" class="history-loading" style="display: none;">Loading history...</div>
|
||||||
|
<div id="history-error" class="history-error" style="display: none;"></div>
|
||||||
|
<div id="no-history" class="no-history" style="display: none;">
|
||||||
|
<p>No completed downloads found in this period.</p>
|
||||||
|
</div>
|
||||||
|
<div id="history-list" class="history-list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="app-footer">
|
||||||
|
<p>Ensure your media is tagged with your username in Sonarr/Radarr to match downloads to users.</p>
|
||||||
|
<a href="https://git.i3omb.com/Gandalf/sofarr" target="_blank" rel="noopener noreferrer" class="app-version" id="app-version"></a>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="app.js"></script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+2005
-1
File diff suppressed because one or more lines are too long
@@ -38,9 +38,10 @@ class PollingRadarrRetriever extends ArrRetriever {
|
|||||||
*/
|
*/
|
||||||
async getQueue() {
|
async getQueue() {
|
||||||
try {
|
try {
|
||||||
|
// Fetch with large page size to get all items (Radarr has pagination)
|
||||||
const response = await axios.get(`${this.url}/api/v3/queue`, {
|
const response = await axios.get(`${this.url}/api/v3/queue`, {
|
||||||
headers: { 'X-Api-Key': this.apiKey },
|
headers: { 'X-Api-Key': this.apiKey },
|
||||||
params: { includeMovie: true }
|
params: { includeMovie: true, pageSize: 1000 }
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -61,7 +62,7 @@ class PollingRadarrRetriever extends ArrRetriever {
|
|||||||
*/
|
*/
|
||||||
async getHistory(options = {}) {
|
async getHistory(options = {}) {
|
||||||
const {
|
const {
|
||||||
pageSize = 10,
|
pageSize = 100,
|
||||||
sortKey,
|
sortKey,
|
||||||
sortDir,
|
sortDir,
|
||||||
includeMovie = true,
|
includeMovie = true,
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ class PollingSonarrRetriever extends ArrRetriever {
|
|||||||
*/
|
*/
|
||||||
async getQueue() {
|
async getQueue() {
|
||||||
try {
|
try {
|
||||||
|
// Fetch with large page size to get all items (Sonarr has pagination)
|
||||||
const response = await axios.get(`${this.url}/api/v3/queue`, {
|
const response = await axios.get(`${this.url}/api/v3/queue`, {
|
||||||
headers: { 'X-Api-Key': this.apiKey },
|
headers: { 'X-Api-Key': this.apiKey },
|
||||||
params: { includeSeries: true, includeEpisode: true }
|
params: { includeSeries: true, includeEpisode: true, pageSize: 1000 }
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -62,7 +63,7 @@ class PollingSonarrRetriever extends ArrRetriever {
|
|||||||
*/
|
*/
|
||||||
async getHistory(options = {}) {
|
async getHistory(options = {}) {
|
||||||
const {
|
const {
|
||||||
pageSize = 10,
|
pageSize = 100,
|
||||||
sortKey,
|
sortKey,
|
||||||
sortDir,
|
sortDir,
|
||||||
includeSeries = true,
|
includeSeries = true,
|
||||||
|
|||||||
@@ -45,9 +45,10 @@ class SABnzbdClient extends DownloadClient {
|
|||||||
async getActiveDownloads() {
|
async getActiveDownloads() {
|
||||||
try {
|
try {
|
||||||
// Get both queue and history to provide complete picture
|
// Get both queue and history to provide complete picture
|
||||||
const [queueResponse, historyResponse] = await Promise.all([
|
const [queueResponse, historyResponse, clientStatus] = await Promise.all([
|
||||||
this.makeRequest({ mode: 'queue' }),
|
this.makeRequest({ mode: 'queue' }),
|
||||||
this.makeRequest({ mode: 'history', limit: 10 })
|
this.makeRequest({ mode: 'history', limit: 10 }),
|
||||||
|
this.getClientStatus()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const queueData = queueResponse.data;
|
const queueData = queueResponse.data;
|
||||||
@@ -57,15 +58,23 @@ class SABnzbdClient extends DownloadClient {
|
|||||||
|
|
||||||
// Process active queue items
|
// Process active queue items
|
||||||
if (queueData.queue && queueData.queue.slots) {
|
if (queueData.queue && queueData.queue.slots) {
|
||||||
|
// Find the currently downloading slot (first one with status 'Downloading')
|
||||||
|
const activeSlot = queueData.queue.slots.find(slot => slot.status === 'Downloading');
|
||||||
|
const activeSpeed = activeSlot && clientStatus ? (clientStatus.kbpersec ? clientStatus.kbpersec * 1024 : 0) : 0;
|
||||||
|
|
||||||
|
logToFile(`[SABnzbd:${this.name}] Active slot: ${activeSlot ? activeSlot.nzo_id : 'none'}, Speed: ${activeSpeed}, Client status: ${clientStatus ? JSON.stringify({ kbpersec: clientStatus.kbpersec }) : 'none'}`);
|
||||||
|
|
||||||
for (const slot of queueData.queue.slots) {
|
for (const slot of queueData.queue.slots) {
|
||||||
downloads.push(this.normalizeDownload(slot, 'queue'));
|
const slotSpeed = activeSlot === slot ? activeSpeed : 0;
|
||||||
|
logToFile(`[SABnzbd:${this.name}] Slot ${slot.nzo_id} status ${slot.status}, speed ${slotSpeed}`);
|
||||||
|
downloads.push(this.normalizeDownload(slot, 'queue', slotSpeed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process recent history items (last 10)
|
// Process recent history items (last 10)
|
||||||
if (historyData.history && historyData.history.slots) {
|
if (historyData.history && historyData.history.slots) {
|
||||||
for (const slot of historyData.history.slots) {
|
for (const slot of historyData.history.slots) {
|
||||||
downloads.push(this.normalizeDownload(slot, 'history'));
|
downloads.push(this.normalizeDownload(slot, 'history', 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,9 +111,9 @@ class SABnzbdClient extends DownloadClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizeDownload(slot, source) {
|
normalizeDownload(slot, source, speed = 0) {
|
||||||
const isHistory = source === 'history';
|
const isHistory = source === 'history';
|
||||||
|
|
||||||
// Map SABnzbd statuses to normalized status
|
// Map SABnzbd statuses to normalized status
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
'Downloading': 'Downloading',
|
'Downloading': 'Downloading',
|
||||||
@@ -164,10 +173,10 @@ class SABnzbdClient extends DownloadClient {
|
|||||||
progress: Math.round(progress),
|
progress: Math.round(progress),
|
||||||
size: Math.round(size),
|
size: Math.round(size),
|
||||||
downloaded: Math.round(downloaded),
|
downloaded: Math.round(downloaded),
|
||||||
speed: slot.kbpersec ? slot.kbpersec * 1024 : 0, // Convert KB/s to bytes/s
|
speed: speed,
|
||||||
eta: this.calculateEta(slot.timeleft || slot.eta),
|
eta: this.calculateEta(slot.timeleft || slot.eta),
|
||||||
category: slot.cat || undefined,
|
category: slot.cat || undefined,
|
||||||
tags: slot.labels ? slot.labels.split(',').filter(tag => tag.trim()) : [],
|
tags: slot.labels ? (Array.isArray(slot.labels) ? slot.labels : slot.labels.split(',')).filter(tag => tag && tag.trim()) : [],
|
||||||
savePath: slot.final_name || undefined,
|
savePath: slot.final_name || undefined,
|
||||||
addedOn: slot.added ? new Date(slot.added * 1000).toISOString() : undefined,
|
addedOn: slot.added ? new Date(slot.added * 1000).toISOString() : undefined,
|
||||||
arrQueueId: arrInfo.queueId,
|
arrQueueId: arrInfo.queueId,
|
||||||
|
|||||||
+187
-15
@@ -8,6 +8,7 @@ const { mapTorrentToDownload } = require('../utils/qbittorrent');
|
|||||||
const cache = require('../utils/cache');
|
const cache = require('../utils/cache');
|
||||||
const { pollAllServices, getLastPollTimings, onPollComplete, offPollComplete, POLLING_ENABLED } = require('../utils/poller');
|
const { pollAllServices, getLastPollTimings, onPollComplete, offPollComplete, POLLING_ENABLED } = require('../utils/poller');
|
||||||
const { getSonarrInstances, getRadarrInstances } = require('../utils/config');
|
const { getSonarrInstances, getRadarrInstances } = require('../utils/config');
|
||||||
|
const downloadClientRegistry = require('../utils/downloadClients');
|
||||||
const sanitizeError = require('../utils/sanitizeError');
|
const sanitizeError = require('../utils/sanitizeError');
|
||||||
|
|
||||||
|
|
||||||
@@ -772,7 +773,7 @@ router.get('/user-summary', requireAuth, async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Admin-only status page with cache stats
|
// Admin-only status page with cache stats
|
||||||
router.get('/status', requireAuth, (req, res) => {
|
router.get('/status', requireAuth, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const user = req.user;
|
const user = req.user;
|
||||||
if (!user.isAdmin) {
|
if (!user.isAdmin) {
|
||||||
@@ -782,6 +783,69 @@ router.get('/status', requireAuth, (req, res) => {
|
|||||||
const cacheStats = cache.getStats();
|
const cacheStats = cache.getStats();
|
||||||
const uptime = process.uptime();
|
const uptime = process.uptime();
|
||||||
|
|
||||||
|
// Get webhook metrics
|
||||||
|
const { getGlobalWebhookMetrics } = require('../utils/cache');
|
||||||
|
const webhookMetrics = getGlobalWebhookMetrics();
|
||||||
|
|
||||||
|
// Check if Sofarr webhook is configured in Sonarr/Radarr
|
||||||
|
async function checkWebhookConfigured(instance, type) {
|
||||||
|
try {
|
||||||
|
const response = await axios.get(`${instance.url}/api/v3/notification`, {
|
||||||
|
headers: { 'X-Api-Key': instance.apiKey },
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
|
const notifications = response.data || [];
|
||||||
|
return notifications.some(n => n.name === 'Sofarr' && n.implementation === 'Webhook');
|
||||||
|
} catch (err) {
|
||||||
|
console.log(`[Status] Failed to check ${type} webhook config: ${err.message}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check webhook configuration for each service
|
||||||
|
const sonarrInstances = getSonarrInstances();
|
||||||
|
const radarrInstances = getRadarrInstances();
|
||||||
|
|
||||||
|
const sonarrWebhookConfigured = sonarrInstances.length > 0
|
||||||
|
? await checkWebhookConfigured(sonarrInstances[0], 'Sonarr')
|
||||||
|
: false;
|
||||||
|
const radarrWebhookConfigured = radarrInstances.length > 0
|
||||||
|
? await checkWebhookConfigured(radarrInstances[0], 'Radarr')
|
||||||
|
: false;
|
||||||
|
|
||||||
|
// Find Sonarr and Radarr metrics from instances
|
||||||
|
const sonarrMetrics = {};
|
||||||
|
const radarrMetrics = {};
|
||||||
|
for (const [url, metrics] of Object.entries(webhookMetrics.instances || {})) {
|
||||||
|
if (url.includes('sonarr')) {
|
||||||
|
sonarrMetrics[url] = metrics;
|
||||||
|
} else if (url.includes('radarr')) {
|
||||||
|
radarrMetrics[url] = metrics;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate metrics for each service
|
||||||
|
const aggregateMetrics = (metricsMap, configured) => {
|
||||||
|
const values = Object.values(metricsMap);
|
||||||
|
if (values.length === 0) {
|
||||||
|
// Return default metrics if configured but no events yet
|
||||||
|
return configured ? {
|
||||||
|
enabled: true,
|
||||||
|
eventsReceived: 0,
|
||||||
|
pollsSkipped: 0,
|
||||||
|
lastEvent: null
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
enabled: true,
|
||||||
|
eventsReceived: values.reduce((sum, m) => sum + (m.eventsReceived || 0), 0),
|
||||||
|
pollsSkipped: values.reduce((sum, m) => sum + (m.pollsSkipped || 0), 0),
|
||||||
|
lastEvent: values.reduce((latest, m) => {
|
||||||
|
return m.lastWebhookTimestamp > latest ? m.lastWebhookTimestamp : latest;
|
||||||
|
}, 0)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
server: {
|
server: {
|
||||||
uptimeSeconds: Math.floor(uptime),
|
uptimeSeconds: Math.floor(uptime),
|
||||||
@@ -796,7 +860,11 @@ router.get('/status', requireAuth, (req, res) => {
|
|||||||
lastPoll: getLastPollTimings()
|
lastPoll: getLastPollTimings()
|
||||||
},
|
},
|
||||||
cache: cacheStats,
|
cache: cacheStats,
|
||||||
clients: getActiveClients()
|
clients: getActiveClients(),
|
||||||
|
webhooks: {
|
||||||
|
sonarr: aggregateMetrics(sonarrMetrics, sonarrWebhookConfigured),
|
||||||
|
radarr: aggregateMetrics(radarrMetrics, radarrWebhookConfigured)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
res.status(500).json({ error: 'Failed to get status', details: err.message });
|
res.status(500).json({ error: 'Failed to get status', details: err.message });
|
||||||
@@ -879,6 +947,8 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
await pollAllServices();
|
await pollAllServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`[SSE] Building downloads for ${user.name} (showAll=${showAll})`);
|
||||||
|
|
||||||
const sabQueueData = cache.get('poll:sab-queue') || { slots: [] };
|
const sabQueueData = cache.get('poll:sab-queue') || { slots: [] };
|
||||||
const sabHistoryData = cache.get('poll:sab-history') || { slots: [] };
|
const sabHistoryData = cache.get('poll:sab-history') || { slots: [] };
|
||||||
const sonarrTagsResults = cache.get('poll:sonarr-tags') || [];
|
const sonarrTagsResults = cache.get('poll:sonarr-tags') || [];
|
||||||
@@ -889,6 +959,10 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
const radarrTagsData = cache.get('poll:radarr-tags') || [];
|
const radarrTagsData = cache.get('poll:radarr-tags') || [];
|
||||||
const qbittorrentTorrents = cache.get('poll:qbittorrent') || [];
|
const qbittorrentTorrents = cache.get('poll:qbittorrent') || [];
|
||||||
|
|
||||||
|
console.log(`[SSE] Data sizes - SAB queue: ${sabQueueData.slots?.length || 0}, SAB history: ${sabHistoryData.slots?.length || 0}, qBit: ${qbittorrentTorrents.length}`);
|
||||||
|
console.log(`[SSE] Sonarr queue: ${sonarrQueueData.records?.length || 0}, history: ${sonarrHistoryData.records?.length || 0}`);
|
||||||
|
console.log(`[SSE] Radarr queue: ${radarrQueueData.records?.length || 0}, history: ${radarrHistoryData.records?.length || 0}`);
|
||||||
|
|
||||||
const sabnzbdQueue = { data: { queue: sabQueueData } };
|
const sabnzbdQueue = { data: { queue: sabQueueData } };
|
||||||
const sabnzbdHistory = { data: { history: sabHistoryData } };
|
const sabnzbdHistory = { data: { history: sabHistoryData } };
|
||||||
const sonarrQueue = { data: sonarrQueueData };
|
const sonarrQueue = { data: sonarrQueueData };
|
||||||
@@ -930,24 +1004,113 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SABnzbd queue
|
// SABnzbd queue
|
||||||
|
let sabSlotsChecked = 0;
|
||||||
|
let sabSlotsMatched = 0;
|
||||||
if (sabnzbdQueue.data.queue && sabnzbdQueue.data.queue.slots) {
|
if (sabnzbdQueue.data.queue && sabnzbdQueue.data.queue.slots) {
|
||||||
for (const slot of sabnzbdQueue.data.queue.slots) {
|
for (const slot of sabnzbdQueue.data.queue.slots) {
|
||||||
const nzbName = slot.filename || slot.nzbname;
|
const nzbName = slot.filename || slot.nzbname;
|
||||||
if (!nzbName) continue;
|
if (!nzbName) continue;
|
||||||
|
sabSlotsChecked++;
|
||||||
const slotState = getSlotStatusAndSpeed(slot);
|
const slotState = getSlotStatusAndSpeed(slot);
|
||||||
const nzbNameLower = nzbName.toLowerCase();
|
const nzbNameLower = nzbName.toLowerCase();
|
||||||
|
|
||||||
const sonarrMatch = sonarrQueue.data.records.find(r => {
|
// Normalize SAB name (dots to spaces) for better matching
|
||||||
const rTitle = (r.title || r.sourceTitle || '').toLowerCase();
|
const nzbNameNormalized = nzbNameLower.replace(/\./g, ' ');
|
||||||
return rTitle && (rTitle.includes(nzbNameLower) || nzbNameLower.includes(rTitle));
|
|
||||||
});
|
// Try to match by downloadId first (most reliable)
|
||||||
|
const sabDownloadId = slot.nzo_id || slot.id;
|
||||||
|
let sonarrMatch = sabDownloadId ? sonarrQueue.data.records.find(r => r.downloadId === sabDownloadId) : null;
|
||||||
|
let radarrMatch = sabDownloadId ? radarrQueue.data.records.find(r => r.downloadId === sabDownloadId) : null;
|
||||||
|
|
||||||
|
// Also check HISTORY by downloadId
|
||||||
|
if (!sonarrMatch && sabDownloadId) {
|
||||||
|
sonarrMatch = sonarrHistory.data.records.find(r => r.downloadId === sabDownloadId);
|
||||||
|
}
|
||||||
|
if (!radarrMatch && sabDownloadId) {
|
||||||
|
radarrMatch = radarrHistory.data.records.find(r => r.downloadId === sabDownloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback: Check by title matching
|
||||||
|
if (!sonarrMatch) {
|
||||||
|
sonarrMatch = sonarrQueue.data.records.find(r => {
|
||||||
|
const rTitle = (r.title || r.sourceTitle || '').toLowerCase();
|
||||||
|
return rTitle && (
|
||||||
|
rTitle.includes(nzbNameLower) || nzbNameLower.includes(rTitle) ||
|
||||||
|
rTitle.includes(nzbNameNormalized) || nzbNameNormalized.includes(rTitle)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!radarrMatch) {
|
||||||
|
radarrMatch = radarrQueue.data.records.find(r => {
|
||||||
|
const rTitle = (r.title || r.sourceTitle || '').toLowerCase();
|
||||||
|
return rTitle && (
|
||||||
|
rTitle.includes(nzbNameLower) || nzbNameLower.includes(rTitle) ||
|
||||||
|
rTitle.includes(nzbNameNormalized) || nzbNameNormalized.includes(rTitle)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also check HISTORY (completed downloads) if no queue match
|
||||||
|
if (!sonarrMatch) {
|
||||||
|
sonarrMatch = sonarrHistory.data.records.find(r => {
|
||||||
|
const rTitle = (r.title || r.sourceTitle || '').toLowerCase();
|
||||||
|
return rTitle && (
|
||||||
|
rTitle.includes(nzbNameLower) || nzbNameLower.includes(rTitle) ||
|
||||||
|
rTitle.includes(nzbNameNormalized) || nzbNameNormalized.includes(rTitle)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!radarrMatch) {
|
||||||
|
radarrMatch = radarrHistory.data.records.find(r => {
|
||||||
|
const rTitle = (r.title || r.sourceTitle || '').toLowerCase();
|
||||||
|
return rTitle && (
|
||||||
|
rTitle.includes(nzbNameLower) || nzbNameLower.includes(rTitle) ||
|
||||||
|
rTitle.includes(nzbNameNormalized) || nzbNameNormalized.includes(rTitle)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Debug first 5 items - show matches and non-matches
|
||||||
|
if (sabSlotsChecked <= 5) {
|
||||||
|
if (sonarrMatch) {
|
||||||
|
const source = sonarrQueue.data.records.includes(sonarrMatch) ? 'queue' : 'history';
|
||||||
|
const matchType = (sonarrMatch.downloadId === sabDownloadId) ? 'downloadId' : 'title';
|
||||||
|
console.log(`[SSE] ✓ Sonarr ${source} ${matchType} match: SAB:"${nzbNameLower.substring(0, 40)}" → Sonarr:"${(sonarrMatch.title || sonarrMatch.sourceTitle || '').substring(0, 40)}"`);
|
||||||
|
} else if (radarrMatch) {
|
||||||
|
const source = radarrQueue.data.records.includes(radarrMatch) ? 'queue' : 'history';
|
||||||
|
const matchType = (radarrMatch.downloadId === sabDownloadId) ? 'downloadId' : 'title';
|
||||||
|
console.log(`[SSE] ✓ Radarr ${source} ${matchType} match: SAB:"${nzbNameLower.substring(0, 40)}" → Radarr:"${(radarrMatch.title || radarrMatch.sourceTitle || '').substring(0, 40)}"`);
|
||||||
|
} else {
|
||||||
|
console.log(`[SSE] ✗ No match for SAB: "${nzbNameLower.substring(0, 60)}"`);
|
||||||
|
// Show counts
|
||||||
|
console.log(`[SSE] Queue: ${sonarrQueue.data.records.length}, History: ${sonarrHistory.data.records.length}`);
|
||||||
|
// Show Sonarr queue titles
|
||||||
|
if (sonarrQueue.data.records.length > 0) {
|
||||||
|
const queueTitles = sonarrQueue.data.records.slice(0, 3).map(r => (r.title || r.sourceTitle || 'NO_TITLE').substring(0, 40));
|
||||||
|
console.log(`[SSE] Queue titles: ${queueTitles.join(' | ')}`);
|
||||||
|
}
|
||||||
|
// Show history titles if there are any
|
||||||
|
if (sonarrHistory.data.records.length > 0) {
|
||||||
|
const histTitles = sonarrHistory.data.records.slice(0, 3).map(r => {
|
||||||
|
const title = (r.title || r.sourceTitle || 'NO_TITLE').substring(0, 35);
|
||||||
|
const dlId = r.downloadId ? r.downloadId.substring(0, 15) : 'no-dl-id';
|
||||||
|
return `${title}[${dlId}]`;
|
||||||
|
});
|
||||||
|
console.log(`[SSE] History titles: ${histTitles.join(' | ')}`);
|
||||||
|
}
|
||||||
|
// Also check if SAB slots have nzo_id we could use
|
||||||
|
if (slot.nzo_id) {
|
||||||
|
console.log(`[SSE] SAB nzo_id: ${slot.nzo_id.substring(0, 20)}...`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (sonarrMatch && sonarrMatch.seriesId) {
|
if (sonarrMatch && sonarrMatch.seriesId) {
|
||||||
|
sabSlotsMatched++;
|
||||||
const series = seriesMap.get(sonarrMatch.seriesId) || sonarrMatch.series;
|
const series = seriesMap.get(sonarrMatch.seriesId) || sonarrMatch.series;
|
||||||
if (series) {
|
if (series) {
|
||||||
const allTags = extractAllTags(series.tags, sonarrTagMap);
|
const allTags = extractAllTags(series.tags, sonarrTagMap);
|
||||||
const matchedUserTag = extractUserTag(series.tags, sonarrTagMap, username);
|
const matchedUserTag = extractUserTag(series.tags, sonarrTagMap, username);
|
||||||
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
||||||
const dlObj = { type: 'series', title: nzbName, coverArt: getCoverArt(series), status: slotState.status, progress: slot.percentage, mb: slot.mb, mbmissing: slot.mbmissing, size: slot.size, speed: slotState.speed, eta: slot.timeleft, seriesName: series.title, episodes: gatherEpisodes(nzbNameLower, sonarrQueue.data.records), allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined };
|
const dlObj = { type: 'series', title: nzbName, coverArt: getCoverArt(series), status: slotState.status, progress: Math.round(slot.progress * 100), mb: slot.mb, mbmissing: slot.mbleft, size: Math.round(slot.mb * 1024 * 1024), speed: Math.round((slot.kbpersec || 0) * 1024), eta: slot.timeleft, seriesName: series.title, episodes: gatherEpisodes(nzbNameLower, sonarrQueue.data.records), allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined, client: 'sabnzbd', instanceId: slot.instanceId || 'sabnzbd-default', instanceName: slot.instanceName || 'SABnzbd' };
|
||||||
const issues = getImportIssues(sonarrMatch);
|
const issues = getImportIssues(sonarrMatch);
|
||||||
if (issues) dlObj.importIssues = issues;
|
if (issues) dlObj.importIssues = issues;
|
||||||
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = series.path || null; dlObj.arrLink = getSonarrLink(series); dlObj.arrQueueId = sonarrMatch.id; dlObj.arrType = 'sonarr'; dlObj.arrInstanceUrl = sonarrMatch._instanceUrl || null; dlObj.arrInstanceKey = sonarrMatch._instanceKey || null; dlObj.arrContentId = sonarrMatch.episodeId || null; dlObj.arrContentType = 'episode'; }
|
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = series.path || null; dlObj.arrLink = getSonarrLink(series); dlObj.arrQueueId = sonarrMatch.id; dlObj.arrType = 'sonarr'; dlObj.arrInstanceUrl = sonarrMatch._instanceUrl || null; dlObj.arrInstanceKey = sonarrMatch._instanceKey || null; dlObj.arrContentId = sonarrMatch.episodeId || null; dlObj.arrContentType = 'episode'; }
|
||||||
@@ -957,17 +1120,15 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const radarrMatch = radarrQueue.data.records.find(r => {
|
// Handle Radarr match (radarrMatch already declared above)
|
||||||
const rTitle = (r.title || r.sourceTitle || '').toLowerCase();
|
|
||||||
return rTitle && (rTitle.includes(nzbNameLower) || nzbNameLower.includes(rTitle));
|
|
||||||
});
|
|
||||||
if (radarrMatch && radarrMatch.movieId) {
|
if (radarrMatch && radarrMatch.movieId) {
|
||||||
|
sabSlotsMatched++;
|
||||||
const movie = moviesMap.get(radarrMatch.movieId) || radarrMatch.movie;
|
const movie = moviesMap.get(radarrMatch.movieId) || radarrMatch.movie;
|
||||||
if (movie) {
|
if (movie) {
|
||||||
const allTags = extractAllTags(movie.tags, radarrTagMap);
|
const allTags = extractAllTags(movie.tags, radarrTagMap);
|
||||||
const matchedUserTag = extractUserTag(movie.tags, radarrTagMap, username);
|
const matchedUserTag = extractUserTag(movie.tags, radarrTagMap, username);
|
||||||
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
||||||
const dlObj = { type: 'movie', title: nzbName, coverArt: getCoverArt(movie), status: slotState.status, progress: slot.percentage, mb: slot.mb, mbmissing: slot.mbmissing, size: slot.size, speed: slotState.speed, eta: slot.timeleft, movieName: movie.title, movieInfo: radarrMatch, allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined };
|
const dlObj = { type: 'movie', title: nzbName, coverArt: getCoverArt(movie), status: slotState.status, progress: Math.round(slot.progress * 100), mb: slot.mb, mbmissing: slot.mbleft, size: Math.round(slot.mb * 1024 * 1024), speed: Math.round((slot.kbpersec || 0) * 1024), eta: slot.timeleft, movieName: movie.title, movieInfo: radarrMatch, allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined, client: 'sabnzbd', instanceId: slot.instanceId || 'sabnzbd-default', instanceName: slot.instanceName || 'SABnzbd' };
|
||||||
const issues = getImportIssues(radarrMatch);
|
const issues = getImportIssues(radarrMatch);
|
||||||
if (issues) dlObj.importIssues = issues;
|
if (issues) dlObj.importIssues = issues;
|
||||||
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = movie.path || null; dlObj.arrLink = getRadarrLink(movie); dlObj.arrQueueId = radarrMatch.id; dlObj.arrType = 'radarr'; dlObj.arrInstanceUrl = radarrMatch._instanceUrl || null; dlObj.arrInstanceKey = radarrMatch._instanceKey || null; dlObj.arrContentId = radarrMatch.movieId || null; dlObj.arrContentType = 'movie'; }
|
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = movie.path || null; dlObj.arrLink = getRadarrLink(movie); dlObj.arrQueueId = radarrMatch.id; dlObj.arrType = 'radarr'; dlObj.arrInstanceUrl = radarrMatch._instanceUrl || null; dlObj.arrInstanceKey = radarrMatch._instanceKey || null; dlObj.arrContentId = radarrMatch.movieId || null; dlObj.arrContentType = 'movie'; }
|
||||||
@@ -996,7 +1157,7 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
const allTags = extractAllTags(series.tags, sonarrTagMap);
|
const allTags = extractAllTags(series.tags, sonarrTagMap);
|
||||||
const matchedUserTag = extractUserTag(series.tags, sonarrTagMap, username);
|
const matchedUserTag = extractUserTag(series.tags, sonarrTagMap, username);
|
||||||
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
||||||
const dlObj = { type: 'series', title: nzbName, coverArt: getCoverArt(series), status: slot.status, size: slot.size, completedAt: slot.completed_time, seriesName: series.title, episodes: gatherEpisodes(nzbNameLower, sonarrHistory.data.records), allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined };
|
const dlObj = { type: 'series', title: nzbName, coverArt: getCoverArt(series), status: slot.status, mb: slot.mb, size: Math.round((slot.mb || 0) * 1024 * 1024), completedAt: slot.completed_time, seriesName: series.title, episodes: gatherEpisodes(nzbNameLower, sonarrHistory.data.records), allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined, client: 'sabnzbd', instanceId: slot.instanceId || 'sabnzbd-default', instanceName: slot.instanceName || 'SABnzbd' };
|
||||||
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = series.path || null; dlObj.arrLink = getSonarrLink(series); }
|
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = series.path || null; dlObj.arrLink = getSonarrLink(series); }
|
||||||
userDownloads.push(dlObj);
|
userDownloads.push(dlObj);
|
||||||
}
|
}
|
||||||
@@ -1013,7 +1174,7 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
const allTags = extractAllTags(movie.tags, radarrTagMap);
|
const allTags = extractAllTags(movie.tags, radarrTagMap);
|
||||||
const matchedUserTag = extractUserTag(movie.tags, radarrTagMap, username);
|
const matchedUserTag = extractUserTag(movie.tags, radarrTagMap, username);
|
||||||
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
if (showAll ? allTags.length > 0 : !!matchedUserTag) {
|
||||||
const dlObj = { type: 'movie', title: nzbName, coverArt: getCoverArt(movie), status: slot.status, size: slot.size, completedAt: slot.completed_time, movieName: movie.title, movieInfo: radarrMatch, allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined };
|
const dlObj = { type: 'movie', title: nzbName, coverArt: getCoverArt(movie), status: slot.status, mb: slot.mb, size: Math.round((slot.mb || 0) * 1024 * 1024), completedAt: slot.completed_time, movieName: movie.title, movieInfo: radarrMatch, allTags, matchedUserTag: matchedUserTag || null, tagBadges: showAll ? buildTagBadges(allTags, embyUserMap) : undefined, client: 'sabnzbd', instanceId: slot.instanceId || 'sabnzbd-default', instanceName: slot.instanceName || 'SABnzbd' };
|
||||||
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = movie.path || null; dlObj.arrLink = getRadarrLink(movie); }
|
if (isAdmin) { dlObj.downloadPath = slot.storage || null; dlObj.targetPath = movie.path || null; dlObj.arrLink = getRadarrLink(movie); }
|
||||||
userDownloads.push(dlObj);
|
userDownloads.push(dlObj);
|
||||||
}
|
}
|
||||||
@@ -1094,7 +1255,18 @@ router.get('/stream', requireAuth, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write SSE event
|
// Write SSE event
|
||||||
res.write(`data: ${JSON.stringify({ user: user.name, isAdmin, downloads: userDownloads })}\n\n`);
|
console.log(`[SSE] SAB matching: ${sabSlotsChecked} checked, ${sabSlotsMatched} matched to Sonarr/Radarr`);
|
||||||
|
console.log(`[SSE] Sending ${userDownloads.length} downloads for ${user.name}`);
|
||||||
|
if (userDownloads.length > 0) {
|
||||||
|
console.log(`[SSE] Download titles: ${userDownloads.map(d => d.title).join(', ')}`);
|
||||||
|
}
|
||||||
|
// Get download clients list for ordering/filtering
|
||||||
|
const downloadClients = downloadClientRegistry.getAllClients().map(c => ({
|
||||||
|
id: c.getInstanceId(),
|
||||||
|
name: c.name,
|
||||||
|
type: c.getClientType()
|
||||||
|
}));
|
||||||
|
res.write(`data: ${JSON.stringify({ user: user.name, isAdmin, downloads: userDownloads, downloadClients })}\n\n`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[SSE] Error building payload:', sanitizeError(err));
|
console.error('[SSE] Error building payload:', sanitizeError(err));
|
||||||
}
|
}
|
||||||
|
|||||||
+47
-14
@@ -4,7 +4,16 @@ const axios = require('axios');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const requireAuth = require('../middleware/requireAuth');
|
const requireAuth = require('../middleware/requireAuth');
|
||||||
const sanitizeError = require('../utils/sanitizeError');
|
const sanitizeError = require('../utils/sanitizeError');
|
||||||
const { getWebhookSecret, getSofarrBaseUrl } = require('../utils/config');
|
const { getWebhookSecret, getSofarrBaseUrl, getRadarrInstances } = require('../utils/config');
|
||||||
|
|
||||||
|
// Helper to get first Radarr instance (for notification proxy routes)
|
||||||
|
function getFirstRadarrInstance() {
|
||||||
|
const instances = getRadarrInstances();
|
||||||
|
if (!instances || instances.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return instances[0];
|
||||||
|
}
|
||||||
|
|
||||||
router.use(requireAuth);
|
router.use(requireAuth);
|
||||||
|
|
||||||
@@ -60,12 +69,17 @@ router.get('/movies', async (req, res) => {
|
|||||||
// Notification proxy routes (Phase 3)
|
// Notification proxy routes (Phase 3)
|
||||||
// GET /api/radarr/notifications - list all notifications
|
// GET /api/radarr/notifications - list all notifications
|
||||||
router.get('/notifications', async (req, res) => {
|
router.get('/notifications', async (req, res) => {
|
||||||
|
const instance = getFirstRadarrInstance();
|
||||||
|
if (!instance) {
|
||||||
|
return res.status(503).json({ error: 'Radarr not configured' });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${process.env.RADARR_URL}/api/v3/notification`, {
|
const response = await axios.get(`${instance.url}/api/v3/notification`, {
|
||||||
headers: { 'X-Api-Key': process.env.RADARR_API_KEY }
|
headers: { 'X-Api-Key': instance.apiKey }
|
||||||
});
|
});
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[Radarr] Failed to fetch notifications:', error.message);
|
||||||
res.status(500).json({ error: 'Failed to fetch Radarr notifications', details: sanitizeError(error) });
|
res.status(500).json({ error: 'Failed to fetch Radarr notifications', details: sanitizeError(error) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -120,12 +134,21 @@ router.delete('/notifications/:id', async (req, res) => {
|
|||||||
|
|
||||||
// POST /api/radarr/notifications/test - test notification
|
// POST /api/radarr/notifications/test - test notification
|
||||||
router.post('/notifications/test', async (req, res) => {
|
router.post('/notifications/test', async (req, res) => {
|
||||||
|
const instance = getFirstRadarrInstance();
|
||||||
|
if (!instance) {
|
||||||
|
return res.status(503).json({ error: 'Radarr not configured' });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(`${process.env.RADARR_URL}/api/v3/notification/test`, req.body, {
|
const response = await axios.post(`${instance.url}/api/v3/notification/test`, req.body, {
|
||||||
headers: { 'X-Api-Key': process.env.RADARR_API_KEY }
|
headers: { 'X-Api-Key': instance.apiKey }
|
||||||
});
|
});
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[Radarr] Failed to test notification:', error.message);
|
||||||
|
if (error.response) {
|
||||||
|
console.error('[Radarr] Test response status:', error.response.status);
|
||||||
|
console.error('[Radarr] Test response data:', error.response.data);
|
||||||
|
}
|
||||||
res.status(500).json({ error: 'Failed to test Radarr notification', details: sanitizeError(error) });
|
res.status(500).json({ error: 'Failed to test Radarr notification', details: sanitizeError(error) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -144,6 +167,10 @@ router.get('/notifications/schema', async (req, res) => {
|
|||||||
|
|
||||||
// POST /api/radarr/notifications/sofarr-webhook - one-click Sofarr webhook setup
|
// POST /api/radarr/notifications/sofarr-webhook - one-click Sofarr webhook setup
|
||||||
router.post('/notifications/sofarr-webhook', async (req, res) => {
|
router.post('/notifications/sofarr-webhook', async (req, res) => {
|
||||||
|
const instance = getFirstRadarrInstance();
|
||||||
|
if (!instance) {
|
||||||
|
return res.status(503).json({ error: 'Radarr not configured' });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const sofarrBaseUrl = getSofarrBaseUrl();
|
const sofarrBaseUrl = getSofarrBaseUrl();
|
||||||
const webhookSecret = getWebhookSecret();
|
const webhookSecret = getWebhookSecret();
|
||||||
@@ -158,8 +185,8 @@ router.post('/notifications/sofarr-webhook', async (req, res) => {
|
|||||||
const webhookUrl = `${sofarrBaseUrl}/api/webhook/radarr`;
|
const webhookUrl = `${sofarrBaseUrl}/api/webhook/radarr`;
|
||||||
|
|
||||||
// Check if Sofarr webhook already exists
|
// Check if Sofarr webhook already exists
|
||||||
const listResponse = await axios.get(`${process.env.RADARR_URL}/api/v3/notification`, {
|
const listResponse = await axios.get(`${instance.url}/api/v3/notification`, {
|
||||||
headers: { 'X-Api-Key': process.env.RADARR_API_KEY }
|
headers: { 'X-Api-Key': instance.apiKey }
|
||||||
});
|
});
|
||||||
const existingNotification = listResponse.data.find(n => n.name === 'Sofarr');
|
const existingNotification = listResponse.data.find(n => n.name === 'Sofarr');
|
||||||
|
|
||||||
@@ -169,36 +196,42 @@ router.post('/notifications/sofarr-webhook', async (req, res) => {
|
|||||||
configContract: 'WebhookSettings',
|
configContract: 'WebhookSettings',
|
||||||
fields: [
|
fields: [
|
||||||
{ name: 'url', value: webhookUrl },
|
{ name: 'url', value: webhookUrl },
|
||||||
{ name: 'method', value: 'POST' },
|
{ name: 'method', value: 1 },
|
||||||
{ name: 'headers', value: [{ key: 'X-Sofarr-Webhook-Secret', value: webhookSecret }] }
|
{ name: 'headers', value: [{ key: 'X-Sofarr-Webhook-Secret', value: webhookSecret }] }
|
||||||
],
|
],
|
||||||
onGrab: true,
|
onGrab: true,
|
||||||
onDownload: true,
|
onDownload: true,
|
||||||
onImport: true,
|
|
||||||
onUpgrade: true,
|
onUpgrade: true,
|
||||||
|
onImport: true,
|
||||||
onRename: false,
|
onRename: false,
|
||||||
onHealthIssue: false,
|
onHealthIssue: false,
|
||||||
onApplicationUpdate: false
|
onApplicationUpdate: false,
|
||||||
|
onManualInteractionRequired: false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (existingNotification) {
|
if (existingNotification) {
|
||||||
// Update existing notification
|
// Update existing notification
|
||||||
const response = await axios.put(
|
const response = await axios.put(
|
||||||
`${process.env.RADARR_URL}/api/v3/notification/${existingNotification.id}`,
|
`${instance.url}/api/v3/notification/${existingNotification.id}`,
|
||||||
{ ...notificationPayload, id: existingNotification.id },
|
{ ...notificationPayload, id: existingNotification.id },
|
||||||
{ headers: { 'X-Api-Key': process.env.RADARR_API_KEY } }
|
{ headers: { 'X-Api-Key': instance.apiKey } }
|
||||||
);
|
);
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
} else {
|
} else {
|
||||||
// Create new notification
|
// Create new notification
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`${process.env.RADARR_URL}/api/v3/notification`,
|
`${instance.url}/api/v3/notification`,
|
||||||
notificationPayload,
|
notificationPayload,
|
||||||
{ headers: { 'X-Api-Key': process.env.RADARR_API_KEY } }
|
{ headers: { 'X-Api-Key': instance.apiKey } }
|
||||||
);
|
);
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[Radarr] Failed to configure webhook:', error.message);
|
||||||
|
if (error.response) {
|
||||||
|
console.error('[Radarr] Response status:', error.response.status);
|
||||||
|
console.error('[Radarr] Response data:', error.response.data);
|
||||||
|
}
|
||||||
res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) });
|
res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+47
-14
@@ -4,7 +4,16 @@ const axios = require('axios');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const requireAuth = require('../middleware/requireAuth');
|
const requireAuth = require('../middleware/requireAuth');
|
||||||
const sanitizeError = require('../utils/sanitizeError');
|
const sanitizeError = require('../utils/sanitizeError');
|
||||||
const { getWebhookSecret, getSofarrBaseUrl } = require('../utils/config');
|
const { getWebhookSecret, getSofarrBaseUrl, getSonarrInstances } = require('../utils/config');
|
||||||
|
|
||||||
|
// Helper to get first Sonarr instance (for notification proxy routes)
|
||||||
|
function getFirstSonarrInstance() {
|
||||||
|
const instances = getSonarrInstances();
|
||||||
|
if (!instances || instances.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return instances[0];
|
||||||
|
}
|
||||||
|
|
||||||
router.use(requireAuth);
|
router.use(requireAuth);
|
||||||
|
|
||||||
@@ -60,12 +69,17 @@ router.get('/series', async (req, res) => {
|
|||||||
// Notification proxy routes (Phase 3)
|
// Notification proxy routes (Phase 3)
|
||||||
// GET /api/sonarr/notifications - list all notifications
|
// GET /api/sonarr/notifications - list all notifications
|
||||||
router.get('/notifications', async (req, res) => {
|
router.get('/notifications', async (req, res) => {
|
||||||
|
const instance = getFirstSonarrInstance();
|
||||||
|
if (!instance) {
|
||||||
|
return res.status(503).json({ error: 'Sonarr not configured' });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${process.env.SONARR_URL}/api/v3/notification`, {
|
const response = await axios.get(`${instance.url}/api/v3/notification`, {
|
||||||
headers: { 'X-Api-Key': process.env.SONARR_API_KEY }
|
headers: { 'X-Api-Key': instance.apiKey }
|
||||||
});
|
});
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[Sonarr] Failed to fetch notifications:', error.message);
|
||||||
res.status(500).json({ error: 'Failed to fetch Sonarr notifications', details: sanitizeError(error) });
|
res.status(500).json({ error: 'Failed to fetch Sonarr notifications', details: sanitizeError(error) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -120,12 +134,21 @@ router.delete('/notifications/:id', async (req, res) => {
|
|||||||
|
|
||||||
// POST /api/sonarr/notifications/test - test notification
|
// POST /api/sonarr/notifications/test - test notification
|
||||||
router.post('/notifications/test', async (req, res) => {
|
router.post('/notifications/test', async (req, res) => {
|
||||||
|
const instance = getFirstSonarrInstance();
|
||||||
|
if (!instance) {
|
||||||
|
return res.status(503).json({ error: 'Sonarr not configured' });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(`${process.env.SONARR_URL}/api/v3/notification/test`, req.body, {
|
const response = await axios.post(`${instance.url}/api/v3/notification/test`, req.body, {
|
||||||
headers: { 'X-Api-Key': process.env.SONARR_API_KEY }
|
headers: { 'X-Api-Key': instance.apiKey }
|
||||||
});
|
});
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[Sonarr] Failed to test notification:', error.message);
|
||||||
|
if (error.response) {
|
||||||
|
console.error('[Sonarr] Test response status:', error.response.status);
|
||||||
|
console.error('[Sonarr] Test response data:', error.response.data);
|
||||||
|
}
|
||||||
res.status(500).json({ error: 'Failed to test Sonarr notification', details: sanitizeError(error) });
|
res.status(500).json({ error: 'Failed to test Sonarr notification', details: sanitizeError(error) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -144,6 +167,10 @@ router.get('/notifications/schema', async (req, res) => {
|
|||||||
|
|
||||||
// POST /api/sonarr/notifications/sofarr-webhook - one-click Sofarr webhook setup
|
// POST /api/sonarr/notifications/sofarr-webhook - one-click Sofarr webhook setup
|
||||||
router.post('/notifications/sofarr-webhook', async (req, res) => {
|
router.post('/notifications/sofarr-webhook', async (req, res) => {
|
||||||
|
const instance = getFirstSonarrInstance();
|
||||||
|
if (!instance) {
|
||||||
|
return res.status(503).json({ error: 'Sonarr not configured' });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const sofarrBaseUrl = getSofarrBaseUrl();
|
const sofarrBaseUrl = getSofarrBaseUrl();
|
||||||
const webhookSecret = getWebhookSecret();
|
const webhookSecret = getWebhookSecret();
|
||||||
@@ -158,8 +185,8 @@ router.post('/notifications/sofarr-webhook', async (req, res) => {
|
|||||||
const webhookUrl = `${sofarrBaseUrl}/api/webhook/sonarr`;
|
const webhookUrl = `${sofarrBaseUrl}/api/webhook/sonarr`;
|
||||||
|
|
||||||
// Check if Sofarr webhook already exists
|
// Check if Sofarr webhook already exists
|
||||||
const listResponse = await axios.get(`${process.env.SONARR_URL}/api/v3/notification`, {
|
const listResponse = await axios.get(`${instance.url}/api/v3/notification`, {
|
||||||
headers: { 'X-Api-Key': process.env.SONARR_API_KEY }
|
headers: { 'X-Api-Key': instance.apiKey }
|
||||||
});
|
});
|
||||||
const existingNotification = listResponse.data.find(n => n.name === 'Sofarr');
|
const existingNotification = listResponse.data.find(n => n.name === 'Sofarr');
|
||||||
|
|
||||||
@@ -169,36 +196,42 @@ router.post('/notifications/sofarr-webhook', async (req, res) => {
|
|||||||
configContract: 'WebhookSettings',
|
configContract: 'WebhookSettings',
|
||||||
fields: [
|
fields: [
|
||||||
{ name: 'url', value: webhookUrl },
|
{ name: 'url', value: webhookUrl },
|
||||||
{ name: 'method', value: 'POST' },
|
{ name: 'method', value: 1 },
|
||||||
{ name: 'headers', value: [{ key: 'X-Sofarr-Webhook-Secret', value: webhookSecret }] }
|
{ name: 'headers', value: [{ key: 'X-Sofarr-Webhook-Secret', value: webhookSecret }] }
|
||||||
],
|
],
|
||||||
onGrab: true,
|
onGrab: true,
|
||||||
onDownload: true,
|
onDownload: true,
|
||||||
onImport: true,
|
|
||||||
onUpgrade: true,
|
onUpgrade: true,
|
||||||
|
onImport: true,
|
||||||
onRename: false,
|
onRename: false,
|
||||||
onHealthIssue: false,
|
onHealthIssue: false,
|
||||||
onApplicationUpdate: false
|
onApplicationUpdate: false,
|
||||||
|
onManualInteractionRequired: false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (existingNotification) {
|
if (existingNotification) {
|
||||||
// Update existing notification
|
// Update existing notification
|
||||||
const response = await axios.put(
|
const response = await axios.put(
|
||||||
`${process.env.SONARR_URL}/api/v3/notification/${existingNotification.id}`,
|
`${instance.url}/api/v3/notification/${existingNotification.id}`,
|
||||||
{ ...notificationPayload, id: existingNotification.id },
|
{ ...notificationPayload, id: existingNotification.id },
|
||||||
{ headers: { 'X-Api-Key': process.env.SONARR_API_KEY } }
|
{ headers: { 'X-Api-Key': instance.apiKey } }
|
||||||
);
|
);
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
} else {
|
} else {
|
||||||
// Create new notification
|
// Create new notification
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`${process.env.SONARR_URL}/api/v3/notification`,
|
`${instance.url}/api/v3/notification`,
|
||||||
notificationPayload,
|
notificationPayload,
|
||||||
{ headers: { 'X-Api-Key': process.env.SONARR_API_KEY } }
|
{ headers: { 'X-Api-Key': instance.apiKey } }
|
||||||
);
|
);
|
||||||
res.json(response.data);
|
res.json(response.data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[Sonarr] Failed to configure webhook:', error.message);
|
||||||
|
if (error.response) {
|
||||||
|
console.error('[Sonarr] Response status:', error.response.status);
|
||||||
|
console.error('[Sonarr] Response data:', error.response.data);
|
||||||
|
}
|
||||||
res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) });
|
res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -247,10 +247,14 @@ router.post('/sonarr', webhookLimiter, (req, res) => {
|
|||||||
logToFile(`[Webhook] Sonarr payload: ${JSON.stringify(req.body)}`);
|
logToFile(`[Webhook] Sonarr payload: ${JSON.stringify(req.body)}`);
|
||||||
|
|
||||||
// Phase 5.1: update webhook metrics for polling optimization
|
// Phase 5.1: update webhook metrics for polling optimization
|
||||||
|
// Note: instanceName from webhook is often generic (e.g., "Sonarr"), not the configured name
|
||||||
|
// Update metrics for all Sonarr instances since we can't reliably match
|
||||||
const sonarrInstances = getSonarrInstances();
|
const sonarrInstances = getSonarrInstances();
|
||||||
const instance = sonarrInstances.find(i => i.name === instanceName);
|
if (sonarrInstances.length > 0) {
|
||||||
if (instance) {
|
for (const inst of sonarrInstances) {
|
||||||
cache.updateWebhookMetrics(instance.url);
|
cache.updateWebhookMetrics(inst.url);
|
||||||
|
}
|
||||||
|
logToFile(`[Webhook] Updated metrics for ${sonarrInstances.length} Sonarr instance(s)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phase 2: background cache refresh + SSE broadcast (fire-and-forget)
|
// Phase 2: background cache refresh + SSE broadcast (fire-and-forget)
|
||||||
@@ -296,10 +300,14 @@ router.post('/radarr', webhookLimiter, (req, res) => {
|
|||||||
logToFile(`[Webhook] Radarr payload: ${JSON.stringify(req.body)}`);
|
logToFile(`[Webhook] Radarr payload: ${JSON.stringify(req.body)}`);
|
||||||
|
|
||||||
// Phase 5.1: update webhook metrics for polling optimization
|
// Phase 5.1: update webhook metrics for polling optimization
|
||||||
|
// Note: instanceName from webhook is often generic (e.g., "Radarr"), not the configured name
|
||||||
|
// Update metrics for all Radarr instances since we can't reliably match
|
||||||
const radarrInstances = getRadarrInstances();
|
const radarrInstances = getRadarrInstances();
|
||||||
const instance = radarrInstances.find(i => i.name === instanceName);
|
if (radarrInstances.length > 0) {
|
||||||
if (instance) {
|
for (const inst of radarrInstances) {
|
||||||
cache.updateWebhookMetrics(instance.url);
|
cache.updateWebhookMetrics(inst.url);
|
||||||
|
}
|
||||||
|
logToFile(`[Webhook] Updated metrics for ${radarrInstances.length} Radarr instance(s)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phase 2: background cache refresh + SSE broadcast (fire-and-forget)
|
// Phase 2: background cache refresh + SSE broadcast (fire-and-forget)
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ const arrRetrieverRegistry = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const retriever = new RetrieverClass(config);
|
const retriever = new RetrieverClass(config);
|
||||||
this.retrievers.set(config.id, retriever);
|
const uniqueKey = `${config.type}:${config.id}`;
|
||||||
logToFile(`[ArrRetrieverRegistry] Created ${config.type} retriever: ${config.name} (${config.id})`);
|
this.retrievers.set(uniqueKey, retriever);
|
||||||
|
logToFile(`[ArrRetrieverRegistry] Created ${config.type} retriever: ${config.name} (${uniqueKey})`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToFile(`[ArrRetrieverRegistry] Failed to create retriever ${config.id}: ${error.message}`);
|
logToFile(`[ArrRetrieverRegistry] Failed to create retriever ${config.id}: ${error.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class DownloadClientRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const client = new ClientClass(config);
|
const client = new ClientClass(config);
|
||||||
this.clients.set(config.id, client);
|
const uniqueKey = `${config.type}:${config.id}`;
|
||||||
logToFile(`[DownloadClientRegistry] Created ${config.type} client: ${config.name} (${config.id})`);
|
this.clients.set(uniqueKey, client);
|
||||||
|
logToFile(`[DownloadClientRegistry] Created ${config.type} client: ${config.name} (${uniqueKey})`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToFile(`[DownloadClientRegistry] Failed to create client ${config.id}: ${error.message}`);
|
logToFile(`[DownloadClientRegistry] Failed to create client ${config.id}: ${error.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,10 +178,12 @@ async function pollAllServices() {
|
|||||||
cat: d.category,
|
cat: d.category,
|
||||||
labels: d.tags.join(','),
|
labels: d.tags.join(','),
|
||||||
added: d.addedOn ? Math.floor(new Date(d.addedOn).getTime() / 1000) : null,
|
added: d.addedOn ? Math.floor(new Date(d.addedOn).getTime() / 1000) : null,
|
||||||
raw: d.raw
|
raw: d.raw,
|
||||||
|
instanceId: d.instanceId,
|
||||||
|
instanceName: d.instanceName
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
|
|
||||||
const sabHistoryLegacy = {
|
const sabHistoryLegacy = {
|
||||||
slots: sabHistory.map(d => ({
|
slots: sabHistory.map(d => ({
|
||||||
nzo_id: d.id,
|
nzo_id: d.id,
|
||||||
@@ -191,7 +193,9 @@ async function pollAllServices() {
|
|||||||
cat: d.category,
|
cat: d.category,
|
||||||
labels: d.tags.join(','),
|
labels: d.tags.join(','),
|
||||||
added: d.addedOn ? Math.floor(new Date(d.addedOn).getTime() / 1000) : null,
|
added: d.addedOn ? Math.floor(new Date(d.addedOn).getTime() / 1000) : null,
|
||||||
raw: d.raw
|
raw: d.raw,
|
||||||
|
instanceId: d.instanceId,
|
||||||
|
instanceName: d.instanceName
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ function mapTorrentToDownload(torrent) {
|
|||||||
return {
|
return {
|
||||||
type: 'torrent',
|
type: 'torrent',
|
||||||
title: torrent.name,
|
title: torrent.name,
|
||||||
|
client: 'qbittorrent',
|
||||||
|
instanceId: torrent.instanceId,
|
||||||
instanceName: torrent.instanceName,
|
instanceName: torrent.instanceName,
|
||||||
status: status,
|
status: status,
|
||||||
progress: progress.toFixed(1),
|
progress: progress.toFixed(1),
|
||||||
|
|||||||
Reference in New Issue
Block a user