bulljobs don't respect common headers

added the common truth (user-agent.ts) to all bulljob services
This commit is contained in:
Tom Bernens
2026-05-15 20:03:40 -07:00
parent e65e737bee
commit 0561459782
16 changed files with 40 additions and 18 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '../utils/user-agent';
import * as cheerio from 'cheerio';
import { RMABLogger } from '../utils/logger';
import { getConfigService } from '../services/config.service';
@@ -273,7 +274,7 @@ export class AudibleService {
timeout: 10000,
headers: {
Accept: 'application/json',
'User-Agent': 'ReadMeABook/1.0',
'User-Agent': RMAB_USER_AGENT,
},
});
@@ -305,7 +306,7 @@ export class AudibleService {
timeout: 10000,
headers: {
Accept: 'application/json',
'User-Agent': 'ReadMeABook/1.0',
'User-Agent': RMAB_USER_AGENT,
},
});
+2 -1
View File
@@ -7,13 +7,14 @@
*/
import axios from 'axios';
import { RMAB_USER_AGENT } from '@/lib/utils/user-agent';
import { RMABLogger } from '@/lib/utils/logger';
const logger = RMABLogger.create('Audnexus.Authors');
const AUDNEXUS_BASE = 'https://api.audnex.us';
const AUDNEXUS_TIMEOUT = 10000;
const AUDNEXUS_HEADERS = { 'User-Agent': 'ReadMeABook/1.0' };
const AUDNEXUS_HEADERS = { 'User-Agent': RMAB_USER_AGENT };
export interface AudnexusAuthorSearch {
asin: string;
+2 -1
View File
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '../utils/user-agent';
import https from 'https';
import path from 'path';
import { DOWNLOAD_CLIENT_TIMEOUT } from '../constants/download-timeouts';
@@ -50,7 +51,7 @@ export class DelugeService implements IDownloadClient {
? new https.Agent({ rejectUnauthorized: false }) : undefined;
if (httpsAgent) logger.info('[Deluge] SSL certificate verification disabled');
this.client = axios.create({ baseURL: this.baseUrl, timeout: DOWNLOAD_CLIENT_TIMEOUT, httpsAgent });
this.client = axios.create({ baseURL: this.baseUrl, timeout: DOWNLOAD_CLIENT_TIMEOUT, httpsAgent, headers: { 'User-Agent': RMAB_USER_AGENT } });
}
/** JSON-RPC call with automatic re-authentication on auth failure */
+6 -1
View File
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '@/lib/utils/user-agent';
import https from 'https';
import zlib from 'zlib';
import { RMABLogger } from '@/lib/utils/logger';
@@ -140,6 +141,7 @@ export class NZBGetService implements IDownloadClient {
baseURL: this.baseUrl,
timeout: 30000,
httpsAgent: this.httpsAgent,
headers: { 'User-Agent': RMAB_USER_AGENT },
auth: {
username: this.username,
password: this.password,
@@ -226,7 +228,10 @@ export class NZBGetService implements IDownloadClient {
responseType: 'arraybuffer',
timeout: 30000,
maxRedirects: 5,
headers: options?.sourceHeaders,
headers: {
'User-Agent': RMAB_USER_AGENT,
...options?.sourceHeaders,
},
httpsAgent: url.startsWith('https') ? this.httpsAgent : undefined,
});
+2
View File
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '../utils/user-agent';
import { parseStringPromise } from 'xml2js';
import { RMABLogger } from '../utils/logger';
@@ -83,6 +84,7 @@ export class PlexService {
constructor() {
this.client = axios.create({
timeout: 10000,
headers: { 'User-Agent': RMAB_USER_AGENT },
});
}
+2
View File
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '../utils/user-agent';
import { XMLParser } from 'fast-xml-parser';
import { DOWNLOAD_CLIENT_TIMEOUT } from '../constants/download-timeouts';
import { TorrentResult } from '../utils/ranking-algorithm';
@@ -86,6 +87,7 @@ export class ProwlarrService {
this.client = axios.create({
baseURL: `${this.baseUrl}/api/v1`,
headers: {
'User-Agent': RMAB_USER_AGENT,
'X-Api-Key': this.apiKey,
},
timeout: DOWNLOAD_CLIENT_TIMEOUT,
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '../utils/user-agent';
import https from 'https';
import path from 'path';
import { DOWNLOAD_CLIENT_TIMEOUT } from '../constants/download-timeouts';
@@ -149,6 +150,7 @@ export class QBittorrentService implements IDownloadClient {
baseURL: `${this.baseUrl}/api/v2`,
timeout: DOWNLOAD_CLIENT_TIMEOUT,
httpsAgent: this.httpsAgent,
headers: { 'User-Agent': RMAB_USER_AGENT },
// Support nginx/Apache reverse proxy with HTTP Basic Auth
auth: {
username: this.username,
+6 -1
View File
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '@/lib/utils/user-agent';
import https from 'https';
import FormData from 'form-data';
import { RMABLogger } from '@/lib/utils/logger';
@@ -132,6 +133,7 @@ export class SABnzbdService implements IDownloadClient {
baseURL: this.baseUrl,
timeout: 30000,
httpsAgent: this.httpsAgent,
headers: { 'User-Agent': RMAB_USER_AGENT },
});
}
@@ -494,7 +496,10 @@ export class SABnzbdService implements IDownloadClient {
responseType: 'arraybuffer',
timeout: 30000,
maxRedirects: 5,
headers: options?.sourceHeaders,
headers: {
'User-Agent': RMAB_USER_AGENT,
...options?.sourceHeaders,
},
// Use the same SSL settings as the SABnzbd client if the NZB URL
// happens to be served over HTTPS with a self-signed cert
httpsAgent: url.startsWith('https') ? this.httpsAgent : undefined,
@@ -4,6 +4,7 @@
*/
import axios, { AxiosInstance } from 'axios';
import { RMAB_USER_AGENT } from '../utils/user-agent';
import https from 'https';
import path from 'path';
import { DOWNLOAD_CLIENT_TIMEOUT } from '../constants/download-timeouts';
@@ -109,6 +110,7 @@ export class TransmissionService implements IDownloadClient {
baseURL: this.baseUrl,
timeout: DOWNLOAD_CLIENT_TIMEOUT,
httpsAgent: this.httpsAgent,
headers: { 'User-Agent': RMAB_USER_AGENT },
});
}