Skip to content

Commit a72dc64

Browse files
authored
Add NZBGet download client and fix transmission
2 parents 7a08427 + 71b2f4f commit a72dc64

22 files changed

+1183
-54
lines changed

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"license": "ISC",
2323
"description": "",
2424
"dependencies": {
25-
"@loganmarchione/homelab-svg-assets": "^0.4.13",
25+
"@loganmarchione/homelab-svg-assets": "^0.4.14",
2626
"axios": "^1.8.3",
2727
"bcrypt": "^5.1.1",
2828
"cookie-parser": "^1.4.7",

backend/src/routes/adguard.route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ const validateItemId = (req: Request): string => {
5353
const getBaseUrl = (req: Request): string => {
5454
const itemId = validateItemId(req);
5555
const connectionInfo = getItemConnectionInfo(itemId);
56-
const host = connectionInfo.host || 'localhost';
56+
57+
// Clean the host to remove any protocol prefix
58+
let host = connectionInfo.host || 'localhost';
59+
host = host.replace(/^https?:\/\//, '');
60+
host = host.replace(/\/+$/, '');
61+
5762
const port = connectionInfo.port || '3000';
5863
const ssl = connectionInfo.ssl || false;
5964
const protocol = ssl ? 'https' : 'http';

backend/src/routes/deluge.route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ const validateItemId = (req: Request): string => {
8989
const getBaseUrl = (req: Request): string => {
9090
const itemId = validateItemId(req);
9191
const connectionInfo = getItemConnectionInfo(itemId);
92-
const host = connectionInfo.host || 'localhost';
92+
93+
// Clean the host to remove any protocol prefix
94+
let host = connectionInfo.host || 'localhost';
95+
host = host.replace(/^https?:\/\//, '');
96+
host = host.replace(/\/+$/, '');
97+
9398
const port = connectionInfo.port || '8112';
9499
const ssl = connectionInfo.ssl || false;
95100
const protocol = ssl ? 'https' : 'http';

backend/src/routes/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { iconsRoute } from './icons.route';
1010
import { jellyfinRoute } from './jellyfin.route';
1111
import { jellyseerRoute } from './jellyseerr.route';
1212
import { notesRoute } from './notes.route';
13+
import { nzbgetRoute } from './nzbget.route';
1314
import { piholeV6Route } from './pihole-v6.route';
1415
import { piholeRoute } from './pihole.route';
1516
import { qbittorrentRoute } from './qbittorrent.route';
@@ -68,6 +69,7 @@ router.use('/transmission', torrentApiLimiter, transmissionRoute);
6869

6970
// NZB client routes
7071
router.use('/sabnzbd', torrentApiLimiter, sabnzbdRoute);
72+
router.use('/nzbget', torrentApiLimiter, nzbgetRoute);
7173

7274
// Pi-hole routes
7375
router.use('/pihole', apiLimiter, piholeRoute);

backend/src/routes/jellyfin.route.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,14 @@ jellyfinRoute.get('/sessions', async (req: Request, res: Response) => {
7272

7373
console.log('Jellyfin sessions request');
7474

75+
// Clean the host to remove any protocol prefix
76+
let cleanHost = host;
77+
cleanHost = cleanHost.replace(/^https?:\/\//, '');
78+
cleanHost = cleanHost.replace(/\/+$/, '');
79+
7580
const protocol = ssl ? 'https' : 'http';
7681
const actualPort = port || '8096';
77-
const baseUrl = `${protocol}://${host}:${actualPort}`;
82+
const baseUrl = `${protocol}://${cleanHost}:${actualPort}`;
7883
const sessionsUrl = `${baseUrl}/Sessions`;
7984

8085
const httpModule = ssl ? https : http;
@@ -183,9 +188,14 @@ jellyfinRoute.get('/library-stats', async (req: Request, res: Response) => {
183188

184189
console.log('Jellyfin library stats request');
185190

191+
// Clean the host to remove any protocol prefix
192+
let cleanHost = host;
193+
cleanHost = cleanHost.replace(/^https?:\/\//, '');
194+
cleanHost = cleanHost.replace(/\/+$/, '');
195+
186196
const protocol = ssl ? 'https' : 'http';
187197
const actualPort = port || '8096';
188-
const baseUrl = `${protocol}://${host}:${actualPort}`;
198+
const baseUrl = `${protocol}://${cleanHost}:${actualPort}`;
189199

190200
const httpModule = ssl ? https : http;
191201

backend/src/routes/jellyseerr.route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ const validateItemId = (req: Request): string => {
2424
const getBaseUrl = (req: Request): string => {
2525
const itemId = validateItemId(req);
2626
const connectionInfo = getItemConnectionInfo(itemId);
27-
const host = connectionInfo.host || 'localhost';
27+
28+
// Clean the host to remove any protocol prefix
29+
let host = connectionInfo.host || 'localhost';
30+
host = host.replace(/^https?:\/\//, '');
31+
host = host.replace(/\/+$/, '');
32+
2833
const port = connectionInfo.port || '5055';
2934
const ssl = connectionInfo.ssl || false;
3035
const protocol = ssl ? 'https' : 'http';

0 commit comments

Comments
 (0)