diff --git a/server/api/metadata.ts b/server/api/metadata.ts index cd1936cbf8..339e7daf91 100644 --- a/server/api/metadata.ts +++ b/server/api/metadata.ts @@ -1,7 +1,8 @@ import type { TvShowProvider } from '@server/api/provider'; import TheMovieDb from '@server/api/themoviedb'; import Tvdb from '@server/api/tvdb'; -import { getSettings, MetadataProviderType } from '@server/lib/settings'; +import { MetadataProviderType } from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; export const getMetadataProvider = async ( diff --git a/server/api/plexapi.ts b/server/api/plexapi.ts index 0837569b03..8a6c34a731 100644 --- a/server/api/plexapi.ts +++ b/server/api/plexapi.ts @@ -1,6 +1,6 @@ import ExternalAPI from '@server/api/externalapi'; import { ApiErrorCode } from '@server/constants/error'; -import type { Library, PlexSettings } from '@server/lib/settings'; +import type { Library, PlexSettings } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import { ApiError } from '@server/types/error'; diff --git a/server/api/servarr/base.ts b/server/api/servarr/base.ts index 70b1e8c78d..2d087f633b 100644 --- a/server/api/servarr/base.ts +++ b/server/api/servarr/base.ts @@ -1,7 +1,8 @@ import ExternalAPI from '@server/api/externalapi'; +import type { DVRSettings } from '@server/interfaces/settings'; import type { AvailableCacheIds } from '@server/lib/cache'; import cacheManager from '@server/lib/cache'; -import { getSettings, type DVRSettings } from '@server/lib/settings'; +import { getSettings } from '@server/lib/settings'; export interface SystemStatus { version: string; diff --git a/server/api/tautulli.ts b/server/api/tautulli.ts index 12da124d91..8bedd13fc4 100644 --- a/server/api/tautulli.ts +++ b/server/api/tautulli.ts @@ -1,5 +1,5 @@ import type { User } from '@server/entity/User'; -import type { TautulliSettings } from '@server/lib/settings'; +import type { TautulliSettings } from '@server/interfaces/settings'; import logger from '@server/logger'; import { proxyRequestInterceptor } from '@server/utils/customProxyAgent'; import { userAgentRequestInterceptor } from '@server/utils/userAgent'; diff --git a/server/entity/UserSettings.ts b/server/entity/UserSettings.ts index d0f2ef1f7e..bc105ec2fe 100644 --- a/server/entity/UserSettings.ts +++ b/server/entity/UserSettings.ts @@ -1,6 +1,6 @@ import type { NotificationAgentTypes } from '@server/interfaces/api/userSettingsInterfaces'; +import { NotificationAgentKey } from '@server/interfaces/settings'; import { hasNotificationType, Notification } from '@server/lib/notifications'; -import { NotificationAgentKey } from '@server/lib/settings'; import { Column, Entity, diff --git a/server/interfaces/api/plexInterfaces.ts b/server/interfaces/api/plexInterfaces.ts index 32be891e93..4b8aaa094b 100644 --- a/server/interfaces/api/plexInterfaces.ts +++ b/server/interfaces/api/plexInterfaces.ts @@ -1,4 +1,4 @@ -import type { PlexSettings } from '@server/lib/settings'; +import type { PlexSettings } from '@server/interfaces/settings'; export interface PlexStatus { settings: PlexSettings; diff --git a/server/interfaces/api/userSettingsInterfaces.ts b/server/interfaces/api/userSettingsInterfaces.ts index 57e7b3f614..2c6932a0ae 100644 --- a/server/interfaces/api/userSettingsInterfaces.ts +++ b/server/interfaces/api/userSettingsInterfaces.ts @@ -1,4 +1,4 @@ -import type { NotificationAgentKey } from '@server/lib/settings'; +import type { NotificationAgentKey } from '@server/interfaces/settings'; export interface UserSettingsGeneralResponse { username?: string; diff --git a/server/interfaces/settings.ts b/server/interfaces/settings.ts new file mode 100644 index 0000000000..7988ca7927 --- /dev/null +++ b/server/interfaces/settings.ts @@ -0,0 +1,382 @@ +import type { AvailableLocale } from '@server/types/languages'; + +export interface Library { + id: string; + name: string; + enabled: boolean; + type: 'show' | 'movie'; + lastScan?: number; +} + +export interface Region { + iso_3166_1: string; + english_name: string; + name?: string; +} + +export interface Language { + iso_639_1: string; + english_name: string; + name: string; +} + +export interface PlexSettings { + name: string; + machineId?: string; + ip: string; + port: number; + useSsl?: boolean; + libraries: Library[]; + webAppUrl?: string; +} + +export interface JellyfinSettings { + name: string; + ip: string; + port: number; + useSsl?: boolean; + urlBase?: string; + externalHostname?: string; + jellyfinForgotPasswordUrl?: string; + libraries: Library[]; + serverId: string; + apiKey: string; +} + +export interface TautulliSettings { + hostname?: string; + port?: number; + useSsl?: boolean; + urlBase?: string; + apiKey?: string; + externalUrl?: string; +} + +export interface DVRSettings { + id: number; + name: string; + hostname: string; + port: number; + apiKey: string; + useSsl: boolean; + baseUrl?: string; + activeProfileId: number; + activeProfileName: string; + activeDirectory: string; + tags: number[]; + is4k: boolean; + isDefault: boolean; + externalUrl?: string; + syncEnabled: boolean; + preventSearch: boolean; + tagRequests: boolean; + overrideRule: number[]; +} + +export interface RadarrSettings extends DVRSettings { + minimumAvailability: string; +} + +export interface SonarrSettings extends DVRSettings { + seriesType: 'standard' | 'daily' | 'anime'; + animeSeriesType: 'standard' | 'daily' | 'anime'; + activeAnimeProfileId?: number; + activeAnimeProfileName?: string; + activeAnimeDirectory?: string; + activeAnimeLanguageProfileId?: number; + activeLanguageProfileId?: number; + animeTags?: number[]; + enableSeasonFolders: boolean; + monitorNewItems: 'all' | 'none'; +} + +export interface Quota { + quotaLimit?: number; + quotaDays?: number; +} + +export enum MetadataProviderType { + TMDB = 'tmdb', + TVDB = 'tvdb', +} + +export interface MetadataSettings { + tv: MetadataProviderType; + anime: MetadataProviderType; +} + +export interface ProxySettings { + enabled: boolean; + hostname: string; + port: number; + useSsl: boolean; + user: string; + password: string; + bypassFilter: string; + bypassLocalAddresses: boolean; +} + +export interface MainSettings { + apiKey: string; + applicationTitle: string; + applicationUrl: string; + cacheImages: boolean; + defaultPermissions: number; + defaultQuotas: { + movie: Quota; + tv: Quota; + }; + hideAvailable: boolean; + hideBlocklisted: boolean; + hideRequested: boolean; + localLogin: boolean; + mediaServerLogin: boolean; + newPlexLogin: boolean; + discoverRegion: string; + streamingRegion: string; + originalLanguage: string; + blocklistRegion: string; + blocklistLanguage: string; + blocklistedTags: string; + blocklistedTagsLimit: number; + mediaServerType: number; + partialRequestsEnabled: boolean; + enableSpecialEpisodes: boolean; + locale: string; + youtubeUrl: string; + versionCheck: boolean; +} + +export interface ProxySettings { + enabled: boolean; + hostname: string; + port: number; + useSsl: boolean; + user: string; + password: string; + bypassFilter: string; + bypassLocalAddresses: boolean; +} + +export interface DnsCacheSettings { + enabled: boolean; + forceMinTtl?: number; + forceMaxTtl?: number; +} + +export interface NetworkSettings { + csrfProtection: boolean; + forceIpv4First: boolean; + trustProxy: boolean; + proxy: ProxySettings; + dnsCache: DnsCacheSettings; + apiRequestTimeout: number; +} + +export interface PublicSettings { + initialized: boolean; +} + +export interface FullPublicSettings extends PublicSettings { + applicationTitle: string; + applicationUrl: string; + hideAvailable: boolean; + hideBlocklisted: boolean; + hideRequested: boolean; + localLogin: boolean; + mediaServerLogin: boolean; + movie4kEnabled: boolean; + series4kEnabled: boolean; + discoverRegion: string; + streamingRegion: string; + originalLanguage: string; + mediaServerType: number; + jellyfinExternalHost?: string; + jellyfinForgotPasswordUrl?: string; + jellyfinServerName?: string; + partialRequestsEnabled: boolean; + enableSpecialEpisodes: boolean; + cacheImages: boolean; + vapidPublic: string; + enablePushRegistration: boolean; + locale: string; + emailEnabled: boolean; + userEmailRequired: boolean; + newPlexLogin: boolean; + youtubeUrl: string; + versionCheck: boolean; + plexClientIdentifier: string; +} + +export interface NotificationAgentConfig { + enabled: boolean; + embedPoster: boolean; + types?: number; + options: Record; +} + +export interface NotificationAgentDiscord extends NotificationAgentConfig { + options: { + botUsername?: string; + botAvatarUrl?: string; + webhookUrl: string; + webhookRoleId?: string; + webhookThreadId?: string; + enableMentions: boolean; + locale: AvailableLocale; + useUserLocale: boolean; + }; +} + +export interface NotificationAgentSlack extends NotificationAgentConfig { + options: { + webhookUrl: string; + locale: AvailableLocale; + }; +} + +export interface NotificationAgentEmail extends NotificationAgentConfig { + options: { + userEmailRequired: boolean; + emailFrom: string; + smtpHost: string; + smtpPort: number; + secure: boolean; + ignoreTls: boolean; + requireTls: boolean; + authUser?: string; + authPass?: string; + allowSelfSigned: boolean; + senderName: string; + usePublicLogo: boolean; + pgpPrivateKey?: string; + pgpPassword?: string; + }; +} + +export interface NotificationAgentTelegram extends NotificationAgentConfig { + options: { + botUsername?: string; + botAPI: string; + chatId: string; + messageThreadId: string; + sendSilently: boolean; + }; +} + +export interface NotificationAgentPushbullet extends NotificationAgentConfig { + options: { + accessToken: string; + channelTag?: string; + }; +} + +export interface NotificationAgentPushover extends NotificationAgentConfig { + options: { + accessToken: string; + userToken: string; + sound: string; + }; +} + +export interface NotificationAgentWebhook extends NotificationAgentConfig { + options: { + webhookUrl: string; + jsonPayload: string; + authHeader?: string; + customHeaders?: { key: string; value: string }[]; + supportVariables?: boolean; + }; +} + +export interface NotificationAgentGotify extends NotificationAgentConfig { + options: { + url: string; + token: string; + priority: number; + locale: AvailableLocale; + }; +} + +export interface NotificationAgentNtfy extends NotificationAgentConfig { + options: { + url: string; + topic: string; + tags?: string; + authMethodUsernamePassword?: boolean; + username?: string; + password?: string; + authMethodToken?: boolean; + token?: string; + priority?: number; + locale: AvailableLocale; + }; +} + +export enum NotificationAgentKey { + DISCORD = 'discord', + EMAIL = 'email', + GOTIFY = 'gotify', + NTFY = 'ntfy', + PUSHBULLET = 'pushbullet', + PUSHOVER = 'pushover', + SLACK = 'slack', + TELEGRAM = 'telegram', + WEBHOOK = 'webhook', + WEBPUSH = 'webpush', +} + +export interface NotificationAgents { + discord: NotificationAgentDiscord; + email: NotificationAgentEmail; + gotify: NotificationAgentGotify; + ntfy: NotificationAgentNtfy; + pushbullet: NotificationAgentPushbullet; + pushover: NotificationAgentPushover; + slack: NotificationAgentSlack; + telegram: NotificationAgentTelegram; + webhook: NotificationAgentWebhook; + webpush: NotificationAgentConfig; +} + +export interface NotificationSettings { + agents: NotificationAgents; +} + +export interface JobSettings { + schedule: string; +} + +export type JobId = + | 'plex-recently-added-scan' + | 'plex-full-scan' + | 'plex-watchlist-sync' + | 'plex-refresh-token' + | 'radarr-scan' + | 'sonarr-scan' + | 'download-sync' + | 'download-sync-reset' + | 'jellyfin-recently-added-scan' + | 'jellyfin-full-scan' + | 'image-cache-cleanup' + | 'availability-sync' + | 'process-blocklisted-tags'; + +export interface AllSettings { + clientId: string; + sessionSecret?: string; + vapidPublic: string; + vapidPrivate: string; + main: MainSettings; + plex: PlexSettings; + jellyfin: JellyfinSettings; + tautulli: TautulliSettings; + radarr: RadarrSettings[]; + sonarr: SonarrSettings[]; + public: PublicSettings; + notifications: NotificationSettings; + jobs: Record; + network: NetworkSettings; + metadataSettings: MetadataSettings; + migrations: string[]; +} diff --git a/server/job/schedule.ts b/server/job/schedule.ts index a9afd2f4d6..f90d8b4091 100644 --- a/server/job/schedule.ts +++ b/server/job/schedule.ts @@ -1,4 +1,5 @@ import { MediaServerType } from '@server/constants/server'; +import type { JobId } from '@server/interfaces/settings'; import blocklistedTagsProcessor from '@server/job/blocklistedTagsProcessor'; import availabilitySync from '@server/lib/availabilitySync'; import downloadTracker from '@server/lib/downloadtracker'; @@ -11,7 +12,6 @@ import { 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'; diff --git a/server/lib/availabilitySync.test.ts b/server/lib/availabilitySync.test.ts index 7e861e38c5..513f8adbee 100644 --- a/server/lib/availabilitySync.test.ts +++ b/server/lib/availabilitySync.test.ts @@ -28,8 +28,11 @@ import Media from '@server/entity/Media'; import MediaRequest from '@server/entity/MediaRequest'; import Season from '@server/entity/Season'; import { User } from '@server/entity/User'; +import type { + RadarrSettings, + SonarrSettings, +} from '@server/interfaces/settings'; import availabilitySync from '@server/lib/availabilitySync'; -import type { RadarrSettings, SonarrSettings } from '@server/lib/settings'; import { getSettings } from '@server/lib/settings'; import { setupTestDb } from '@server/test/db'; diff --git a/server/lib/availabilitySync.ts b/server/lib/availabilitySync.ts index 4a700ef355..0670f08e2b 100644 --- a/server/lib/availabilitySync.ts +++ b/server/lib/availabilitySync.ts @@ -17,7 +17,10 @@ import Media from '@server/entity/Media'; import MediaRequest from '@server/entity/MediaRequest'; import type Season from '@server/entity/Season'; import { User } from '@server/entity/User'; -import type { RadarrSettings, SonarrSettings } from '@server/lib/settings'; +import type { + RadarrSettings, + SonarrSettings, +} from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import { getHostname } from '@server/utils/getHostname'; diff --git a/server/lib/email/index.ts b/server/lib/email/index.ts index d34e2c9b75..0f515ae573 100644 --- a/server/lib/email/index.ts +++ b/server/lib/email/index.ts @@ -1,4 +1,4 @@ -import type { NotificationAgentEmail } from '@server/lib/settings'; +import type { NotificationAgentEmail } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import Email from 'email-templates'; import net from 'node:net'; diff --git a/server/lib/notifications/agents/agent.ts b/server/lib/notifications/agents/agent.ts index 952e1acf00..11d74e5316 100644 --- a/server/lib/notifications/agents/agent.ts +++ b/server/lib/notifications/agents/agent.ts @@ -3,7 +3,7 @@ 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 { NotificationAgentConfig } from '@server/interfaces/settings'; import type { Notification } from '..'; export interface NotificationPayload { diff --git a/server/lib/notifications/agents/discord.ts b/server/lib/notifications/agents/discord.ts index 81da3c4c40..81c586c7a1 100644 --- a/server/lib/notifications/agents/discord.ts +++ b/server/lib/notifications/agents/discord.ts @@ -7,8 +7,11 @@ import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentDiscord } from '@server/lib/settings'; -import { NotificationAgentKey, getSettings } from '@server/lib/settings'; +import { + NotificationAgentKey, + type NotificationAgentDiscord, +} from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/email.ts b/server/lib/notifications/agents/email.ts index 4037aa6ad8..4ed8a8a4b1 100644 --- a/server/lib/notifications/agents/email.ts +++ b/server/lib/notifications/agents/email.ts @@ -4,9 +4,12 @@ import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; import { defineMessages, getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; +import { + NotificationAgentKey, + type NotificationAgentEmail, +} from '@server/interfaces/settings'; import PreparedEmail from '@server/lib/email'; -import type { NotificationAgentEmail } from '@server/lib/settings'; -import { NotificationAgentKey, getSettings } from '@server/lib/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; import type { EmailOptions } from 'email-templates'; diff --git a/server/lib/notifications/agents/gotify.ts b/server/lib/notifications/agents/gotify.ts index 8384ab27a6..e2931b3dd7 100644 --- a/server/lib/notifications/agents/gotify.ts +++ b/server/lib/notifications/agents/gotify.ts @@ -1,7 +1,7 @@ import { IssueStatus, IssueTypeName } from '@server/constants/issue'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentGotify } from '@server/lib/settings'; +import type { NotificationAgentGotify } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/ntfy.ts b/server/lib/notifications/agents/ntfy.ts index c9efcbe2f6..97989a0b71 100644 --- a/server/lib/notifications/agents/ntfy.ts +++ b/server/lib/notifications/agents/ntfy.ts @@ -1,7 +1,7 @@ import { IssueStatus, IssueTypeName } from '@server/constants/issue'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentNtfy } from '@server/lib/settings'; +import type { NotificationAgentNtfy } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; diff --git a/server/lib/notifications/agents/pushbullet.ts b/server/lib/notifications/agents/pushbullet.ts index 971c0b3d84..7347e5976b 100644 --- a/server/lib/notifications/agents/pushbullet.ts +++ b/server/lib/notifications/agents/pushbullet.ts @@ -4,8 +4,11 @@ import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentPushbullet } from '@server/lib/settings'; -import { NotificationAgentKey, getSettings } from '@server/lib/settings'; +import { + NotificationAgentKey, + type NotificationAgentPushbullet, +} from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/pushover.ts b/server/lib/notifications/agents/pushover.ts index 065401dc49..7a094cfb8b 100644 --- a/server/lib/notifications/agents/pushover.ts +++ b/server/lib/notifications/agents/pushover.ts @@ -4,8 +4,11 @@ import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentPushover } from '@server/lib/settings'; -import { NotificationAgentKey, getSettings } from '@server/lib/settings'; +import { + NotificationAgentKey, + type NotificationAgentPushover, +} from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/slack.ts b/server/lib/notifications/agents/slack.ts index 33320ff5f1..a512eac64c 100644 --- a/server/lib/notifications/agents/slack.ts +++ b/server/lib/notifications/agents/slack.ts @@ -1,7 +1,7 @@ import { IssueStatus, IssueTypeName } from '@server/constants/issue'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentSlack } from '@server/lib/settings'; +import type { NotificationAgentSlack } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/telegram.ts b/server/lib/notifications/agents/telegram.ts index 6d1bf4d83a..3e8f6d647e 100644 --- a/server/lib/notifications/agents/telegram.ts +++ b/server/lib/notifications/agents/telegram.ts @@ -4,8 +4,11 @@ import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; import { getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentTelegram } from '@server/lib/settings'; -import { NotificationAgentKey, getSettings } from '@server/lib/settings'; +import { + NotificationAgentKey, + type NotificationAgentTelegram, +} from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/webhook.ts b/server/lib/notifications/agents/webhook.ts index 3fdde03ab8..b9023fb50c 100644 --- a/server/lib/notifications/agents/webhook.ts +++ b/server/lib/notifications/agents/webhook.ts @@ -1,6 +1,6 @@ import { IssueStatus, IssueType } from '@server/constants/issue'; import { MediaStatus } from '@server/constants/media'; -import type { NotificationAgentWebhook } from '@server/lib/settings'; +import type { NotificationAgentWebhook } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import axios from 'axios'; diff --git a/server/lib/notifications/agents/webpush.ts b/server/lib/notifications/agents/webpush.ts index 8586dd2960..d4938ee316 100644 --- a/server/lib/notifications/agents/webpush.ts +++ b/server/lib/notifications/agents/webpush.ts @@ -6,8 +6,11 @@ import { User } from '@server/entity/User'; import { UserPushSubscription } from '@server/entity/UserPushSubscription'; import { defineMessages, getIntl } from '@server/i18n'; import globalMessages from '@server/i18n/globalMessages'; -import type { NotificationAgentConfig } from '@server/lib/settings'; -import { NotificationAgentKey, getSettings } from '@server/lib/settings'; +import { + NotificationAgentKey, + type NotificationAgentConfig, +} from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import type { AvailableLocale } from '@server/types/languages'; import webpush from 'web-push'; diff --git a/server/lib/scanners/jellyfin/index.ts b/server/lib/scanners/jellyfin/index.ts index f7b22f3386..16a76cbaba 100644 --- a/server/lib/scanners/jellyfin/index.ts +++ b/server/lib/scanners/jellyfin/index.ts @@ -15,13 +15,13 @@ import type { import { MediaServerType } from '@server/constants/server'; import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; +import type { Library } from '@server/interfaces/settings'; import type { ProcessableSeason, RunnableScanner, StatusBase, } from '@server/lib/scanners/baseScanner'; import BaseScanner from '@server/lib/scanners/baseScanner'; -import type { Library } from '@server/lib/settings'; import { getSettings } from '@server/lib/settings'; import { getHostname } from '@server/utils/getHostname'; import { uniqWith } from 'lodash'; diff --git a/server/lib/scanners/jellyfin/jellyfin.test.ts b/server/lib/scanners/jellyfin/jellyfin.test.ts index 654788b4da..a1a7a9ffc2 100644 --- a/server/lib/scanners/jellyfin/jellyfin.test.ts +++ b/server/lib/scanners/jellyfin/jellyfin.test.ts @@ -20,8 +20,8 @@ import Media from '@server/entity/Media'; import MediaRequest from '@server/entity/MediaRequest'; import Season from '@server/entity/Season'; import { User } from '@server/entity/User'; +import type { Library } from '@server/interfaces/settings'; import { jellyfinFullScanner } from '@server/lib/scanners/jellyfin'; -import type { Library } from '@server/lib/settings'; import { getSettings } from '@server/lib/settings'; import { setupTestDb } from '@server/test/db'; import { runWithMockTimers } from '@server/test/runWithMockTimers'; diff --git a/server/lib/scanners/plex/index.ts b/server/lib/scanners/plex/index.ts index f3eda4a3bc..3dfcda0485 100644 --- a/server/lib/scanners/plex/index.ts +++ b/server/lib/scanners/plex/index.ts @@ -11,6 +11,7 @@ import type { } from '@server/api/themoviedb/interfaces'; import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; +import type { Library } from '@server/interfaces/settings'; import type { MediaIds, ProcessableSeason, @@ -18,7 +19,6 @@ import type { StatusBase, } from '@server/lib/scanners/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'; diff --git a/server/lib/scanners/radarr/index.ts b/server/lib/scanners/radarr/index.ts index 96941b120b..2f03693f44 100644 --- a/server/lib/scanners/radarr/index.ts +++ b/server/lib/scanners/radarr/index.ts @@ -3,12 +3,12 @@ import RadarrAPI from '@server/api/servarr/radarr'; import { MediaStatus, MediaType } from '@server/constants/media'; import { getRepository } from '@server/datasource'; import Media from '@server/entity/Media'; +import type { RadarrSettings } from '@server/interfaces/settings'; 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'; diff --git a/server/lib/scanners/radarr/radarr.test.ts b/server/lib/scanners/radarr/radarr.test.ts index 0ea41958e9..e81cd2aa03 100644 --- a/server/lib/scanners/radarr/radarr.test.ts +++ b/server/lib/scanners/radarr/radarr.test.ts @@ -10,7 +10,7 @@ import Media from '@server/entity/Media'; import MediaRequest from '@server/entity/MediaRequest'; import { User } from '@server/entity/User'; import { radarrScanner } from '@server/lib/scanners/radarr'; -import type { RadarrSettings } from '@server/lib/settings'; +import type { RadarrSettings } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import { setupTestDb } from '@server/test/db'; import { runWithMockTimers } from '@server/test/runWithMockTimers'; diff --git a/server/lib/scanners/sonarr/index.ts b/server/lib/scanners/sonarr/index.ts index 9ede74097b..503f26ee07 100644 --- a/server/lib/scanners/sonarr/index.ts +++ b/server/lib/scanners/sonarr/index.ts @@ -11,13 +11,13 @@ import type { import { MediaStatus, MediaType } from '@server/constants/media'; import { getRepository } from '@server/datasource'; import Media from '@server/entity/Media'; +import type { SonarrSettings } from '@server/interfaces/settings'; import type { ProcessableSeason, RunnableScanner, StatusBase, } from '@server/lib/scanners/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'; diff --git a/server/lib/scanners/sonarr/sonarr.test.ts b/server/lib/scanners/sonarr/sonarr.test.ts index 7d350e6e07..375f585aee 100644 --- a/server/lib/scanners/sonarr/sonarr.test.ts +++ b/server/lib/scanners/sonarr/sonarr.test.ts @@ -16,7 +16,7 @@ import MediaRequest from '@server/entity/MediaRequest'; import Season from '@server/entity/Season'; import { User } from '@server/entity/User'; import { sonarrScanner } from '@server/lib/scanners/sonarr'; -import type { SonarrSettings } from '@server/lib/settings'; +import type { SonarrSettings } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import { setupTestDb } from '@server/test/db'; import { runWithMockTimers } from '@server/test/runWithMockTimers'; diff --git a/server/lib/settings/index.ts b/server/lib/settings/index.ts index a52f8cf4c6..4cd65fe694 100644 --- a/server/lib/settings/index.ts +++ b/server/lib/settings/index.ts @@ -1,7 +1,23 @@ import { MediaServerType } from '@server/constants/server'; +import { + MetadataProviderType, + type AllSettings, + type FullPublicSettings, + type JellyfinSettings, + type JobId, + type JobSettings, + type MainSettings, + type MetadataSettings, + type NetworkSettings, + type NotificationSettings, + type PlexSettings, + type PublicSettings, + type RadarrSettings, + type SonarrSettings, + type TautulliSettings, +} from '@server/interfaces/settings'; import { Permission } from '@server/lib/permissions'; import { runMigrations } from '@server/lib/settings/migrator'; -import type { AvailableLocale } from '@server/types/languages'; import { randomBytes, randomUUID } from 'crypto'; import fs from 'fs/promises'; import { mergeWith } from 'lodash'; @@ -14,385 +30,6 @@ const mergeSettings = (current: T, incoming: Partial): T => Array.isArray(srcValue) ? srcValue : undefined ) as T; -export interface Library { - id: string; - name: string; - enabled: boolean; - type: 'show' | 'movie'; - lastScan?: number; -} - -export interface Region { - iso_3166_1: string; - english_name: string; - name?: string; -} - -export interface Language { - iso_639_1: string; - english_name: string; - name: string; -} - -export interface PlexSettings { - name: string; - machineId?: string; - ip: string; - port: number; - useSsl?: boolean; - libraries: Library[]; - webAppUrl?: string; -} - -export interface JellyfinSettings { - name: string; - ip: string; - port: number; - useSsl?: boolean; - urlBase?: string; - externalHostname?: string; - jellyfinForgotPasswordUrl?: string; - libraries: Library[]; - serverId: string; - apiKey: string; -} -export interface TautulliSettings { - hostname?: string; - port?: number; - useSsl?: boolean; - urlBase?: string; - apiKey?: string; - externalUrl?: string; -} - -export interface DVRSettings { - id: number; - name: string; - hostname: string; - port: number; - apiKey: string; - useSsl: boolean; - baseUrl?: string; - activeProfileId: number; - activeProfileName: string; - activeDirectory: string; - tags: number[]; - is4k: boolean; - isDefault: boolean; - externalUrl?: string; - syncEnabled: boolean; - preventSearch: boolean; - tagRequests: boolean; - overrideRule: number[]; -} - -export interface RadarrSettings extends DVRSettings { - minimumAvailability: string; -} - -export interface SonarrSettings extends DVRSettings { - seriesType: 'standard' | 'daily' | 'anime'; - animeSeriesType: 'standard' | 'daily' | 'anime'; - activeAnimeProfileId?: number; - activeAnimeProfileName?: string; - activeAnimeDirectory?: string; - activeAnimeLanguageProfileId?: number; - activeLanguageProfileId?: number; - animeTags?: number[]; - enableSeasonFolders: boolean; - monitorNewItems: 'all' | 'none'; -} - -interface Quota { - quotaLimit?: number; - quotaDays?: number; -} - -export enum MetadataProviderType { - TMDB = 'tmdb', - TVDB = 'tvdb', -} - -export interface MetadataSettings { - tv: MetadataProviderType; - anime: MetadataProviderType; -} - -export interface ProxySettings { - enabled: boolean; - hostname: string; - port: number; - useSsl: boolean; - user: string; - password: string; - bypassFilter: string; - bypassLocalAddresses: boolean; -} - -export interface MainSettings { - apiKey: string; - applicationTitle: string; - applicationUrl: string; - cacheImages: boolean; - defaultPermissions: number; - defaultQuotas: { - movie: Quota; - tv: Quota; - }; - hideAvailable: boolean; - hideBlocklisted: boolean; - hideRequested: boolean; - localLogin: boolean; - mediaServerLogin: boolean; - newPlexLogin: boolean; - discoverRegion: string; - streamingRegion: string; - originalLanguage: string; - blocklistRegion: string; - blocklistLanguage: string; - blocklistedTags: string; - blocklistedTagsLimit: number; - mediaServerType: number; - partialRequestsEnabled: boolean; - enableSpecialEpisodes: boolean; - locale: string; - youtubeUrl: string; - versionCheck: boolean; -} - -export interface ProxySettings { - enabled: boolean; - hostname: string; - port: number; - useSsl: boolean; - user: string; - password: string; - bypassFilter: string; - bypassLocalAddresses: boolean; -} - -export interface DnsCacheSettings { - enabled: boolean; - forceMinTtl?: number; - forceMaxTtl?: number; -} - -export interface NetworkSettings { - csrfProtection: boolean; - forceIpv4First: boolean; - trustProxy: boolean; - proxy: ProxySettings; - dnsCache: DnsCacheSettings; - apiRequestTimeout: number; -} - -interface PublicSettings { - initialized: boolean; -} - -interface FullPublicSettings extends PublicSettings { - applicationTitle: string; - applicationUrl: string; - hideAvailable: boolean; - hideBlocklisted: boolean; - hideRequested: boolean; - localLogin: boolean; - mediaServerLogin: boolean; - movie4kEnabled: boolean; - series4kEnabled: boolean; - discoverRegion: string; - streamingRegion: string; - originalLanguage: string; - mediaServerType: number; - jellyfinExternalHost?: string; - jellyfinForgotPasswordUrl?: string; - jellyfinServerName?: string; - partialRequestsEnabled: boolean; - enableSpecialEpisodes: boolean; - cacheImages: boolean; - vapidPublic: string; - enablePushRegistration: boolean; - locale: string; - emailEnabled: boolean; - userEmailRequired: boolean; - newPlexLogin: boolean; - youtubeUrl: string; - versionCheck: boolean; - plexClientIdentifier: string; -} - -export interface NotificationAgentConfig { - enabled: boolean; - embedPoster: boolean; - types?: number; - options: Record; -} -export interface NotificationAgentDiscord extends NotificationAgentConfig { - options: { - botUsername?: string; - botAvatarUrl?: string; - webhookUrl: string; - webhookRoleId?: string; - webhookThreadId?: string; - enableMentions: boolean; - locale: AvailableLocale; - useUserLocale: boolean; - }; -} - -export interface NotificationAgentSlack extends NotificationAgentConfig { - options: { - webhookUrl: string; - locale: AvailableLocale; - }; -} - -export interface NotificationAgentEmail extends NotificationAgentConfig { - options: { - userEmailRequired: boolean; - emailFrom: string; - smtpHost: string; - smtpPort: number; - secure: boolean; - ignoreTls: boolean; - requireTls: boolean; - authUser?: string; - authPass?: string; - allowSelfSigned: boolean; - senderName: string; - usePublicLogo: boolean; - pgpPrivateKey?: string; - pgpPassword?: string; - }; -} - -export interface NotificationAgentTelegram extends NotificationAgentConfig { - options: { - botUsername?: string; - botAPI: string; - chatId: string; - messageThreadId: string; - sendSilently: boolean; - }; -} - -export interface NotificationAgentPushbullet extends NotificationAgentConfig { - options: { - accessToken: string; - channelTag?: string; - }; -} - -export interface NotificationAgentPushover extends NotificationAgentConfig { - options: { - accessToken: string; - userToken: string; - sound: string; - }; -} - -export interface NotificationAgentWebhook extends NotificationAgentConfig { - options: { - webhookUrl: string; - jsonPayload: string; - authHeader?: string; - customHeaders?: { key: string; value: string }[]; - supportVariables?: boolean; - }; -} - -export interface NotificationAgentGotify extends NotificationAgentConfig { - options: { - url: string; - token: string; - priority: number; - locale: AvailableLocale; - }; -} - -export interface NotificationAgentNtfy extends NotificationAgentConfig { - options: { - url: string; - topic: string; - tags?: string; - authMethodUsernamePassword?: boolean; - username?: string; - password?: string; - authMethodToken?: boolean; - token?: string; - priority?: number; - locale: AvailableLocale; - }; -} - -export enum NotificationAgentKey { - DISCORD = 'discord', - EMAIL = 'email', - GOTIFY = 'gotify', - NTFY = 'ntfy', - PUSHBULLET = 'pushbullet', - PUSHOVER = 'pushover', - SLACK = 'slack', - TELEGRAM = 'telegram', - WEBHOOK = 'webhook', - WEBPUSH = 'webpush', -} - -interface NotificationAgents { - discord: NotificationAgentDiscord; - email: NotificationAgentEmail; - gotify: NotificationAgentGotify; - ntfy: NotificationAgentNtfy; - pushbullet: NotificationAgentPushbullet; - pushover: NotificationAgentPushover; - slack: NotificationAgentSlack; - telegram: NotificationAgentTelegram; - webhook: NotificationAgentWebhook; - webpush: NotificationAgentConfig; -} - -interface NotificationSettings { - agents: NotificationAgents; -} - -interface JobSettings { - schedule: string; -} - -export type JobId = - | 'plex-recently-added-scan' - | 'plex-full-scan' - | 'plex-watchlist-sync' - | 'plex-refresh-token' - | 'radarr-scan' - | 'sonarr-scan' - | 'download-sync' - | 'download-sync-reset' - | 'jellyfin-recently-added-scan' - | 'jellyfin-full-scan' - | 'image-cache-cleanup' - | 'availability-sync' - | 'process-blocklisted-tags'; - -export interface AllSettings { - clientId: string; - sessionSecret?: string; - vapidPublic: string; - vapidPrivate: string; - main: MainSettings; - plex: PlexSettings; - jellyfin: JellyfinSettings; - tautulli: TautulliSettings; - radarr: RadarrSettings[]; - sonarr: SonarrSettings[]; - public: PublicSettings; - notifications: NotificationSettings; - jobs: Record; - network: NetworkSettings; - metadataSettings: MetadataSettings; - migrations: string[]; -} - const SETTINGS_PATH = process.env.CONFIG_DIRECTORY ? `${process.env.CONFIG_DIRECTORY}/settings.json` : path.join(__dirname, '../../../config/settings.json'); diff --git a/server/lib/settings/migrations/0001_migrate_hostname.ts b/server/lib/settings/migrations/0001_migrate_hostname.ts index ddc8211cf9..6c6fcd801a 100644 --- a/server/lib/settings/migrations/0001_migrate_hostname.ts +++ b/server/lib/settings/migrations/0001_migrate_hostname.ts @@ -1,4 +1,4 @@ -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const migrateHostname = (settings: any): AllSettings => { if (settings.jellyfin?.hostname) { diff --git a/server/lib/settings/migrations/0002_migrate_apitokens.ts b/server/lib/settings/migrations/0002_migrate_apitokens.ts index dcfa327f8e..e64f1bbf64 100644 --- a/server/lib/settings/migrations/0002_migrate_apitokens.ts +++ b/server/lib/settings/migrations/0002_migrate_apitokens.ts @@ -2,7 +2,7 @@ import JellyfinAPI from '@server/api/jellyfin'; import { MediaServerType } from '@server/constants/server'; import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; import { getHostname } from '@server/utils/getHostname'; const migrateApiTokens = async (settings: any): Promise => { diff --git a/server/lib/settings/migrations/0003_emby_media_server_type.ts b/server/lib/settings/migrations/0003_emby_media_server_type.ts index 1671e7a98f..1ebc62acd6 100644 --- a/server/lib/settings/migrations/0003_emby_media_server_type.ts +++ b/server/lib/settings/migrations/0003_emby_media_server_type.ts @@ -1,5 +1,5 @@ import { MediaServerType } from '@server/constants/server'; -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const migrateHostname = (settings: any): AllSettings => { const oldMediaServerType = settings.main.mediaServerType; diff --git a/server/lib/settings/migrations/0004_migrate_region_setting.ts b/server/lib/settings/migrations/0004_migrate_region_setting.ts index a140e07818..b5ae15999a 100644 --- a/server/lib/settings/migrations/0004_migrate_region_setting.ts +++ b/server/lib/settings/migrations/0004_migrate_region_setting.ts @@ -1,4 +1,4 @@ -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const migrateRegionSetting = (settings: any): AllSettings => { if ( diff --git a/server/lib/settings/migrations/0005_migrate_network_settings.ts b/server/lib/settings/migrations/0005_migrate_network_settings.ts index 6d4a826f3e..dd8e6a71d4 100644 --- a/server/lib/settings/migrations/0005_migrate_network_settings.ts +++ b/server/lib/settings/migrations/0005_migrate_network_settings.ts @@ -1,4 +1,4 @@ -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const migrateNetworkSettings = (settings: any): AllSettings => { if (settings.network) { diff --git a/server/lib/settings/migrations/0006_remove_lunasea.ts b/server/lib/settings/migrations/0006_remove_lunasea.ts index e5279afa9c..7f4830bc33 100644 --- a/server/lib/settings/migrations/0006_remove_lunasea.ts +++ b/server/lib/settings/migrations/0006_remove_lunasea.ts @@ -1,4 +1,4 @@ -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const removeLunaSeaSetting = (settings: any): AllSettings => { if ( diff --git a/server/lib/settings/migrations/0007_migrate_arr_tags.ts b/server/lib/settings/migrations/0007_migrate_arr_tags.ts index 3b4ddf5db6..81cd1f602c 100644 --- a/server/lib/settings/migrations/0007_migrate_arr_tags.ts +++ b/server/lib/settings/migrations/0007_migrate_arr_tags.ts @@ -2,7 +2,7 @@ import RadarrAPI from '@server/api/servarr/radarr'; import SonarrAPI from '@server/api/servarr/sonarr'; import { getRepository } from '@server/datasource'; import { User } from '@server/entity/User'; -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const migrationArrTags = async (settings: any): Promise => { if ( diff --git a/server/lib/settings/migrations/0008_migrate_blacklist_to_blocklist.ts b/server/lib/settings/migrations/0008_migrate_blacklist_to_blocklist.ts index c1f2ad1093..dc583d7bf5 100644 --- a/server/lib/settings/migrations/0008_migrate_blacklist_to_blocklist.ts +++ b/server/lib/settings/migrations/0008_migrate_blacklist_to_blocklist.ts @@ -1,4 +1,4 @@ -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; const migrateBlacklistToBlocklist = (settings: any): AllSettings => { if ( diff --git a/server/lib/settings/migrator.ts b/server/lib/settings/migrator.ts index 9395a6a5f7..1ea145497e 100644 --- a/server/lib/settings/migrator.ts +++ b/server/lib/settings/migrator.ts @@ -1,4 +1,4 @@ -import type { AllSettings } from '@server/lib/settings'; +import type { AllSettings } from '@server/interfaces/settings'; import logger from '@server/logger'; import fs from 'fs/promises'; import path from 'path'; diff --git a/server/routes/request.test.ts b/server/routes/request.test.ts index 6e0f27dc24..6c688b7134 100644 --- a/server/routes/request.test.ts +++ b/server/routes/request.test.ts @@ -18,8 +18,11 @@ import OverrideRule from '@server/entity/OverrideRule'; import Season from '@server/entity/Season'; import SeasonRequest from '@server/entity/SeasonRequest'; import { User } from '@server/entity/User'; +import type { + RadarrSettings, + SonarrSettings, +} from '@server/interfaces/settings'; import { Permission } from '@server/lib/permissions'; -import type { RadarrSettings, SonarrSettings } from '@server/lib/settings'; import { getSettings } from '@server/lib/settings'; import { checkUser } from '@server/middleware/auth'; import { MediaRequestSubscriber } from '@server/subscriber/MediaRequestSubscriber'; diff --git a/server/routes/settings/index.ts b/server/routes/settings/index.ts index 44d72676c9..633ae7360f 100644 --- a/server/routes/settings/index.ts +++ b/server/routes/settings/index.ts @@ -14,6 +14,7 @@ import type { LogsResultsResponse, SettingsAboutResponse, } from '@server/interfaces/api/settingsInterfaces'; +import type { JobId, Library, MainSettings } from '@server/interfaces/settings'; import { scheduledJobs } from '@server/job/schedule'; import type { AvailableCacheIds } from '@server/lib/cache'; import cacheManager from '@server/lib/cache'; @@ -21,7 +22,6 @@ import ImageProxy from '@server/lib/imageproxy'; import { Permission } from '@server/lib/permissions'; import { jellyfinFullScanner } from '@server/lib/scanners/jellyfin'; import { plexFullScanner } from '@server/lib/scanners/plex'; -import type { JobId, Library, MainSettings } from '@server/lib/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import { isAuthenticated } from '@server/middleware/auth'; diff --git a/server/routes/settings/metadata.ts b/server/routes/settings/metadata.ts index 8e007f0eda..8ee696a68a 100644 --- a/server/routes/settings/metadata.ts +++ b/server/routes/settings/metadata.ts @@ -1,10 +1,10 @@ import TheMovieDb from '@server/api/themoviedb'; import Tvdb from '@server/api/tvdb'; import { - getSettings, MetadataProviderType, type MetadataSettings, -} from '@server/lib/settings'; +} from '@server/interfaces/settings'; +import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import { Router } from 'express'; diff --git a/server/routes/settings/radarr.ts b/server/routes/settings/radarr.ts index efa5866582..8755330115 100644 --- a/server/routes/settings/radarr.ts +++ b/server/routes/settings/radarr.ts @@ -1,5 +1,5 @@ import RadarrAPI from '@server/api/servarr/radarr'; -import type { RadarrSettings } from '@server/lib/settings'; +import type { RadarrSettings } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import { Router } from 'express'; diff --git a/server/routes/settings/sonarr.ts b/server/routes/settings/sonarr.ts index 84bf4d7932..8ba9d2596d 100644 --- a/server/routes/settings/sonarr.ts +++ b/server/routes/settings/sonarr.ts @@ -1,5 +1,5 @@ import SonarrAPI from '@server/api/servarr/sonarr'; -import type { SonarrSettings } from '@server/lib/settings'; +import type { SonarrSettings } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; import { Router } from 'express'; diff --git a/server/utils/customProxyAgent.test.ts b/server/utils/customProxyAgent.test.ts index c785d08403..e760a8ea9c 100644 --- a/server/utils/customProxyAgent.test.ts +++ b/server/utils/customProxyAgent.test.ts @@ -1,5 +1,5 @@ import ExternalAPI from '@server/api/externalapi'; -import type { ProxySettings } from '@server/lib/settings'; +import type { ProxySettings } from '@server/interfaces/settings'; import createCustomProxyAgent from '@server/utils/customProxyAgent'; import axios, { type AxiosResponse, diff --git a/server/utils/customProxyAgent.ts b/server/utils/customProxyAgent.ts index 020fae3815..f0b4942aaf 100644 --- a/server/utils/customProxyAgent.ts +++ b/server/utils/customProxyAgent.ts @@ -1,4 +1,4 @@ -import type { ProxySettings } from '@server/lib/settings'; +import type { ProxySettings } from '@server/interfaces/settings'; import logger from '@server/logger'; import type { InternalAxiosRequestConfig } from 'axios'; import axios from 'axios'; diff --git a/server/utils/restartFlag.ts b/server/utils/restartFlag.ts index d0a492ba37..7bcbb512bf 100644 --- a/server/utils/restartFlag.ts +++ b/server/utils/restartFlag.ts @@ -1,4 +1,4 @@ -import type { AllSettings, NetworkSettings } from '@server/lib/settings'; +import type { AllSettings, NetworkSettings } from '@server/interfaces/settings'; import { getSettings } from '@server/lib/settings'; class RestartFlag { diff --git a/src/components/LanguageSelector/index.tsx b/src/components/LanguageSelector/index.tsx index 20a36b0d4c..968f4ea4ba 100644 --- a/src/components/LanguageSelector/index.tsx +++ b/src/components/LanguageSelector/index.tsx @@ -1,6 +1,6 @@ import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; -import type { Language } from '@server/lib/settings'; +import type { Language } from '@server/interfaces/settings'; import { sortBy } from 'lodash'; import { useMemo } from 'react'; import { useIntl } from 'react-intl'; diff --git a/src/components/ManageSlideOver/index.tsx b/src/components/ManageSlideOver/index.tsx index a6fd5a1747..f2c40c0949 100644 --- a/src/components/ManageSlideOver/index.tsx +++ b/src/components/ManageSlideOver/index.tsx @@ -26,8 +26,11 @@ import { } from '@server/constants/media'; import { MediaServerType } from '@server/constants/server'; import type { MediaWatchDataResponse } from '@server/interfaces/api/mediaInterfaces'; +import type { + RadarrSettings, + SonarrSettings, +} from '@server/interfaces/settings'; import type { DownloadingItem } from '@server/lib/downloadtracker'; -import type { RadarrSettings, SonarrSettings } from '@server/lib/settings'; import type { MovieDetails } from '@server/models/Movie'; import type { TvDetails } from '@server/models/Tv'; import axios from 'axios'; diff --git a/src/components/RegionSelector/index.tsx b/src/components/RegionSelector/index.tsx index 2789c021f0..3e16545287 100644 --- a/src/components/RegionSelector/index.tsx +++ b/src/components/RegionSelector/index.tsx @@ -8,7 +8,7 @@ import { Transition, } from '@headlessui/react'; import { CheckIcon, ChevronDownIcon } from '@heroicons/react/24/solid'; -import type { Region } from '@server/lib/settings'; +import type { Region } from '@server/interfaces/settings'; import { countries } from 'country-flag-icons'; import 'country-flag-icons/3x2/flags.css'; import { sortBy } from 'lodash'; diff --git a/src/components/Selector/CertificationSelector.tsx b/src/components/Selector/CertificationSelector.tsx index 671c97e5dc..f1cafcda45 100644 --- a/src/components/Selector/CertificationSelector.tsx +++ b/src/components/Selector/CertificationSelector.tsx @@ -1,6 +1,6 @@ import { SmallLoadingSpinner } from '@app/components/Common/LoadingSpinner'; import defineMessages from '@app/utils/defineMessages'; -import type { Region } from '@server/lib/settings'; +import type { Region } from '@server/interfaces/settings'; import React, { useCallback, useEffect, useState } from 'react'; import { useIntl } from 'react-intl'; import AsyncSelect from 'react-select/async'; diff --git a/src/components/Settings/Notifications/NotificationsNtfy/index.tsx b/src/components/Settings/Notifications/NotificationsNtfy/index.tsx index 9e8bb2bedf..1bea688f02 100644 --- a/src/components/Settings/Notifications/NotificationsNtfy/index.tsx +++ b/src/components/Settings/Notifications/NotificationsNtfy/index.tsx @@ -8,7 +8,7 @@ import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; import { isValidURL } from '@app/utils/urlValidationHelper'; import { ArrowDownOnSquareIcon, BeakerIcon } from '@heroicons/react/24/outline'; -import type { NotificationAgentNtfy } from '@server/lib/settings'; +import type { NotificationAgentNtfy } from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Form, Formik } from 'formik'; import { useState } from 'react'; diff --git a/src/components/Settings/OverrideRule/OverrideRuleModal.tsx b/src/components/Settings/OverrideRule/OverrideRuleModal.tsx index 5cdd4fb9dd..8e72f27e6d 100644 --- a/src/components/Settings/OverrideRule/OverrideRuleModal.tsx +++ b/src/components/Settings/OverrideRule/OverrideRuleModal.tsx @@ -12,7 +12,10 @@ import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; import { Transition } from '@headlessui/react'; import type OverrideRule from '@server/entity/OverrideRule'; -import type { RadarrSettings, SonarrSettings } from '@server/lib/settings'; +import type { + RadarrSettings, + SonarrSettings, +} from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Formik } from 'formik'; import { useCallback, useEffect, useState } from 'react'; diff --git a/src/components/Settings/OverrideRule/OverrideRuleTiles.tsx b/src/components/Settings/OverrideRule/OverrideRuleTiles.tsx index 3e434077d0..5a990db3b3 100644 --- a/src/components/Settings/OverrideRule/OverrideRuleTiles.tsx +++ b/src/components/Settings/OverrideRule/OverrideRuleTiles.tsx @@ -10,7 +10,7 @@ import type { Language, RadarrSettings, SonarrSettings, -} from '@server/lib/settings'; +} from '@server/interfaces/settings'; import type { Keyword } from '@server/models/common'; import axios from 'axios'; import { useCallback, useEffect, useState } from 'react'; diff --git a/src/components/Settings/RadarrModal/index.tsx b/src/components/Settings/RadarrModal/index.tsx index cad8fb65f3..d664aa91a9 100644 --- a/src/components/Settings/RadarrModal/index.tsx +++ b/src/components/Settings/RadarrModal/index.tsx @@ -6,7 +6,7 @@ import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; import { isValidURL } from '@app/utils/urlValidationHelper'; import { Transition } from '@headlessui/react'; -import type { RadarrSettings } from '@server/lib/settings'; +import type { RadarrSettings } from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Formik } from 'formik'; import { useCallback, useEffect, useRef, useState } from 'react'; diff --git a/src/components/Settings/SettingsJellyfin.tsx b/src/components/Settings/SettingsJellyfin.tsx index a0b9ac363f..be20ea983a 100644 --- a/src/components/Settings/SettingsJellyfin.tsx +++ b/src/components/Settings/SettingsJellyfin.tsx @@ -11,7 +11,7 @@ import { isValidURL } from '@app/utils/urlValidationHelper'; import { ArrowDownOnSquareIcon } from '@heroicons/react/24/outline'; import { ApiErrorCode } from '@server/constants/error'; import { MediaServerType } from '@server/constants/server'; -import type { JellyfinSettings } from '@server/lib/settings'; +import type { JellyfinSettings } from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Formik } from 'formik'; import { useState } from 'react'; diff --git a/src/components/Settings/SettingsJobsCache/index.tsx b/src/components/Settings/SettingsJobsCache/index.tsx index 70db13a5ef..7c662a8aaf 100644 --- a/src/components/Settings/SettingsJobsCache/index.tsx +++ b/src/components/Settings/SettingsJobsCache/index.tsx @@ -20,7 +20,7 @@ import type { CacheItem, CacheResponse, } from '@server/interfaces/api/settingsInterfaces'; -import type { JobId } from '@server/lib/settings'; +import type { JobId } from '@server/interfaces/settings'; import axios from 'axios'; import cronstrue from 'cronstrue/i18n'; import humanizeDuration from 'humanize-duration'; diff --git a/src/components/Settings/SettingsMain/index.tsx b/src/components/Settings/SettingsMain/index.tsx index 42b38e84d0..f1016c1a6f 100644 --- a/src/components/Settings/SettingsMain/index.tsx +++ b/src/components/Settings/SettingsMain/index.tsx @@ -17,7 +17,7 @@ import { isValidURL } from '@app/utils/urlValidationHelper'; import { ArrowDownOnSquareIcon } from '@heroicons/react/24/outline'; import { ArrowPathIcon } from '@heroicons/react/24/solid'; import type { UserSettingsGeneralResponse } from '@server/interfaces/api/userSettingsInterfaces'; -import type { MainSettings } from '@server/lib/settings'; +import type { MainSettings } from '@server/interfaces/settings'; import type { AvailableLocale } from '@server/types/languages'; import axios from 'axios'; import { Field, Form, Formik } from 'formik'; diff --git a/src/components/Settings/SettingsNetwork/index.tsx b/src/components/Settings/SettingsNetwork/index.tsx index 997f20f4d7..5a2e30eb24 100644 --- a/src/components/Settings/SettingsNetwork/index.tsx +++ b/src/components/Settings/SettingsNetwork/index.tsx @@ -7,7 +7,7 @@ import useToasts from '@app/hooks/useToasts'; import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; import { ArrowDownOnSquareIcon } from '@heroicons/react/24/outline'; -import type { NetworkSettings } from '@server/lib/settings'; +import type { NetworkSettings } from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Form, Formik } from 'formik'; import { useIntl } from 'react-intl'; diff --git a/src/components/Settings/SettingsPlex.tsx b/src/components/Settings/SettingsPlex.tsx index 2945344b73..7b91356207 100644 --- a/src/components/Settings/SettingsPlex.tsx +++ b/src/components/Settings/SettingsPlex.tsx @@ -17,7 +17,10 @@ import { XMarkIcon, } from '@heroicons/react/24/solid'; import type { PlexDevice } from '@server/interfaces/api/plexInterfaces'; -import type { PlexSettings, TautulliSettings } from '@server/lib/settings'; +import type { + PlexSettings, + TautulliSettings, +} from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Formik } from 'formik'; import { orderBy } from 'lodash'; diff --git a/src/components/Settings/SettingsServices.tsx b/src/components/Settings/SettingsServices.tsx index 66179b10b5..ea7dcf44aa 100644 --- a/src/components/Settings/SettingsServices.tsx +++ b/src/components/Settings/SettingsServices.tsx @@ -16,7 +16,10 @@ import { Transition } from '@headlessui/react'; import { PencilIcon, PlusIcon, TrashIcon } from '@heroicons/react/24/solid'; import type OverrideRule from '@server/entity/OverrideRule'; import type { OverrideRuleResultsResponse } from '@server/interfaces/api/overrideRuleInterfaces'; -import type { RadarrSettings, SonarrSettings } from '@server/lib/settings'; +import type { + RadarrSettings, + SonarrSettings, +} from '@server/interfaces/settings'; import axios from 'axios'; import { Fragment, useState } from 'react'; import { useIntl } from 'react-intl'; diff --git a/src/components/Settings/SettingsUsers/index.tsx b/src/components/Settings/SettingsUsers/index.tsx index b69ea2bec4..b67f20f0a9 100644 --- a/src/components/Settings/SettingsUsers/index.tsx +++ b/src/components/Settings/SettingsUsers/index.tsx @@ -11,7 +11,7 @@ import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; import { ArrowDownOnSquareIcon } from '@heroicons/react/24/outline'; import { MediaServerType } from '@server/constants/server'; -import type { MainSettings } from '@server/lib/settings'; +import type { MainSettings } from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Form, Formik } from 'formik'; import { useIntl } from 'react-intl'; diff --git a/src/components/Settings/SonarrModal/index.tsx b/src/components/Settings/SonarrModal/index.tsx index c530ac42e0..47a76043a3 100644 --- a/src/components/Settings/SonarrModal/index.tsx +++ b/src/components/Settings/SonarrModal/index.tsx @@ -6,7 +6,7 @@ import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; import { isValidURL } from '@app/utils/urlValidationHelper'; import { Transition } from '@headlessui/react'; -import type { SonarrSettings } from '@server/lib/settings'; +import type { SonarrSettings } from '@server/interfaces/settings'; import axios from 'axios'; import { Field, Formik } from 'formik'; import { useCallback, useEffect, useRef, useState } from 'react'; diff --git a/src/components/Setup/index.tsx b/src/components/Setup/index.tsx index dbf2f65fd8..823627aaac 100644 --- a/src/components/Setup/index.tsx +++ b/src/components/Setup/index.tsx @@ -15,7 +15,7 @@ import useLocale from '@app/hooks/useLocale'; import useSettings from '@app/hooks/useSettings'; import defineMessages from '@app/utils/defineMessages'; import { MediaServerType } from '@server/constants/server'; -import type { Library } from '@server/lib/settings'; +import type { Library } from '@server/interfaces/settings'; import axios from 'axios'; import Image from 'next/image'; import { useRouter } from 'next/router'; diff --git a/src/hooks/useUser.ts b/src/hooks/useUser.ts index ce990d1454..f2cd977451 100644 --- a/src/hooks/useUser.ts +++ b/src/hooks/useUser.ts @@ -1,7 +1,7 @@ import { UserType } from '@server/constants/user'; +import type { NotificationAgentKey } from '@server/interfaces/settings'; import type { PermissionCheckOptions } from '@server/lib/permissions'; import { hasPermission, Permission } from '@server/lib/permissions'; -import type { NotificationAgentKey } from '@server/lib/settings'; import { useRouter } from 'next/router'; import type { MutatorCallback } from 'swr'; import useSWR from 'swr';