Skip to content

Commit 2ee5535

Browse files
authored
Merge branch 'develop' into feat-add-tvdb-indexer
2 parents 67a846c + cf59102 commit 2ee5535

File tree

30 files changed

+776
-342
lines changed

30 files changed

+776
-342
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ yarn-error.log*
3434
# database
3535
config/db/*.sqlite3*
3636
config/settings.json
37+
config/settings.old.json
3738

3839
# logs
3940
config/logs/*.log*

docs/getting-started/aur.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ sidebar_position: 4
66

77
# AUR (Arch User Repository)
88

9+
:::note Disclaimer
10+
This AUR package is not maintained by us but by a third party. Please refer to the maintainer for any issues.
11+
:::
12+
913
:::info
1014
This method is not recommended for most users. It is intended for advanced users who are using Arch Linux or an Arch-based distribution.
1115
:::

overseerr-api.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,9 @@ paths:
19941994
appDataPath:
19951995
type: string
19961996
example: /app/config
1997+
appDataPermissions:
1998+
type: boolean
1999+
example: true
19972000
/settings/main:
19982001
get:
19992002
summary: Get main settings

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"sqlite3": "5.1.4",
9494
"swagger-ui-express": "4.6.2",
9595
"swr": "2.2.5",
96-
"typeorm": "0.3.12",
96+
"typeorm": "0.3.11",
97+
"undici": "^6.20.1",
9798
"web-push": "3.5.0",
9899
"winston": "3.8.2",
99100
"winston-daily-rotate-file": "4.7.1",

pnpm-lock.yaml

Lines changed: 27 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/api/externalapi.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,28 @@ class ExternalAPI {
3232
this.fetch = fetch;
3333
}
3434

35-
this.baseUrl = baseUrl;
36-
this.params = params;
35+
const url = new URL(baseUrl);
36+
3737
this.defaultHeaders = {
3838
'Content-Type': 'application/json',
3939
Accept: 'application/json',
40+
...((url.username || url.password) && {
41+
Authorization: `Basic ${Buffer.from(
42+
`${url.username}:${url.password}`
43+
).toString('base64')}`,
44+
}),
4045
...options.headers,
4146
};
4247

48+
if (url.username || url.password) {
49+
url.username = '';
50+
url.password = '';
51+
baseUrl = url.toString();
52+
}
53+
54+
this.baseUrl = baseUrl;
55+
this.params = params;
56+
4357
this.cache = options.nodeCache;
4458
}
4559

server/api/jellyfin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ class JellyfinAPI extends ExternalAPI {
410410
).AccessToken;
411411
} catch (e) {
412412
logger.error(
413-
`Something went wrong while creating an API key the Jellyfin server: ${e.message}`,
413+
`Something went wrong while creating an API key from the Jellyfin server: ${e.message}`,
414414
{ label: 'Jellyfin API' }
415415
);
416416

server/api/plexapi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class PlexAPI {
180180
settings.plex.libraries = [];
181181
}
182182

183-
settings.save();
183+
await settings.save();
184184
}
185185

186186
public async getLibraryContents(

server/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import clearCookies from '@server/middleware/clearcookies';
2121
import routes from '@server/routes';
2222
import avatarproxy from '@server/routes/avatarproxy';
2323
import imageproxy from '@server/routes/imageproxy';
24+
import { appDataPermissions } from '@server/utils/appDataVolume';
2425
import { getAppVersion } from '@server/utils/appVersion';
26+
import createCustomProxyAgent from '@server/utils/customProxyAgent';
2527
import restartFlag from '@server/utils/restartFlag';
2628
import { getClientIp } from '@supercharge/request-ip';
2729
import { TypeormStore } from 'connect-typeorm/out';
@@ -51,6 +53,12 @@ const dev = process.env.NODE_ENV !== 'production';
5153
const app = next({ dev });
5254
const handle = app.getRequestHandler();
5355

56+
if (!appDataPermissions()) {
57+
logger.error(
58+
'Something went wrong while checking config folder! Please ensure the config folder is set up properly.\nhttps://docs.jellyseerr.dev/getting-started'
59+
);
60+
}
61+
5462
app
5563
.prepare()
5664
.then(async () => {
@@ -67,6 +75,11 @@ app
6775
const settings = await getSettings().load();
6876
restartFlag.initializeSettings(settings.main);
6977

78+
// Register HTTP proxy
79+
if (settings.main.proxy.enabled) {
80+
await createCustomProxyAgent(settings.main.proxy);
81+
}
82+
7083
// Migrate library types
7184
if (
7285
settings.plex.libraries.length > 1 &&

server/lib/imageproxy.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,15 @@ class ImageProxy {
135135
private cacheVersion;
136136
private key;
137137
private baseUrl;
138+
private headers: HeadersInit | null = null;
138139

139140
constructor(
140141
key: string,
141142
baseUrl: string,
142143
options: {
143144
cacheVersion?: number;
144145
rateLimitOptions?: RateLimitOptions;
146+
headers?: HeadersInit;
145147
} = {}
146148
) {
147149
this.cacheVersion = options.cacheVersion ?? 1;
@@ -155,9 +157,13 @@ class ImageProxy {
155157
} else {
156158
this.fetch = fetch;
157159
}
160+
this.headers = options.headers || null;
158161
}
159162

160-
public async getImage(path: string): Promise<ImageResponse> {
163+
public async getImage(
164+
path: string,
165+
fallbackPath?: string
166+
): Promise<ImageResponse> {
161167
const cacheKey = this.getCacheKey(path);
162168

163169
const imageResponse = await this.get(cacheKey);
@@ -166,7 +172,11 @@ class ImageProxy {
166172
const newImage = await this.set(path, cacheKey);
167173

168174
if (!newImage) {
169-
throw new Error('Failed to load image');
175+
if (fallbackPath) {
176+
return await this.getImage(fallbackPath);
177+
} else {
178+
throw new Error('Failed to load image');
179+
}
170180
}
171181

172182
return newImage;
@@ -247,7 +257,12 @@ class ImageProxy {
247257
: '/'
248258
: '') +
249259
(path.startsWith('/') ? path.slice(1) : path);
250-
const response = await this.fetch(href);
260+
const response = await this.fetch(href, {
261+
headers: this.headers || undefined,
262+
});
263+
if (!response.ok) {
264+
return null;
265+
}
251266
const arrayBuffer = await response.arrayBuffer();
252267
const buffer = Buffer.from(arrayBuffer);
253268

server/lib/scanners/plex/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class PlexScanner
129129
});
130130

131131
settings.plex.libraries = newLibraries;
132-
settings.save();
132+
await settings.save();
133133
}
134134
} else {
135135
for (const library of this.libraries) {

0 commit comments

Comments
 (0)