mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(plex-sync): do not run plex sync if no admin exists
This commit is contained in:
@@ -345,7 +345,7 @@ class JobPlexSync {
|
|||||||
|
|
||||||
private log(
|
private log(
|
||||||
message: string,
|
message: string,
|
||||||
level: 'info' | 'error' | 'debug' = 'debug',
|
level: 'info' | 'error' | 'debug' | 'warn' = 'debug',
|
||||||
optional?: Record<string, unknown>
|
optional?: Record<string, unknown>
|
||||||
): void {
|
): void {
|
||||||
logger[level](message, { label: 'Plex Sync', ...optional });
|
logger[level](message, { label: 'Plex Sync', ...optional });
|
||||||
@@ -356,11 +356,15 @@ class JobPlexSync {
|
|||||||
if (!this.running) {
|
if (!this.running) {
|
||||||
this.running = true;
|
this.running = true;
|
||||||
const userRepository = getRepository(User);
|
const userRepository = getRepository(User);
|
||||||
const admin = await userRepository.findOneOrFail({
|
const admin = await userRepository.findOne({
|
||||||
select: ['id', 'plexToken'],
|
select: ['id', 'plexToken'],
|
||||||
order: { id: 'ASC' },
|
order: { id: 'ASC' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!admin) {
|
||||||
|
return this.log('No admin configured. Plex sync skipped.', 'warn');
|
||||||
|
}
|
||||||
|
|
||||||
this.plexClient = new PlexAPI({ plexToken: admin.plexToken });
|
this.plexClient = new PlexAPI({ plexToken: admin.plexToken });
|
||||||
|
|
||||||
this.libraries = settings.plex.libraries.filter(
|
this.libraries = settings.plex.libraries.filter(
|
||||||
|
Reference in New Issue
Block a user