refactor: absolute imports with path alias (#2960) [skip ci]

pull/2962/head
Ryan Cohen 2 years ago committed by GitHub
parent 4b855b8114
commit c6a133d4e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,6 +38,10 @@ module.exports = {
prefer: 'type-imports', prefer: 'type-imports',
}, },
], ],
'no-relative-import-paths/no-relative-import-paths': [
'error',
{ allowSameFolder: true },
],
}, },
overrides: [ overrides: [
{ {
@ -47,7 +51,7 @@ module.exports = {
}, },
}, },
], ],
plugins: ['jsx-a11y', 'react-hooks', 'formatjs'], plugins: ['jsx-a11y', 'react-hooks', 'formatjs', 'no-relative-import-paths'],
settings: { settings: {
react: { react: {
pragma: 'React', pragma: 'React',

@ -15,5 +15,6 @@
"database": "./config/db/db.sqlite3" "database": "./config/db/db.sqlite3"
} }
], ],
"editor.formatOnSave": true "editor.formatOnSave": true,
"typescript.preferences.importModuleSpecifier": "non-relative"
} }

@ -3,16 +3,16 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node --files --project server/tsconfig.json server/index.ts", "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts",
"build:server": "tsc --project server/tsconfig.json && copyfiles -u 2 server/templates/**/*.{html,pug} dist/templates", "build:server": "tsc --project server/tsconfig.json && copyfiles -u 2 server/templates/**/*.{html,pug} dist/templates && tsc-alias -p server/tsconfig.json",
"build:next": "next build", "build:next": "next build",
"build": "yarn build:next && yarn build:server", "build": "yarn build:next && yarn build:server",
"lint": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\" --cache", "lint": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\" --cache",
"start": "NODE_ENV=production node dist/index.js", "start": "NODE_ENV=production node dist/index.js",
"i18n:extract": "extract-messages -l=en -o src/i18n/locale -d en --flat true --overwriteDefault true \"./src/**/!(*.test).{ts,tsx}\"", "i18n:extract": "extract-messages -l=en -o src/i18n/locale -d en --flat true --overwriteDefault true \"./src/**/!(*.test).{ts,tsx}\"",
"migration:generate": "ts-node --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:generate -d server/datasource.ts", "migration:generate": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:generate -d server/datasource.ts",
"migration:create": "ts-node --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:create -d server/datasource.ts", "migration:create": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:create -d server/datasource.ts",
"migration:run": "ts-node --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:run -d server/datasource.ts", "migration:run": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:run -d server/datasource.ts",
"format": "prettier --loglevel warn --write --cache .", "format": "prettier --loglevel warn --write --cache .",
"format:check": "prettier --check --cache .", "format:check": "prettier --check --cache .",
"typecheck": "yarn typecheck:server && yarn typecheck:client", "typecheck": "yarn typecheck:server && yarn typecheck:client",
@ -20,7 +20,7 @@
"typecheck:client": "tsc --noEmit", "typecheck:client": "tsc --noEmit",
"prepare": "husky install", "prepare": "husky install",
"cypress:open": "cypress open", "cypress:open": "cypress open",
"cypress:prepare": "ts-node --files server/scripts/prepareTestDb.ts", "cypress:prepare": "ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/scripts/prepareTestDb.ts",
"cypress:build": "yarn build && yarn cypress:prepare" "cypress:build": "yarn build && yarn cypress:prepare"
}, },
"repository": { "repository": {
@ -139,6 +139,7 @@
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.5.0",
"eslint-plugin-formatjs": "4.1.0", "eslint-plugin-formatjs": "4.1.0",
"eslint-plugin-jsx-a11y": "6.6.1", "eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-no-relative-import-paths": "^1.4.0",
"eslint-plugin-prettier": "4.2.1", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.30.1", "eslint-plugin-react": "7.30.1",
"eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-hooks": "4.6.0",
@ -154,6 +155,8 @@
"semantic-release-docker-buildx": "1.0.1", "semantic-release-docker-buildx": "1.0.1",
"tailwindcss": "3.1.8", "tailwindcss": "3.1.8",
"ts-node": "10.9.1", "ts-node": "10.9.1",
"tsc-alias": "^1.7.0",
"tsconfig-paths": "^4.1.0",
"typescript": "4.7.4" "typescript": "4.7.4"
}, },
"resolutions": { "resolutions": {

@ -1,8 +1,8 @@
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import fs, { promises as fsp } from 'fs'; import fs, { promises as fsp } from 'fs';
import path from 'path'; import path from 'path';
import xml2js from 'xml2js'; import xml2js from 'xml2js';
import logger from '../logger';
const UPDATE_INTERVAL_MSEC = 24 * 3600 * 1000; // how often to download new mapping in milliseconds const UPDATE_INTERVAL_MSEC = 24 * 3600 * 1000; // how often to download new mapping in milliseconds
// originally at https://raw.githubusercontent.com/ScudLee/anime-lists/master/anime-list.xml // originally at https://raw.githubusercontent.com/ScudLee/anime-lists/master/anime-list.xml

@ -1,5 +1,5 @@
import cacheManager from '../lib/cache'; import cacheManager from '@server/lib/cache';
import logger from '../logger'; import logger from '@server/logger';
import ExternalAPI from './externalapi'; import ExternalAPI from './externalapi';
interface GitHubRelease { interface GitHubRelease {

@ -1,7 +1,7 @@
import type { Library, PlexSettings } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import NodePlexAPI from 'plex-api'; import NodePlexAPI from 'plex-api';
import type { Library, PlexSettings } from '../lib/settings';
import { getSettings } from '../lib/settings';
import logger from '../logger';
export interface PlexLibraryItem { export interface PlexLibraryItem {
ratingKey: string; ratingKey: string;

@ -1,8 +1,8 @@
import type { PlexDevice } from '@server/interfaces/api/plexInterfaces';
import cacheManager from '@server/lib/cache';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import xml2js from 'xml2js'; import xml2js from 'xml2js';
import type { PlexDevice } from '../interfaces/api/plexInterfaces';
import cacheManager from '../lib/cache';
import { getSettings } from '../lib/settings';
import logger from '../logger';
import ExternalAPI from './externalapi'; import ExternalAPI from './externalapi';
interface PlexAccountResponse { interface PlexAccountResponse {

@ -1,4 +1,4 @@
import cacheManager from '../lib/cache'; import cacheManager from '@server/lib/cache';
import ExternalAPI from './externalapi'; import ExternalAPI from './externalapi';
interface RTSearchResult { interface RTSearchResult {

@ -1,7 +1,7 @@
import type { AvailableCacheIds } from '../../lib/cache'; import ExternalAPI from '@server/api/externalapi';
import cacheManager from '../../lib/cache'; import type { AvailableCacheIds } from '@server/lib/cache';
import type { DVRSettings } from '../../lib/settings'; import cacheManager from '@server/lib/cache';
import ExternalAPI from '../externalapi'; import type { DVRSettings } from '@server/lib/settings';
export interface SystemStatus { export interface SystemStatus {
version: string; version: string;

@ -1,4 +1,4 @@
import logger from '../../logger'; import logger from '@server/logger';
import ServarrBase from './base'; import ServarrBase from './base';
export interface RadarrMovieOptions { export interface RadarrMovieOptions {

@ -1,4 +1,4 @@
import logger from '../../logger'; import logger from '@server/logger';
import ServarrBase from './base'; import ServarrBase from './base';
interface SonarrSeason { interface SonarrSeason {

@ -1,9 +1,9 @@
import type { User } from '@server/entity/User';
import type { TautulliSettings } from '@server/lib/settings';
import logger from '@server/logger';
import type { AxiosInstance } from 'axios'; import type { AxiosInstance } from 'axios';
import axios from 'axios'; import axios from 'axios';
import { uniqWith } from 'lodash'; import { uniqWith } from 'lodash';
import type { User } from '../entity/User';
import type { TautulliSettings } from '../lib/settings';
import logger from '../logger';
export interface TautulliHistoryRecord { export interface TautulliHistoryRecord {
date: number; date: number;

@ -1,6 +1,6 @@
import ExternalAPI from '@server/api/externalapi';
import cacheManager from '@server/lib/cache';
import { sortBy } from 'lodash'; import { sortBy } from 'lodash';
import cacheManager from '../../lib/cache';
import ExternalAPI from '../externalapi';
import type { import type {
TmdbCollection, TmdbCollection,
TmdbExternalIdResponse, TmdbExternalIdResponse,

@ -1,3 +1,5 @@
import type { IssueType } from '@server/constants/issue';
import { IssueStatus } from '@server/constants/issue';
import { import {
Column, Column,
CreateDateColumn, CreateDateColumn,
@ -7,8 +9,6 @@ import {
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import type { IssueType } from '../constants/issue';
import { IssueStatus } from '../constants/issue';
import IssueComment from './IssueComment'; import IssueComment from './IssueComment';
import Media from './Media'; import Media from './Media';
import { User } from './User'; import { User } from './User';

@ -1,3 +1,11 @@
import RadarrAPI from '@server/api/servarr/radarr';
import SonarrAPI from '@server/api/servarr/sonarr';
import { MediaStatus, MediaType } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import type { DownloadingItem } from '@server/lib/downloadtracker';
import downloadTracker from '@server/lib/downloadtracker';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { import {
AfterLoad, AfterLoad,
Column, Column,
@ -9,14 +17,6 @@ import {
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import RadarrAPI from '../api/servarr/radarr';
import SonarrAPI from '../api/servarr/sonarr';
import { MediaStatus, MediaType } from '../constants/media';
import { getRepository } from '../datasource';
import type { DownloadingItem } from '../lib/downloadtracker';
import downloadTracker from '../lib/downloadtracker';
import { getSettings } from '../lib/settings';
import logger from '../logger';
import Issue from './Issue'; import Issue from './Issue';
import { MediaRequest } from './MediaRequest'; import { MediaRequest } from './MediaRequest';
import Season from './Season'; import Season from './Season';

@ -1,3 +1,23 @@
import type { RadarrMovieOptions } from '@server/api/servarr/radarr';
import RadarrAPI from '@server/api/servarr/radarr';
import type {
AddSeriesOptions,
SonarrSeries,
} from '@server/api/servarr/sonarr';
import SonarrAPI from '@server/api/servarr/sonarr';
import TheMovieDb from '@server/api/themoviedb';
import { ANIME_KEYWORD_ID } from '@server/api/themoviedb/constants';
import {
MediaRequestStatus,
MediaStatus,
MediaType,
} from '@server/constants/media';
import { getRepository } from '@server/datasource';
import type { MediaRequestBody } from '@server/interfaces/api/requestInterfaces';
import notificationManager, { Notification } from '@server/lib/notifications';
import { Permission } from '@server/lib/permissions';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { isEqual, truncate } from 'lodash'; import { isEqual, truncate } from 'lodash';
import { import {
AfterInsert, AfterInsert,
@ -12,19 +32,6 @@ import {
RelationCount, RelationCount,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import type { RadarrMovieOptions } from '../api/servarr/radarr';
import RadarrAPI from '../api/servarr/radarr';
import type { AddSeriesOptions, SonarrSeries } from '../api/servarr/sonarr';
import SonarrAPI from '../api/servarr/sonarr';
import TheMovieDb from '../api/themoviedb';
import { ANIME_KEYWORD_ID } from '../api/themoviedb/constants';
import { MediaRequestStatus, MediaStatus, MediaType } from '../constants/media';
import { getRepository } from '../datasource';
import type { MediaRequestBody } from '../interfaces/api/requestInterfaces';
import notificationManager, { Notification } from '../lib/notifications';
import { Permission } from '../lib/permissions';
import { getSettings } from '../lib/settings';
import logger from '../logger';
import Media from './Media'; import Media from './Media';
import SeasonRequest from './SeasonRequest'; import SeasonRequest from './SeasonRequest';
import { User } from './User'; import { User } from './User';

@ -1,3 +1,4 @@
import { MediaStatus } from '@server/constants/media';
import { import {
Column, Column,
CreateDateColumn, CreateDateColumn,
@ -6,7 +7,6 @@ import {
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import { MediaStatus } from '../constants/media';
import Media from './Media'; import Media from './Media';
@Entity() @Entity()

@ -1,3 +1,4 @@
import { MediaRequestStatus } from '@server/constants/media';
import { import {
Column, Column,
CreateDateColumn, CreateDateColumn,
@ -6,7 +7,6 @@ import {
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import { MediaRequestStatus } from '../constants/media';
import { MediaRequest } from './MediaRequest'; import { MediaRequest } from './MediaRequest';
@Entity() @Entity()

@ -1,3 +1,13 @@
import { MediaRequestStatus, MediaType } from '@server/constants/media';
import { UserType } from '@server/constants/user';
import { getRepository } from '@server/datasource';
import type { QuotaResponse } from '@server/interfaces/api/userInterfaces';
import PreparedEmail from '@server/lib/email';
import type { PermissionCheckOptions } from '@server/lib/permissions';
import { hasPermission, Permission } from '@server/lib/permissions';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { AfterDate } from '@server/utils/dateHelpers';
import bcrypt from 'bcrypt'; import bcrypt from 'bcrypt';
import { randomUUID } from 'crypto'; import { randomUUID } from 'crypto';
import path from 'path'; import path from 'path';
@ -14,16 +24,6 @@ import {
RelationCount, RelationCount,
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import { MediaRequestStatus, MediaType } from '../constants/media';
import { UserType } from '../constants/user';
import { getRepository } from '../datasource';
import type { QuotaResponse } from '../interfaces/api/userInterfaces';
import PreparedEmail from '../lib/email';
import type { PermissionCheckOptions } from '../lib/permissions';
import { hasPermission, Permission } from '../lib/permissions';
import { getSettings } from '../lib/settings';
import logger from '../logger';
import { AfterDate } from '../utils/dateHelpers';
import Issue from './Issue'; import Issue from './Issue';
import { MediaRequest } from './MediaRequest'; import { MediaRequest } from './MediaRequest';
import SeasonRequest from './SeasonRequest'; import SeasonRequest from './SeasonRequest';

@ -1,3 +1,6 @@
import type { NotificationAgentTypes } from '@server/interfaces/api/userSettingsInterfaces';
import { hasNotificationType, Notification } from '@server/lib/notifications';
import { NotificationAgentKey } from '@server/lib/settings';
import { import {
Column, Column,
Entity, Entity,
@ -5,9 +8,6 @@ import {
OneToOne, OneToOne,
PrimaryGeneratedColumn, PrimaryGeneratedColumn,
} from 'typeorm'; } from 'typeorm';
import type { NotificationAgentTypes } from '../interfaces/api/userSettingsInterfaces';
import { hasNotificationType, Notification } from '../lib/notifications';
import { NotificationAgentKey } from '../lib/settings';
import { User } from './User'; import { User } from './User';
export const ALL_NOTIFICATIONS = Object.values(Notification) export const ALL_NOTIFICATIONS = Object.values(Notification)

@ -1,3 +1,24 @@
import PlexAPI from '@server/api/plexapi';
import dataSource, { getRepository } from '@server/datasource';
import { Session } from '@server/entity/Session';
import { User } from '@server/entity/User';
import { startJobs } from '@server/job/schedule';
import notificationManager from '@server/lib/notifications';
import DiscordAgent from '@server/lib/notifications/agents/discord';
import EmailAgent from '@server/lib/notifications/agents/email';
import GotifyAgent from '@server/lib/notifications/agents/gotify';
import LunaSeaAgent from '@server/lib/notifications/agents/lunasea';
import PushbulletAgent from '@server/lib/notifications/agents/pushbullet';
import PushoverAgent from '@server/lib/notifications/agents/pushover';
import SlackAgent from '@server/lib/notifications/agents/slack';
import TelegramAgent from '@server/lib/notifications/agents/telegram';
import WebhookAgent from '@server/lib/notifications/agents/webhook';
import WebPushAgent from '@server/lib/notifications/agents/webpush';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import routes from '@server/routes';
import { getAppVersion } from '@server/utils/appVersion';
import restartFlag from '@server/utils/restartFlag';
import { getClientIp } from '@supercharge/request-ip'; import { getClientIp } from '@supercharge/request-ip';
import { TypeormStore } from 'connect-typeorm/out'; import { TypeormStore } from 'connect-typeorm/out';
import cookieParser from 'cookie-parser'; import cookieParser from 'cookie-parser';
@ -11,27 +32,6 @@ import next from 'next';
import path from 'path'; import path from 'path';
import swaggerUi from 'swagger-ui-express'; import swaggerUi from 'swagger-ui-express';
import YAML from 'yamljs'; import YAML from 'yamljs';
import PlexAPI from './api/plexapi';
import dataSource, { getRepository } from './datasource';
import { Session } from './entity/Session';
import { User } from './entity/User';
import { startJobs } from './job/schedule';
import notificationManager from './lib/notifications';
import DiscordAgent from './lib/notifications/agents/discord';
import EmailAgent from './lib/notifications/agents/email';
import GotifyAgent from './lib/notifications/agents/gotify';
import LunaSeaAgent from './lib/notifications/agents/lunasea';
import PushbulletAgent from './lib/notifications/agents/pushbullet';
import PushoverAgent from './lib/notifications/agents/pushover';
import SlackAgent from './lib/notifications/agents/slack';
import TelegramAgent from './lib/notifications/agents/telegram';
import WebhookAgent from './lib/notifications/agents/webhook';
import WebPushAgent from './lib/notifications/agents/webpush';
import { getSettings } from './lib/settings';
import logger from './logger';
import routes from './routes';
import { getAppVersion } from './utils/appVersion';
import restartFlag from './utils/restartFlag';
const API_SPEC_PATH = path.join(__dirname, '../overseerr-api.yml'); const API_SPEC_PATH = path.join(__dirname, '../overseerr-api.yml');

@ -1,4 +1,4 @@
import type Issue from '../../entity/Issue'; import type Issue from '@server/entity/Issue';
import type { PaginatedResponse } from './common'; import type { PaginatedResponse } from './common';
export interface IssueResultsResponse extends PaginatedResponse { export interface IssueResultsResponse extends PaginatedResponse {

@ -1,5 +1,5 @@
import type Media from '../../entity/Media'; import type Media from '@server/entity/Media';
import type { User } from '../../entity/User'; import type { User } from '@server/entity/User';
import type { PaginatedResponse } from './common'; import type { PaginatedResponse } from './common';
export interface MediaResultsResponse extends PaginatedResponse { export interface MediaResultsResponse extends PaginatedResponse {

@ -1,4 +1,4 @@
import type { PersonCreditCast, PersonCreditCrew } from '../../models/Person'; import type { PersonCreditCast, PersonCreditCrew } from '@server/models/Person';
export interface PersonCombinedCreditsResponse { export interface PersonCombinedCreditsResponse {
id: number; id: number;

@ -1,4 +1,4 @@
import type { PlexSettings } from '../../lib/settings'; import type { PlexSettings } from '@server/lib/settings';
export interface PlexStatus { export interface PlexStatus {
settings: PlexSettings; settings: PlexSettings;

@ -1,5 +1,5 @@
import type { MediaType } from '../../constants/media'; import type { MediaType } from '@server/constants/media';
import type { MediaRequest } from '../../entity/MediaRequest'; import type { MediaRequest } from '@server/entity/MediaRequest';
import type { PaginatedResponse } from './common'; import type { PaginatedResponse } from './common';
export interface RequestResultsResponse extends PaginatedResponse { export interface RequestResultsResponse extends PaginatedResponse {

@ -1,5 +1,5 @@
import type { QualityProfile, RootFolder, Tag } from '../../api/servarr/base'; import type { QualityProfile, RootFolder, Tag } from '@server/api/servarr/base';
import type { LanguageProfile } from '../../api/servarr/sonarr'; import type { LanguageProfile } from '@server/api/servarr/sonarr';
export interface ServiceCommonServer { export interface ServiceCommonServer {
id: number; id: number;

@ -1,6 +1,6 @@
import type Media from '../../entity/Media'; import type Media from '@server/entity/Media';
import type { MediaRequest } from '../../entity/MediaRequest'; import type { MediaRequest } from '@server/entity/MediaRequest';
import type { User } from '../../entity/User'; import type { User } from '@server/entity/User';
import type { PaginatedResponse } from './common'; import type { PaginatedResponse } from './common';
export interface UserResultsResponse extends PaginatedResponse { export interface UserResultsResponse extends PaginatedResponse {

@ -1,4 +1,4 @@
import type { NotificationAgentKey } from '../../lib/settings'; import type { NotificationAgentKey } from '@server/lib/settings';
export interface UserSettingsGeneralResponse { export interface UserSettingsGeneralResponse {
username?: string; username?: string;

@ -1,12 +1,12 @@
import downloadTracker from '@server/lib/downloadtracker';
import { plexFullScanner, plexRecentScanner } from '@server/lib/scanners/plex';
import { radarrScanner } from '@server/lib/scanners/radarr';
import { sonarrScanner } from '@server/lib/scanners/sonarr';
import type { JobId } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import watchlistSync from '@server/lib/watchlistsync';
import logger from '@server/logger';
import schedule from 'node-schedule'; import schedule from 'node-schedule';
import downloadTracker from '../lib/downloadtracker';
import { plexFullScanner, plexRecentScanner } from '../lib/scanners/plex';
import { radarrScanner } from '../lib/scanners/radarr';
import { sonarrScanner } from '../lib/scanners/sonarr';
import type { JobId } from '../lib/settings';
import { getSettings } from '../lib/settings';
import watchlistSync from '../lib/watchlistsync';
import logger from '../logger';
interface ScheduledJob { interface ScheduledJob {
id: JobId; id: JobId;

@ -1,9 +1,9 @@
import RadarrAPI from '@server/api/servarr/radarr';
import SonarrAPI from '@server/api/servarr/sonarr';
import { MediaType } from '@server/constants/media';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { uniqWith } from 'lodash'; import { uniqWith } from 'lodash';
import RadarrAPI from '../api/servarr/radarr';
import SonarrAPI from '../api/servarr/sonarr';
import { MediaType } from '../constants/media';
import logger from '../logger';
import { getSettings } from './settings';
export interface DownloadingItem { export interface DownloadingItem {
mediaType: MediaType; mediaType: MediaType;

@ -1,8 +1,8 @@
import type { NotificationAgentEmail } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import Email from 'email-templates'; import Email from 'email-templates';
import nodemailer from 'nodemailer'; import nodemailer from 'nodemailer';
import { URL } from 'url'; import { URL } from 'url';
import type { NotificationAgentEmail } from '../settings';
import { getSettings } from '../settings';
import { openpgpEncrypt } from './openpgpEncrypt'; import { openpgpEncrypt } from './openpgpEncrypt';
class PreparedEmail extends Email { class PreparedEmail extends Email {

@ -1,8 +1,8 @@
import logger from '@server/logger';
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import * as openpgp from 'openpgp'; import * as openpgp from 'openpgp';
import type { TransformCallback } from 'stream'; import type { TransformCallback } from 'stream';
import { Transform } from 'stream'; import { Transform } from 'stream';
import logger from '../../logger';
interface EncryptorOptions { interface EncryptorOptions {
signingKey?: string; signingKey?: string;

@ -1,10 +1,10 @@
import type Issue from '@server/entity/Issue';
import type IssueComment from '@server/entity/IssueComment';
import type Media from '@server/entity/Media';
import type { MediaRequest } from '@server/entity/MediaRequest';
import type { User } from '@server/entity/User';
import type { NotificationAgentConfig } from '@server/lib/settings';
import type { Notification } from '..'; import type { Notification } from '..';
import type Issue from '../../../entity/Issue';
import type IssueComment from '../../../entity/IssueComment';
import type Media from '../../../entity/Media';
import type { MediaRequest } from '../../../entity/MediaRequest';
import type { User } from '../../../entity/User';
import type { NotificationAgentConfig } from '../../settings';
export interface NotificationPayload { export interface NotificationPayload {
event?: string; event?: string;

@ -1,15 +1,15 @@
import { IssueStatus, IssueTypeName } from '@server/constants/issue';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import type { NotificationAgentDiscord } from '@server/lib/settings';
import { getSettings, NotificationAgentKey } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { import {
hasNotificationType, hasNotificationType,
Notification, Notification,
shouldSendAdminNotification, shouldSendAdminNotification,
} from '..'; } from '..';
import { IssueStatus, IssueTypeName } from '../../../constants/issue';
import { getRepository } from '../../../datasource';
import { User } from '../../../entity/User';
import logger from '../../../logger';
import type { NotificationAgentDiscord } from '../../settings';
import { getSettings, NotificationAgentKey } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,14 +1,14 @@
import { IssueType, IssueTypeName } from '@server/constants/issue';
import { MediaType } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import PreparedEmail from '@server/lib/email';
import type { NotificationAgentEmail } from '@server/lib/settings';
import { getSettings, NotificationAgentKey } from '@server/lib/settings';
import logger from '@server/logger';
import type { EmailOptions } from 'email-templates'; import type { EmailOptions } from 'email-templates';
import path from 'path'; import path from 'path';
import { Notification, shouldSendAdminNotification } from '..'; import { Notification, shouldSendAdminNotification } from '..';
import { IssueType, IssueTypeName } from '../../../constants/issue';
import { MediaType } from '../../../constants/media';
import { getRepository } from '../../../datasource';
import { User } from '../../../entity/User';
import logger from '../../../logger';
import PreparedEmail from '../../email';
import type { NotificationAgentEmail } from '../../settings';
import { getSettings, NotificationAgentKey } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,9 +1,9 @@
import { IssueStatus, IssueTypeName } from '@server/constants/issue';
import type { NotificationAgentGotify } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { hasNotificationType, Notification } from '..'; import { hasNotificationType, Notification } from '..';
import { IssueStatus, IssueTypeName } from '../../../constants/issue';
import logger from '../../../logger';
import type { NotificationAgentGotify } from '../../settings';
import { getSettings } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,10 +1,10 @@
import { IssueStatus, IssueType } from '@server/constants/issue';
import { MediaStatus } from '@server/constants/media';
import type { NotificationAgentLunaSea } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { hasNotificationType, Notification } from '..'; import { hasNotificationType, Notification } from '..';
import { IssueStatus, IssueType } from '../../../constants/issue';
import { MediaStatus } from '../../../constants/media';
import logger from '../../../logger';
import type { NotificationAgentLunaSea } from '../../settings';
import { getSettings } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,16 +1,16 @@
import { IssueStatus, IssueTypeName } from '@server/constants/issue';
import { MediaStatus } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import type { NotificationAgentPushbullet } from '@server/lib/settings';
import { getSettings, NotificationAgentKey } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { import {
hasNotificationType, hasNotificationType,
Notification, Notification,
shouldSendAdminNotification, shouldSendAdminNotification,
} from '..'; } from '..';
import { IssueStatus, IssueTypeName } from '../../../constants/issue';
import { MediaStatus } from '../../../constants/media';
import { getRepository } from '../../../datasource';
import { User } from '../../../entity/User';
import logger from '../../../logger';
import type { NotificationAgentPushbullet } from '../../settings';
import { getSettings, NotificationAgentKey } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,16 +1,16 @@
import { IssueStatus, IssueTypeName } from '@server/constants/issue';
import { MediaStatus } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import type { NotificationAgentPushover } from '@server/lib/settings';
import { getSettings, NotificationAgentKey } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { import {
hasNotificationType, hasNotificationType,
Notification, Notification,
shouldSendAdminNotification, shouldSendAdminNotification,
} from '..'; } from '..';
import { IssueStatus, IssueTypeName } from '../../../constants/issue';
import { MediaStatus } from '../../../constants/media';
import { getRepository } from '../../../datasource';
import { User } from '../../../entity/User';
import logger from '../../../logger';
import type { NotificationAgentPushover } from '../../settings';
import { getSettings, NotificationAgentKey } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,9 +1,9 @@
import { IssueStatus, IssueTypeName } from '@server/constants/issue';
import type { NotificationAgentSlack } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { hasNotificationType, Notification } from '..'; import { hasNotificationType, Notification } from '..';
import { IssueStatus, IssueTypeName } from '../../../constants/issue';
import logger from '../../../logger';
import type { NotificationAgentSlack } from '../../settings';
import { getSettings } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,16 +1,16 @@
import { IssueStatus, IssueTypeName } from '@server/constants/issue';
import { MediaStatus } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import type { NotificationAgentTelegram } from '@server/lib/settings';
import { getSettings, NotificationAgentKey } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { import {
hasNotificationType, hasNotificationType,
Notification, Notification,
shouldSendAdminNotification, shouldSendAdminNotification,
} from '..'; } from '..';
import { IssueStatus, IssueTypeName } from '../../../constants/issue';
import { MediaStatus } from '../../../constants/media';
import { getRepository } from '../../../datasource';
import { User } from '../../../entity/User';
import logger from '../../../logger';
import type { NotificationAgentTelegram } from '../../settings';
import { getSettings, NotificationAgentKey } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,11 +1,11 @@
import { IssueStatus, IssueType } from '@server/constants/issue';
import { MediaStatus } from '@server/constants/media';
import type { NotificationAgentWebhook } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import axios from 'axios'; import axios from 'axios';
import { get } from 'lodash'; import { get } from 'lodash';
import { hasNotificationType, Notification } from '..'; import { hasNotificationType, Notification } from '..';
import { IssueStatus, IssueType } from '../../../constants/issue';
import { MediaStatus } from '../../../constants/media';
import logger from '../../../logger';
import type { NotificationAgentWebhook } from '../../settings';
import { getSettings } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,13 +1,13 @@
import { IssueType, IssueTypeName } from '@server/constants/issue';
import { MediaType } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import { UserPushSubscription } from '@server/entity/UserPushSubscription';
import type { NotificationAgentConfig } from '@server/lib/settings';
import { getSettings, NotificationAgentKey } from '@server/lib/settings';
import logger from '@server/logger';
import webpush from 'web-push'; import webpush from 'web-push';
import { Notification, shouldSendAdminNotification } from '..'; import { Notification, shouldSendAdminNotification } from '..';
import { IssueType, IssueTypeName } from '../../../constants/issue';
import { MediaType } from '../../../constants/media';
import { getRepository } from '../../../datasource';
import { User } from '../../../entity/User';
import { UserPushSubscription } from '../../../entity/UserPushSubscription';
import logger from '../../../logger';
import type { NotificationAgentConfig } from '../../settings';
import { getSettings, NotificationAgentKey } from '../../settings';
import type { NotificationAgent, NotificationPayload } from './agent'; import type { NotificationAgent, NotificationPayload } from './agent';
import { BaseAgent } from './agent'; import { BaseAgent } from './agent';

@ -1,6 +1,6 @@
import type { User } from '../../entity/User'; import type { User } from '@server/entity/User';
import logger from '../../logger'; import { Permission } from '@server/lib/permissions';
import { Permission } from '../permissions'; import logger from '@server/logger';
import type { NotificationAgent, NotificationPayload } from './agents/agent'; import type { NotificationAgent, NotificationPayload } from './agents/agent';
export enum Notification { export enum Notification {

@ -1,12 +1,12 @@
import TheMovieDb from '@server/api/themoviedb';
import { MediaStatus, MediaType } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import Media from '@server/entity/Media';
import Season from '@server/entity/Season';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import AsyncLock from '@server/utils/asyncLock';
import { randomUUID } from 'crypto'; import { randomUUID } from 'crypto';
import TheMovieDb from '../../api/themoviedb';
import { MediaStatus, MediaType } from '../../constants/media';
import { getRepository } from '../../datasource';
import Media from '../../entity/Media';
import Season from '../../entity/Season';
import logger from '../../logger';
import AsyncLock from '../../utils/asyncLock';
import { getSettings } from '../settings';
// Default scan rates (can be overidden) // Default scan rates (can be overidden)
const BUNDLE_SIZE = 20; const BUNDLE_SIZE = 20;

@ -1,20 +1,20 @@
import { uniqWith } from 'lodash'; import animeList from '@server/api/animelist';
import animeList from '../../../api/animelist'; import type { PlexLibraryItem, PlexMetadata } from '@server/api/plexapi';
import type { PlexLibraryItem, PlexMetadata } from '../../../api/plexapi'; import PlexAPI from '@server/api/plexapi';
import PlexAPI from '../../../api/plexapi'; import type { TmdbTvDetails } from '@server/api/themoviedb/interfaces';
import type { TmdbTvDetails } from '../../../api/themoviedb/interfaces'; import { getRepository } from '@server/datasource';
import { getRepository } from '../../../datasource'; import { User } from '@server/entity/User';
import { User } from '../../../entity/User'; import cacheManager from '@server/lib/cache';
import cacheManager from '../../cache';
import type { Library } from '../../settings';
import { getSettings } from '../../settings';
import type { import type {
MediaIds, MediaIds,
ProcessableSeason, ProcessableSeason,
RunnableScanner, RunnableScanner,
StatusBase, StatusBase,
} from '../baseScanner'; } from '@server/lib/scanners/baseScanner';
import BaseScanner from '../baseScanner'; import BaseScanner from '@server/lib/scanners/baseScanner';
import type { Library } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import { uniqWith } from 'lodash';
const imdbRegex = new RegExp(/imdb:\/\/(tt[0-9]+)/); const imdbRegex = new RegExp(/imdb:\/\/(tt[0-9]+)/);
const tmdbRegex = new RegExp(/tmdb:\/\/([0-9]+)/); const tmdbRegex = new RegExp(/tmdb:\/\/([0-9]+)/);

@ -1,10 +1,13 @@
import type { RadarrMovie } from '@server/api/servarr/radarr';
import RadarrAPI from '@server/api/servarr/radarr';
import type {
RunnableScanner,
StatusBase,
} from '@server/lib/scanners/baseScanner';
import BaseScanner from '@server/lib/scanners/baseScanner';
import type { RadarrSettings } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import { uniqWith } from 'lodash'; import { uniqWith } from 'lodash';
import type { RadarrMovie } from '../../../api/servarr/radarr';
import RadarrAPI from '../../../api/servarr/radarr';
import type { RadarrSettings } from '../../settings';
import { getSettings } from '../../settings';
import type { RunnableScanner, StatusBase } from '../baseScanner';
import BaseScanner from '../baseScanner';
type SyncStatus = StatusBase & { type SyncStatus = StatusBase & {
currentServer: RadarrSettings; currentServer: RadarrSettings;

@ -1,17 +1,17 @@
import { uniqWith } from 'lodash'; import type { SonarrSeries } from '@server/api/servarr/sonarr';
import type { SonarrSeries } from '../../../api/servarr/sonarr'; import SonarrAPI from '@server/api/servarr/sonarr';
import SonarrAPI from '../../../api/servarr/sonarr'; import type { TmdbTvDetails } from '@server/api/themoviedb/interfaces';
import type { TmdbTvDetails } from '../../../api/themoviedb/interfaces'; import { getRepository } from '@server/datasource';
import { getRepository } from '../../../datasource'; import Media from '@server/entity/Media';
import Media from '../../../entity/Media';
import type { SonarrSettings } from '../../settings';
import { getSettings } from '../../settings';
import type { import type {
ProcessableSeason, ProcessableSeason,
RunnableScanner, RunnableScanner,
StatusBase, StatusBase,
} from '../baseScanner'; } from '@server/lib/scanners/baseScanner';
import BaseScanner from '../baseScanner'; import BaseScanner from '@server/lib/scanners/baseScanner';
import type { SonarrSettings } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import { uniqWith } from 'lodash';
type SyncStatus = StatusBase & { type SyncStatus = StatusBase & {
currentServer: SonarrSettings; currentServer: SonarrSettings;

@ -1,4 +1,4 @@
import TheMovieDb from '../api/themoviedb'; import TheMovieDb from '@server/api/themoviedb';
import type { import type {
TmdbMovieDetails, TmdbMovieDetails,
TmdbMovieResult, TmdbMovieResult,
@ -9,13 +9,17 @@ import type {
TmdbSearchTvResponse, TmdbSearchTvResponse,
TmdbTvDetails, TmdbTvDetails,
TmdbTvResult, TmdbTvResult,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import { import {
mapMovieDetailsToResult, mapMovieDetailsToResult,
mapPersonDetailsToResult, mapPersonDetailsToResult,
mapTvDetailsToResult, mapTvDetailsToResult,
} from '../models/Search'; } from '@server/models/Search';
import { isMovie, isMovieDetails, isTvDetails } from '../utils/typeHelpers'; import {
isMovie,
isMovieDetails,
isTvDetails,
} from '@server/utils/typeHelpers';
interface SearchProvider { interface SearchProvider {
pattern: RegExp; pattern: RegExp;

@ -1,16 +1,16 @@
import PlexTvAPI from '../api/plextv'; import PlexTvAPI from '@server/api/plextv';
import { MediaStatus, MediaType } from '../constants/media'; import { MediaStatus, MediaType } from '@server/constants/media';
import { getRepository } from '../datasource'; import { getRepository } from '@server/datasource';
import Media from '../entity/Media'; import Media from '@server/entity/Media';
import { import {
DuplicateMediaRequestError, DuplicateMediaRequestError,
MediaRequest, MediaRequest,
NoSeasonsAvailableError, NoSeasonsAvailableError,
QuotaRestrictedError, QuotaRestrictedError,
RequestPermissionError, RequestPermissionError,
} from '../entity/MediaRequest'; } from '@server/entity/MediaRequest';
import { User } from '../entity/User'; import { User } from '@server/entity/User';
import logger from '../logger'; import logger from '@server/logger';
import { Permission } from './permissions'; import { Permission } from './permissions';
class WatchlistSync { class WatchlistSync {

@ -1,7 +1,10 @@
import { getRepository } from '../datasource'; import { getRepository } from '@server/datasource';
import { User } from '../entity/User'; import { User } from '@server/entity/User';
import type { Permission, PermissionCheckOptions } from '../lib/permissions'; import type {
import { getSettings } from '../lib/settings'; Permission,
PermissionCheckOptions,
} from '@server/lib/permissions';
import { getSettings } from '@server/lib/settings';
export const checkUser: Middleware = async (req, _res, next) => { export const checkUser: Middleware = async (req, _res, next) => {
const settings = getSettings(); const settings = getSettings();

@ -1,7 +1,7 @@
import type { TmdbCollection } from '@server/api/themoviedb/interfaces';
import { MediaType } from '@server/constants/media';
import type Media from '@server/entity/Media';
import { sortBy } from 'lodash'; import { sortBy } from 'lodash';
import type { TmdbCollection } from '../api/themoviedb/interfaces';
import { MediaType } from '../constants/media';
import type Media from '../entity/Media';
import type { MovieResult } from './Search'; import type { MovieResult } from './Search';
import { mapMovieResult } from './Search'; import { mapMovieResult } from './Search';

@ -2,8 +2,8 @@ import type {
TmdbMovieDetails, TmdbMovieDetails,
TmdbMovieReleaseResult, TmdbMovieReleaseResult,
TmdbProductionCompany, TmdbProductionCompany,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import type Media from '../entity/Media'; import type Media from '@server/entity/Media';
import type { import type {
Cast, Cast,
Crew, Crew,

@ -2,8 +2,8 @@ import type {
TmdbPersonCreditCast, TmdbPersonCreditCast,
TmdbPersonCreditCrew, TmdbPersonCreditCrew,
TmdbPersonDetails, TmdbPersonDetails,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import type Media from '../entity/Media'; import type Media from '@server/entity/Media';
export interface PersonDetails { export interface PersonDetails {
id: number; id: number;

@ -5,9 +5,9 @@ import type {
TmdbPersonResult, TmdbPersonResult,
TmdbTvDetails, TmdbTvDetails,
TmdbTvResult, TmdbTvResult,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import { MediaType as MainMediaType } from '../constants/media'; import { MediaType as MainMediaType } from '@server/constants/media';
import type Media from '../entity/Media'; import type Media from '@server/entity/Media';
export type MediaType = 'tv' | 'movie' | 'person'; export type MediaType = 'tv' | 'movie' | 'person';

@ -5,8 +5,8 @@ import type {
TmdbTvEpisodeResult, TmdbTvEpisodeResult,
TmdbTvRatingResult, TmdbTvRatingResult,
TmdbTvSeasonResult, TmdbTvSeasonResult,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import type Media from '../entity/Media'; import type Media from '@server/entity/Media';
import type { import type {
Cast, Cast,
Crew, Crew,

@ -7,8 +7,8 @@ import type {
TmdbVideoResult, TmdbVideoResult,
TmdbWatchProviderDetails, TmdbWatchProviderDetails,
TmdbWatchProviders, TmdbWatchProviders,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import type { Video } from '../models/Movie'; import type { Video } from '@server/models/Movie';
export interface ProductionCompany { export interface ProductionCompany {
id: number; id: number;

@ -1,12 +1,12 @@
import PlexTvAPI from '@server/api/plextv';
import { UserType } from '@server/constants/user';
import { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import { Permission } from '@server/lib/permissions';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express'; import { Router } from 'express';
import PlexTvAPI from '../api/plextv';
import { UserType } from '../constants/user';
import { getRepository } from '../datasource';
import { User } from '../entity/User';
import { Permission } from '../lib/permissions';
import { getSettings } from '../lib/settings';
import logger from '../logger';
import { isAuthenticated } from '../middleware/auth';
const authRoutes = Router(); const authRoutes = Router();

@ -1,8 +1,8 @@
import TheMovieDb from '@server/api/themoviedb';
import Media from '@server/entity/Media';
import logger from '@server/logger';
import { mapCollection } from '@server/models/Collection';
import { Router } from 'express'; import { Router } from 'express';
import TheMovieDb from '../api/themoviedb';
import Media from '../entity/Media';
import logger from '../logger';
import { mapCollection } from '../models/Collection';
const collectionRoutes = Router(); const collectionRoutes = Router();

@ -1,21 +1,25 @@
import { Router } from 'express'; import PlexTvAPI from '@server/api/plextv';
import { sortBy } from 'lodash'; import TheMovieDb from '@server/api/themoviedb';
import PlexTvAPI from '../api/plextv'; import { MediaType } from '@server/constants/media';
import TheMovieDb from '../api/themoviedb'; import { getRepository } from '@server/datasource';
import { MediaType } from '../constants/media'; import Media from '@server/entity/Media';
import { getRepository } from '../datasource'; import { User } from '@server/entity/User';
import Media from '../entity/Media';
import { User } from '../entity/User';
import type { import type {
GenreSliderItem, GenreSliderItem,
WatchlistItem, WatchlistItem,
} from '../interfaces/api/discoverInterfaces'; } from '@server/interfaces/api/discoverInterfaces';
import { getSettings } from '../lib/settings'; import { getSettings } from '@server/lib/settings';
import logger from '../logger'; import logger from '@server/logger';
import { mapProductionCompany } from '../models/Movie'; import { mapProductionCompany } from '@server/models/Movie';
import { mapMovieResult, mapPersonResult, mapTvResult } from '../models/Search'; import {
import { mapNetwork } from '../models/Tv'; mapMovieResult,
import { isMovie, isPerson } from '../utils/typeHelpers'; mapPersonResult,
mapTvResult,
} from '@server/models/Search';
import { mapNetwork } from '@server/models/Tv';
import { isMovie, isPerson } from '@server/utils/typeHelpers';
import { Router } from 'express';
import { sortBy } from 'lodash';
export const createTmdbWithRegionLanguage = (user?: User): TheMovieDb => { export const createTmdbWithRegionLanguage = (user?: User): TheMovieDb => {
const settings = getSettings(); const settings = getSettings();

@ -1,21 +1,22 @@
import { Router } from 'express'; import GithubAPI from '@server/api/github';
import GithubAPI from '../api/github'; import TheMovieDb from '@server/api/themoviedb';
import TheMovieDb from '../api/themoviedb';
import type { import type {
TmdbMovieResult, TmdbMovieResult,
TmdbTvResult, TmdbTvResult,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
import type { StatusResponse } from '../interfaces/api/settingsInterfaces'; import type { StatusResponse } from '@server/interfaces/api/settingsInterfaces';
import { Permission } from '../lib/permissions'; import { Permission } from '@server/lib/permissions';
import { getSettings } from '../lib/settings'; import { getSettings } from '@server/lib/settings';
import logger from '../logger'; import logger from '@server/logger';
import { checkUser, isAuthenticated } from '../middleware/auth'; import { checkUser, isAuthenticated } from '@server/middleware/auth';
import { mapProductionCompany } from '../models/Movie'; import { mapProductionCompany } from '@server/models/Movie';
import { mapNetwork } from '../models/Tv'; import { mapNetwork } from '@server/models/Tv';
import { appDataPath, appDataStatus } from '../utils/appDataVolume'; import settingsRoutes from '@server/routes/settings';
import { getAppVersion, getCommitTag } from '../utils/appVersion'; import { appDataPath, appDataStatus } from '@server/utils/appDataVolume';
import restartFlag from '../utils/restartFlag'; import { getAppVersion, getCommitTag } from '@server/utils/appVersion';
import { isPerson } from '../utils/typeHelpers'; import restartFlag from '@server/utils/restartFlag';
import { isPerson } from '@server/utils/typeHelpers';
import { Router } from 'express';
import authRoutes from './auth'; import authRoutes from './auth';
import collectionRoutes from './collection'; import collectionRoutes from './collection';
import discoverRoutes, { createTmdbWithRegionLanguage } from './discover'; import discoverRoutes, { createTmdbWithRegionLanguage } from './discover';
@ -27,7 +28,6 @@ import personRoutes from './person';
import requestRoutes from './request'; import requestRoutes from './request';
import searchRoutes from './search'; import searchRoutes from './search';
import serviceRoutes from './service'; import serviceRoutes from './service';
import settingsRoutes from './settings';
import tvRoutes from './tv'; import tvRoutes from './tv';
import user from './user'; import user from './user';

@ -1,13 +1,13 @@
import { IssueStatus, IssueType } from '@server/constants/issue';
import { getRepository } from '@server/datasource';
import Issue from '@server/entity/Issue';
import IssueComment from '@server/entity/IssueComment';
import Media from '@server/entity/Media';
import type { IssueResultsResponse } from '@server/interfaces/api/issueInterfaces';
import { Permission } from '@server/lib/permissions';
import logger from '@server/logger';
import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express'; import { Router } from 'express';
import { IssueStatus, IssueType } from '../constants/issue';
import { getRepository } from '../datasource';
import Issue from '../entity/Issue';
import IssueComment from '../entity/IssueComment';
import Media from '../entity/Media';
import type { IssueResultsResponse } from '../interfaces/api/issueInterfaces';
import { Permission } from '../lib/permissions';
import logger from '../logger';
import { isAuthenticated } from '../middleware/auth';
const issueRoutes = Router(); const issueRoutes = Router();

@ -1,9 +1,9 @@
import { getRepository } from '@server/datasource';
import IssueComment from '@server/entity/IssueComment';
import { Permission } from '@server/lib/permissions';
import logger from '@server/logger';
import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express'; import { Router } from 'express';
import { getRepository } from '../datasource';
import IssueComment from '../entity/IssueComment';
import { Permission } from '../lib/permissions';
import logger from '../logger';
import { isAuthenticated } from '../middleware/auth';
const issueCommentRoutes = Router(); const issueCommentRoutes = Router();

@ -1,19 +1,19 @@
import { Router } from 'express'; import TautulliAPI from '@server/api/tautulli';
import type { FindOneOptions } from 'typeorm'; import { MediaStatus, MediaType } from '@server/constants/media';
import { In } from 'typeorm'; import { getRepository } from '@server/datasource';
import TautulliAPI from '../api/tautulli'; import Media from '@server/entity/Media';
import { MediaStatus, MediaType } from '../constants/media'; import { User } from '@server/entity/User';
import { getRepository } from '../datasource';
import Media from '../entity/Media';
import { User } from '../entity/User';
import type { import type {
MediaResultsResponse, MediaResultsResponse,
MediaWatchDataResponse, MediaWatchDataResponse,
} from '../interfaces/api/mediaInterfaces'; } from '@server/interfaces/api/mediaInterfaces';
import { Permission } from '../lib/permissions'; import { Permission } from '@server/lib/permissions';
import { getSettings } from '../lib/settings'; import { getSettings } from '@server/lib/settings';
import logger from '../logger'; import logger from '@server/logger';
import { isAuthenticated } from '../middleware/auth'; import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express';
import type { FindOneOptions } from 'typeorm';
import { In } from 'typeorm';
const mediaRoutes = Router(); const mediaRoutes = Router();

@ -1,11 +1,11 @@
import RottenTomatoes from '@server/api/rottentomatoes';
import TheMovieDb from '@server/api/themoviedb';
import { MediaType } from '@server/constants/media';
import Media from '@server/entity/Media';
import logger from '@server/logger';
import { mapMovieDetails } from '@server/models/Movie';
import { mapMovieResult } from '@server/models/Search';
import { Router } from 'express'; import { Router } from 'express';
import RottenTomatoes from '../api/rottentomatoes';
import TheMovieDb from '../api/themoviedb';
import { MediaType } from '../constants/media';
import Media from '../entity/Media';
import logger from '../logger';
import { mapMovieDetails } from '../models/Movie';
import { mapMovieResult } from '../models/Search';
const movieRoutes = Router(); const movieRoutes = Router();

@ -1,12 +1,12 @@
import { Router } from 'express'; import TheMovieDb from '@server/api/themoviedb';
import TheMovieDb from '../api/themoviedb'; import Media from '@server/entity/Media';
import Media from '../entity/Media'; import logger from '@server/logger';
import logger from '../logger';
import { import {
mapCastCredits, mapCastCredits,
mapCrewCredits, mapCrewCredits,
mapPersonDetails, mapPersonDetails,
} from '../models/Person'; } from '@server/models/Person';
import { Router } from 'express';
const personRoutes = Router(); const personRoutes = Router();

@ -1,23 +1,27 @@
import { Router } from 'express'; import {
import { MediaRequestStatus, MediaStatus, MediaType } from '../constants/media'; MediaRequestStatus,
import { getRepository } from '../datasource'; MediaStatus,
import Media from '../entity/Media'; MediaType,
} from '@server/constants/media';
import { getRepository } from '@server/datasource';
import Media from '@server/entity/Media';
import { import {
DuplicateMediaRequestError, DuplicateMediaRequestError,
MediaRequest, MediaRequest,
NoSeasonsAvailableError, NoSeasonsAvailableError,
QuotaRestrictedError, QuotaRestrictedError,
RequestPermissionError, RequestPermissionError,
} from '../entity/MediaRequest'; } from '@server/entity/MediaRequest';
import SeasonRequest from '../entity/SeasonRequest'; import SeasonRequest from '@server/entity/SeasonRequest';
import { User } from '../entity/User'; import { User } from '@server/entity/User';
import type { import type {
MediaRequestBody, MediaRequestBody,
RequestResultsResponse, RequestResultsResponse,
} from '../interfaces/api/requestInterfaces'; } from '@server/interfaces/api/requestInterfaces';
import { Permission } from '../lib/permissions'; import { Permission } from '@server/lib/permissions';
import logger from '../logger'; import logger from '@server/logger';
import { isAuthenticated } from '../middleware/auth'; import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express';
const requestRoutes = Router(); const requestRoutes = Router();

@ -1,10 +1,10 @@
import TheMovieDb from '@server/api/themoviedb';
import type { TmdbSearchMultiResponse } from '@server/api/themoviedb/interfaces';
import Media from '@server/entity/Media';
import { findSearchProvider } from '@server/lib/search';
import logger from '@server/logger';
import { mapSearchResults } from '@server/models/Search';
import { Router } from 'express'; import { Router } from 'express';
import TheMovieDb from '../api/themoviedb';
import type { TmdbSearchMultiResponse } from '../api/themoviedb/interfaces';
import Media from '../entity/Media';
import { findSearchProvider } from '../lib/search';
import logger from '../logger';
import { mapSearchResults } from '../models/Search';
const searchRoutes = Router(); const searchRoutes = Router();

@ -1,13 +1,13 @@
import { Router } from 'express'; import RadarrAPI from '@server/api/servarr/radarr';
import RadarrAPI from '../api/servarr/radarr'; import SonarrAPI from '@server/api/servarr/sonarr';
import SonarrAPI from '../api/servarr/sonarr'; import TheMovieDb from '@server/api/themoviedb';
import TheMovieDb from '../api/themoviedb';
import type { import type {
ServiceCommonServer, ServiceCommonServer,
ServiceCommonServerWithDetails, ServiceCommonServerWithDetails,
} from '../interfaces/api/serviceInterfaces'; } from '@server/interfaces/api/serviceInterfaces';
import { getSettings } from '../lib/settings'; import { getSettings } from '@server/lib/settings';
import logger from '../logger'; import logger from '@server/logger';
import { Router } from 'express';
const serviceRoutes = Router(); const serviceRoutes = Router();

@ -1,3 +1,27 @@
import PlexAPI from '@server/api/plexapi';
import PlexTvAPI from '@server/api/plextv';
import TautulliAPI from '@server/api/tautulli';
import { getRepository } from '@server/datasource';
import Media from '@server/entity/Media';
import { MediaRequest } from '@server/entity/MediaRequest';
import { User } from '@server/entity/User';
import type { PlexConnection } from '@server/interfaces/api/plexInterfaces';
import type {
LogMessage,
LogsResultsResponse,
SettingsAboutResponse,
} from '@server/interfaces/api/settingsInterfaces';
import { scheduledJobs } from '@server/job/schedule';
import type { AvailableCacheIds } from '@server/lib/cache';
import cacheManager from '@server/lib/cache';
import { Permission } from '@server/lib/permissions';
import { plexFullScanner } from '@server/lib/scanners/plex';
import type { MainSettings } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { isAuthenticated } from '@server/middleware/auth';
import { appDataPath } from '@server/utils/appDataVolume';
import { getAppVersion } from '@server/utils/appVersion';
import { Router } from 'express'; import { Router } from 'express';
import rateLimit from 'express-rate-limit'; import rateLimit from 'express-rate-limit';
import fs from 'fs'; import fs from 'fs';
@ -6,30 +30,6 @@ import { rescheduleJob } from 'node-schedule';
import path from 'path'; import path from 'path';
import semver from 'semver'; import semver from 'semver';
import { URL } from 'url'; import { URL } from 'url';
import PlexAPI from '../../api/plexapi';
import PlexTvAPI from '../../api/plextv';
import TautulliAPI from '../../api/tautulli';
import { getRepository } from '../../datasource';
import Media from '../../entity/Media';
import { MediaRequest } from '../../entity/MediaRequest';
import { User } from '../../entity/User';
import type { PlexConnection } from '../../interfaces/api/plexInterfaces';
import type {
LogMessage,
LogsResultsResponse,
SettingsAboutResponse,
} from '../../interfaces/api/settingsInterfaces';
import { scheduledJobs } from '../../job/schedule';
import type { AvailableCacheIds } from '../../lib/cache';
import cacheManager from '../../lib/cache';
import { Permission } from '../../lib/permissions';
import { plexFullScanner } from '../../lib/scanners/plex';
import type { MainSettings } from '../../lib/settings';
import { getSettings } from '../../lib/settings';
import logger from '../../logger';
import { isAuthenticated } from '../../middleware/auth';
import { appDataPath } from '../../utils/appDataVolume';
import { getAppVersion } from '../../utils/appVersion';
import notificationRoutes from './notifications'; import notificationRoutes from './notifications';
import radarrRoutes from './radarr'; import radarrRoutes from './radarr';
import sonarrRoutes from './sonarr'; import sonarrRoutes from './sonarr';

@ -1,18 +1,18 @@
import type { User } from '@server/entity/User';
import { Notification } from '@server/lib/notifications';
import type { NotificationAgent } from '@server/lib/notifications/agents/agent';
import DiscordAgent from '@server/lib/notifications/agents/discord';
import EmailAgent from '@server/lib/notifications/agents/email';
import GotifyAgent from '@server/lib/notifications/agents/gotify';
import LunaSeaAgent from '@server/lib/notifications/agents/lunasea';
import PushbulletAgent from '@server/lib/notifications/agents/pushbullet';
import PushoverAgent from '@server/lib/notifications/agents/pushover';
import SlackAgent from '@server/lib/notifications/agents/slack';
import TelegramAgent from '@server/lib/notifications/agents/telegram';
import WebhookAgent from '@server/lib/notifications/agents/webhook';
import WebPushAgent from '@server/lib/notifications/agents/webpush';
import { getSettings } from '@server/lib/settings';
import { Router } from 'express'; import { Router } from 'express';
import type { User } from '../../entity/User';
import { Notification } from '../../lib/notifications';
import type { NotificationAgent } from '../../lib/notifications/agents/agent';
import DiscordAgent from '../../lib/notifications/agents/discord';
import EmailAgent from '../../lib/notifications/agents/email';
import GotifyAgent from '../../lib/notifications/agents/gotify';
import LunaSeaAgent from '../../lib/notifications/agents/lunasea';
import PushbulletAgent from '../../lib/notifications/agents/pushbullet';
import PushoverAgent from '../../lib/notifications/agents/pushover';
import SlackAgent from '../../lib/notifications/agents/slack';
import TelegramAgent from '../../lib/notifications/agents/telegram';
import WebhookAgent from '../../lib/notifications/agents/webhook';
import WebPushAgent from '../../lib/notifications/agents/webpush';
import { getSettings } from '../../lib/settings';
const notificationRoutes = Router(); const notificationRoutes = Router();

@ -1,8 +1,8 @@
import RadarrAPI from '@server/api/servarr/radarr';
import type { RadarrSettings } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { Router } from 'express'; import { Router } from 'express';
import RadarrAPI from '../../api/servarr/radarr';
import type { RadarrSettings } from '../../lib/settings';
import { getSettings } from '../../lib/settings';
import logger from '../../logger';
const radarrRoutes = Router(); const radarrRoutes = Router();

@ -1,8 +1,8 @@
import SonarrAPI from '@server/api/servarr/sonarr';
import type { SonarrSettings } from '@server/lib/settings';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
import { Router } from 'express'; import { Router } from 'express';
import SonarrAPI from '../../api/servarr/sonarr';
import type { SonarrSettings } from '../../lib/settings';
import { getSettings } from '../../lib/settings';
import logger from '../../logger';
const sonarrRoutes = Router(); const sonarrRoutes = Router();

@ -1,11 +1,11 @@
import RottenTomatoes from '@server/api/rottentomatoes';
import TheMovieDb from '@server/api/themoviedb';
import { MediaType } from '@server/constants/media';
import Media from '@server/entity/Media';
import logger from '@server/logger';
import { mapTvResult } from '@server/models/Search';
import { mapSeasonWithEpisodes, mapTvDetails } from '@server/models/Tv';
import { Router } from 'express'; import { Router } from 'express';
import RottenTomatoes from '../api/rottentomatoes';
import TheMovieDb from '../api/themoviedb';
import { MediaType } from '../constants/media';
import Media from '../entity/Media';
import logger from '../logger';
import { mapTvResult } from '../models/Search';
import { mapSeasonWithEpisodes, mapTvDetails } from '../models/Tv';
const tvRoutes = Router(); const tvRoutes = Router();

@ -1,26 +1,26 @@
import { Router } from 'express'; import PlexTvAPI from '@server/api/plextv';
import gravatarUrl from 'gravatar-url'; import TautulliAPI from '@server/api/tautulli';
import { findIndex, sortBy } from 'lodash'; import { MediaType } from '@server/constants/media';
import { In } from 'typeorm'; import { UserType } from '@server/constants/user';
import PlexTvAPI from '../../api/plextv'; import { getRepository } from '@server/datasource';
import TautulliAPI from '../../api/tautulli'; import Media from '@server/entity/Media';
import { MediaType } from '../../constants/media'; import { MediaRequest } from '@server/entity/MediaRequest';
import { UserType } from '../../constants/user'; import { User } from '@server/entity/User';
import { getRepository } from '../../datasource'; import { UserPushSubscription } from '@server/entity/UserPushSubscription';
import Media from '../../entity/Media';
import { MediaRequest } from '../../entity/MediaRequest';
import { User } from '../../entity/User';
import { UserPushSubscription } from '../../entity/UserPushSubscription';
import type { import type {
QuotaResponse, QuotaResponse,
UserRequestsResponse, UserRequestsResponse,
UserResultsResponse, UserResultsResponse,
UserWatchDataResponse, UserWatchDataResponse,
} from '../../interfaces/api/userInterfaces'; } from '@server/interfaces/api/userInterfaces';
import { hasPermission, Permission } from '../../lib/permissions'; import { hasPermission, Permission } from '@server/lib/permissions';
import { getSettings } from '../../lib/settings'; import { getSettings } from '@server/lib/settings';
import logger from '../../logger'; import logger from '@server/logger';
import { isAuthenticated } from '../../middleware/auth'; import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express';
import gravatarUrl from 'gravatar-url';
import { findIndex, sortBy } from 'lodash';
import { In } from 'typeorm';
import userSettingsRoutes from './usersettings'; import userSettingsRoutes from './usersettings';
const router = Router(); const router = Router();

@ -1,16 +1,16 @@
import { Router } from 'express'; import { getRepository } from '@server/datasource';
import { canMakePermissionsChange } from '.'; import { User } from '@server/entity/User';
import { getRepository } from '../../datasource'; import { UserSettings } from '@server/entity/UserSettings';
import { User } from '../../entity/User';
import { UserSettings } from '../../entity/UserSettings';
import type { import type {
UserSettingsGeneralResponse, UserSettingsGeneralResponse,
UserSettingsNotificationsResponse, UserSettingsNotificationsResponse,
} from '../../interfaces/api/userSettingsInterfaces'; } from '@server/interfaces/api/userSettingsInterfaces';
import { Permission } from '../../lib/permissions'; import { Permission } from '@server/lib/permissions';
import { getSettings } from '../../lib/settings'; import { getSettings } from '@server/lib/settings';
import logger from '../../logger'; import logger from '@server/logger';
import { isAuthenticated } from '../../middleware/auth'; import { isAuthenticated } from '@server/middleware/auth';
import { Router } from 'express';
import { canMakePermissionsChange } from '.';
const isOwnProfileOrAdmin = (): Middleware => { const isOwnProfileOrAdmin = (): Middleware => {
const authMiddleware: Middleware = (req, res, next) => { const authMiddleware: Middleware = (req, res, next) => {

@ -1,8 +1,8 @@
import { UserType } from '@server/constants/user';
import dataSource, { getRepository } from '@server/datasource';
import { User } from '@server/entity/User';
import { copyFileSync } from 'fs'; import { copyFileSync } from 'fs';
import path from 'path'; import path from 'path';
import { UserType } from '../constants/user';
import dataSource, { getRepository } from '../datasource';
import { User } from '../entity/User';
const prepareDb = async () => { const prepareDb = async () => {
// Copy over test settings.json // Copy over test settings.json

@ -1,15 +1,15 @@
import TheMovieDb from '@server/api/themoviedb';
import { IssueType, IssueTypeName } from '@server/constants/issue';
import { MediaType } from '@server/constants/media';
import { getRepository } from '@server/datasource';
import IssueComment from '@server/entity/IssueComment';
import Media from '@server/entity/Media';
import notificationManager, { Notification } from '@server/lib/notifications';
import { Permission } from '@server/lib/permissions';
import logger from '@server/logger';
import { sortBy } from 'lodash'; import { sortBy } from 'lodash';
import type { EntitySubscriberInterface, InsertEvent } from 'typeorm'; import type { EntitySubscriberInterface, InsertEvent } from 'typeorm';
import { EventSubscriber } from 'typeorm'; import { EventSubscriber } from 'typeorm';
import TheMovieDb from '../api/themoviedb';
import { IssueType, IssueTypeName } from '../constants/issue';
import { MediaType } from '../constants/media';
import { getRepository } from '../datasource';
import IssueComment from '../entity/IssueComment';
import Media from '../entity/Media';
import notificationManager, { Notification } from '../lib/notifications';
import { Permission } from '../lib/permissions';
import logger from '../logger';
@EventSubscriber() @EventSubscriber()
export class IssueCommentSubscriber export class IssueCommentSubscriber

@ -1,3 +1,10 @@
import TheMovieDb from '@server/api/themoviedb';
import { IssueStatus, IssueType, IssueTypeName } from '@server/constants/issue';
import { MediaType } from '@server/constants/media';
import Issue from '@server/entity/Issue';
import notificationManager, { Notification } from '@server/lib/notifications';
import { Permission } from '@server/lib/permissions';
import logger from '@server/logger';
import { sortBy } from 'lodash'; import { sortBy } from 'lodash';
import type { import type {
EntitySubscriberInterface, EntitySubscriberInterface,
@ -5,13 +12,6 @@ import type {
UpdateEvent, UpdateEvent,
} from 'typeorm'; } from 'typeorm';
import { EventSubscriber } from 'typeorm'; import { EventSubscriber } from 'typeorm';
import TheMovieDb from '../api/themoviedb';
import { IssueStatus, IssueType, IssueTypeName } from '../constants/issue';
import { MediaType } from '../constants/media';
import Issue from '../entity/Issue';
import notificationManager, { Notification } from '../lib/notifications';
import { Permission } from '../lib/permissions';
import logger from '../logger';
@EventSubscriber() @EventSubscriber()
export class IssueSubscriber implements EntitySubscriberInterface<Issue> { export class IssueSubscriber implements EntitySubscriberInterface<Issue> {

@ -1,14 +1,18 @@
import TheMovieDb from '@server/api/themoviedb';
import {
MediaRequestStatus,
MediaStatus,
MediaType,
} from '@server/constants/media';
import { getRepository } from '@server/datasource';
import Media from '@server/entity/Media';
import { MediaRequest } from '@server/entity/MediaRequest';
import Season from '@server/entity/Season';
import notificationManager, { Notification } from '@server/lib/notifications';
import logger from '@server/logger';
import { truncate } from 'lodash'; import { truncate } from 'lodash';
import type { EntitySubscriberInterface, UpdateEvent } from 'typeorm'; import type { EntitySubscriberInterface, UpdateEvent } from 'typeorm';
import { EventSubscriber, In, Not } from 'typeorm'; import { EventSubscriber, In, Not } from 'typeorm';
import TheMovieDb from '../api/themoviedb';
import { MediaRequestStatus, MediaStatus, MediaType } from '../constants/media';
import { getRepository } from '../datasource';
import Media from '../entity/Media';
import { MediaRequest } from '../entity/MediaRequest';
import Season from '../entity/Season';
import notificationManager, { Notification } from '../lib/notifications';
import logger from '../logger';
@EventSubscriber() @EventSubscriber()
export class MediaSubscriber implements EntitySubscriberInterface<Media> { export class MediaSubscriber implements EntitySubscriberInterface<Media> {

@ -4,7 +4,11 @@
"target": "ES2020", "target": "ES2020",
"module": "commonjs", "module": "commonjs",
"outDir": "../dist", "outDir": "../dist",
"noEmit": false "noEmit": false,
"baseUrl": ".",
"paths": {
"@server/*": ["*"]
}
}, },
"include": ["**/*.ts"] "include": ["**/*.ts"]
} }

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */
import type { User } from '@server/entity/User';
import type { NextFunction, Request, Response } from 'express'; import type { NextFunction, Request, Response } from 'express';
import type { User } from '../entity/User';
declare global { declare global {
namespace Express { namespace Express {

@ -1,6 +1,6 @@
import logger from '@server/logger';
import { existsSync } from 'fs'; import { existsSync } from 'fs';
import path from 'path'; import path from 'path';
import logger from '../logger';
const COMMIT_TAG_PATH = path.join(__dirname, '../../committag.json'); const COMMIT_TAG_PATH = path.join(__dirname, '../../committag.json');
let commitTag = 'local'; let commitTag = 'local';

@ -1,5 +1,5 @@
import type { MainSettings } from '../lib/settings'; import type { MainSettings } from '@server/lib/settings';
import { getSettings } from '../lib/settings'; import { getSettings } from '@server/lib/settings';
class RestartFlag { class RestartFlag {
private settings: MainSettings; private settings: MainSettings;

@ -5,7 +5,7 @@ import type {
TmdbPersonResult, TmdbPersonResult,
TmdbTvDetails, TmdbTvDetails,
TmdbTvResult, TmdbTvResult,
} from '../api/themoviedb/interfaces'; } from '@server/api/themoviedb/interfaces';
export const isMovie = ( export const isMovie = (
movie: TmdbMovieResult | TmdbTvResult | TmdbPersonResult movie: TmdbMovieResult | TmdbTvResult | TmdbPersonResult

@ -1,6 +1,6 @@
import Alert from '@app/components/Common/Alert';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import useSWR from 'swr'; import useSWR from 'swr';
import Alert from '../Common/Alert';
const messages = defineMessages({ const messages = defineMessages({
dockerVolumeMissingDescription: dockerVolumeMissingDescription:

@ -1,24 +1,24 @@
import ButtonWithDropdown from '@app/components/Common/ButtonWithDropdown';
import CachedImage from '@app/components/Common/CachedImage';
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import RequestModal from '@app/components/RequestModal';
import Slider from '@app/components/Slider';
import StatusBadge from '@app/components/StatusBadge';
import TitleCard from '@app/components/TitleCard';
import useSettings from '@app/hooks/useSettings';
import { Permission, useUser } from '@app/hooks/useUser';
import globalMessages from '@app/i18n/globalMessages';
import Error from '@app/pages/_error';
import { DownloadIcon } from '@heroicons/react/outline'; import { DownloadIcon } from '@heroicons/react/outline';
import { MediaStatus } from '@server/constants/media';
import type { Collection } from '@server/models/Collection';
import { uniq } from 'lodash'; import { uniq } from 'lodash';
import Link from 'next/link'; import Link from 'next/link';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useState } from 'react'; import { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import useSWR from 'swr'; import useSWR from 'swr';
import { MediaStatus } from '../../../server/constants/media';
import type { Collection } from '../../../server/models/Collection';
import useSettings from '../../hooks/useSettings';
import { Permission, useUser } from '../../hooks/useUser';
import globalMessages from '../../i18n/globalMessages';
import Error from '../../pages/_error';
import ButtonWithDropdown from '../Common/ButtonWithDropdown';
import CachedImage from '../Common/CachedImage';
import LoadingSpinner from '../Common/LoadingSpinner';
import PageTitle from '../Common/PageTitle';
import RequestModal from '../RequestModal';
import Slider from '../Slider';
import StatusBadge from '../StatusBadge';
import TitleCard from '../TitleCard';
const messages = defineMessages({ const messages = defineMessages({
overview: 'Overview', overview: 'Overview',

@ -1,9 +1,9 @@
import Transition from '@app/components/Transition';
import useClickOutside from '@app/hooks/useClickOutside';
import { withProperties } from '@app/utils/typeHelpers';
import { ChevronDownIcon } from '@heroicons/react/solid'; import { ChevronDownIcon } from '@heroicons/react/solid';
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'; import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import useClickOutside from '../../../hooks/useClickOutside';
import { withProperties } from '../../../utils/typeHelpers';
import Transition from '../../Transition';
interface DropdownItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> { interface DropdownItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
buttonType?: 'primary' | 'ghost'; buttonType?: 'primary' | 'ghost';

@ -1,6 +1,6 @@
import useSettings from '@app/hooks/useSettings';
import type { ImageProps } from 'next/image'; import type { ImageProps } from 'next/image';
import Image from 'next/image'; import Image from 'next/image';
import useSettings from '../../../hooks/useSettings';
/** /**
* The CachedImage component should be used wherever * The CachedImage component should be used wherever

@ -1,6 +1,6 @@
import Button from '@app/components/Common/Button';
import useClickOutside from '@app/hooks/useClickOutside';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import useClickOutside from '../../../hooks/useClickOutside';
import Button from '../Button';
interface ConfirmButtonProps { interface ConfirmButtonProps {
onClick: () => void; onClick: () => void;

@ -1,6 +1,6 @@
import CachedImage from '@app/components/Common/CachedImage';
import type { ForwardRefRenderFunction, HTMLAttributes } from 'react'; import type { ForwardRefRenderFunction, HTMLAttributes } from 'react';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import CachedImage from '../CachedImage';
interface ImageFaderProps extends HTMLAttributes<HTMLDivElement> { interface ImageFaderProps extends HTMLAttributes<HTMLDivElement> {
backgroundImages: string[]; backgroundImages: string[];

@ -1,4 +1,4 @@
import { withProperties } from '../../../utils/typeHelpers'; import { withProperties } from '@app/utils/typeHelpers';
interface ListItemProps { interface ListItemProps {
title: string; title: string;

@ -1,15 +1,15 @@
import { useIntl } from 'react-intl'; import PersonCard from '@app/components/PersonCard';
import type { WatchlistItem } from '../../../../server/interfaces/api/discoverInterfaces'; import TitleCard from '@app/components/TitleCard';
import TmdbTitleCard from '@app/components/TitleCard/TmdbTitleCard';
import useVerticalScroll from '@app/hooks/useVerticalScroll';
import globalMessages from '@app/i18n/globalMessages';
import type { WatchlistItem } from '@server/interfaces/api/discoverInterfaces';
import type { import type {
MovieResult, MovieResult,
PersonResult, PersonResult,
TvResult, TvResult,
} from '../../../../server/models/Search'; } from '@server/models/Search';
import useVerticalScroll from '../../../hooks/useVerticalScroll'; import { useIntl } from 'react-intl';
import globalMessages from '../../../i18n/globalMessages';
import PersonCard from '../../PersonCard';
import TitleCard from '../../TitleCard';
import TmdbTitleCard from '../../TitleCard/TmdbTitleCard';
type ListViewProps = { type ListViewProps = {
items?: (TvResult | MovieResult | PersonResult)[]; items?: (TvResult | MovieResult | PersonResult)[];

@ -1,15 +1,15 @@
import type { ButtonType } from '@app/components/Common/Button';
import Button from '@app/components/Common/Button';
import CachedImage from '@app/components/Common/CachedImage';
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import Transition from '@app/components/Transition';
import useClickOutside from '@app/hooks/useClickOutside';
import { useLockBodyScroll } from '@app/hooks/useLockBodyScroll';
import globalMessages from '@app/i18n/globalMessages';
import type { MouseEvent } from 'react'; import type { MouseEvent } from 'react';
import { useRef } from 'react'; import { useRef } from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import useClickOutside from '../../../hooks/useClickOutside';
import { useLockBodyScroll } from '../../../hooks/useLockBodyScroll';
import globalMessages from '../../../i18n/globalMessages';
import Transition from '../../Transition';
import type { ButtonType } from '../Button';
import Button from '../Button';
import CachedImage from '../CachedImage';
import LoadingSpinner from '../LoadingSpinner';
interface ModalProps { interface ModalProps {
title?: string; title?: string;

@ -1,5 +1,5 @@
import useSettings from '@app/hooks/useSettings';
import Head from 'next/head'; import Head from 'next/head';
import useSettings from '../../../hooks/useSettings';
interface PageTitleProps { interface PageTitleProps {
title: string | (string | undefined)[]; title: string | (string | undefined)[];

@ -1,4 +1,4 @@
import ButtonWithDropdown from '../ButtonWithDropdown'; import ButtonWithDropdown from '@app/components/Common/ButtonWithDropdown';
interface PlayButtonProps { interface PlayButtonProps {
links: PlayButtonLink[]; links: PlayButtonLink[];

@ -1,8 +1,8 @@
import { useUser } from '@app/hooks/useUser';
import type { Permission } from '@server/lib/permissions';
import { hasPermission } from '@server/lib/permissions';
import Link from 'next/link'; import Link from 'next/link';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import type { Permission } from '../../../../server/lib/permissions';
import { hasPermission } from '../../../../server/lib/permissions';
import { useUser } from '../../../hooks/useUser';
export interface SettingsRoute { export interface SettingsRoute {
text: string; text: string;

@ -1,9 +1,9 @@
/* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/click-events-have-key-events */
import Transition from '@app/components/Transition';
import { useLockBodyScroll } from '@app/hooks/useLockBodyScroll';
import { XIcon } from '@heroicons/react/outline'; import { XIcon } from '@heroicons/react/outline';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { useLockBodyScroll } from '../../../hooks/useLockBodyScroll';
import Transition from '../../Transition';
interface SlideOverProps { interface SlideOverProps {
show?: boolean; show?: boolean;

@ -1,4 +1,4 @@
import { withProperties } from '../../../utils/typeHelpers'; import { withProperties } from '@app/utils/typeHelpers';
type TBodyProps = { type TBodyProps = {
children: React.ReactNode; children: React.ReactNode;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save