Compare commits

..

3 Commits

Author SHA1 Message Date
Gauthier
4e741051f3 fix: use undici proxy agent 2024-10-22 23:18:51 +02:00
Gauthier
daecb6b6cf feat: add a proxy option into settings 2024-10-19 00:19:23 +02:00
Gauthier
d99ae35c2e feat: add a proxy option into settings 2024-10-19 00:18:30 +02:00
40 changed files with 136 additions and 108 deletions

View File

@@ -93,7 +93,8 @@
"sqlite3": "5.1.4",
"swagger-ui-express": "4.6.2",
"swr": "2.2.5",
"typeorm": "0.3.12",
"typeorm": "0.3.11",
"undici": "^6.20.1",
"web-push": "3.5.0",
"winston": "3.8.2",
"winston-daily-rotate-file": "4.7.1",

65
pnpm-lock.yaml generated
View File

@@ -49,7 +49,7 @@ importers:
version: 2.11.0
connect-typeorm:
specifier: 1.1.4
version: 1.1.4(typeorm@0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)))
version: 1.1.4(typeorm@0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)))
cookie-parser:
specifier: 1.4.6
version: 1.4.6
@@ -192,8 +192,11 @@ importers:
specifier: 2.2.5
version: 2.2.5(react@18.3.1)
typeorm:
specifier: 0.3.12
version: 0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))
specifier: 0.3.11
version: 0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))
undici:
specifier: ^6.20.1
version: 6.20.1
web-push:
specifier: 3.5.0
version: 3.5.0
@@ -4264,10 +4267,6 @@ packages:
resolution: {integrity: sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==}
engines: {node: '>=0.11'}
date-fns@2.30.0:
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
engines: {node: '>=0.11'}
dateformat@3.0.3:
resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==}
@@ -5389,8 +5388,8 @@ packages:
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'}
https-proxy-agent@7.0.4:
resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==}
https-proxy-agent@7.0.5:
resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==}
engines: {node: '>= 14'}
human-signals@1.1.1:
@@ -6554,11 +6553,6 @@ packages:
engines: {node: '>=10'}
hasBin: true
mkdirp@2.1.6:
resolution: {integrity: sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==}
engines: {node: '>=10'}
hasBin: true
modify-values@1.0.1:
resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==}
engines: {node: '>=0.10.0'}
@@ -7730,9 +7724,6 @@ packages:
reflect-metadata@0.1.13:
resolution: {integrity: sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==}
reflect-metadata@0.1.14:
resolution: {integrity: sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==}
reflect.getprototypeof@1.0.6:
resolution: {integrity: sha512-fmfw4XgoDke3kdI6h4xcUz1dG8uaiv5q9gcEwLS4Pnth2kxT+GZ7YehS1JTMGBQmtV7Y4GFGbs2re2NqhdozUg==}
engines: {node: '>= 0.4'}
@@ -8670,8 +8661,8 @@ packages:
typedarray@0.0.6:
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
typeorm@0.3.12:
resolution: {integrity: sha512-sYSxBmCf1nJLLTcYtwqZ+lQIRtLPyUoO93rHTOKk9vJCyT4UfRtU7oRsJvfvKP3nnZTD1hzz2SEy2zwPEN6OyA==}
typeorm@0.3.11:
resolution: {integrity: sha512-pzdOyWbVuz/z8Ww6gqvBW4nylsM0KLdUCDExr2gR20/x1khGSVxQkjNV/3YqliG90jrWzrknYbYscpk8yxFJVg==}
engines: {node: '>= 12.9.0'}
hasBin: true
peerDependencies:
@@ -8682,7 +8673,7 @@ packages:
ioredis: ^5.0.4
mongodb: ^3.6.0
mssql: ^7.3.0
mysql2: ^2.2.5 || ^3.0.1
mysql2: ^2.2.5
oracledb: ^5.1.0
pg: ^8.5.1
pg-native: ^3.0.0
@@ -8768,6 +8759,10 @@ packages:
undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
undici@6.20.1:
resolution: {integrity: sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==}
engines: {node: '>=18.17'}
unicode-canonical-property-names-ecmascript@2.0.0:
resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==}
engines: {node: '>=4'}
@@ -12310,7 +12305,7 @@ snapshots:
fs-extra: 11.2.0
globby: 11.1.0
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.4
https-proxy-agent: 7.0.5
issue-parser: 6.0.0
lodash: 4.17.21
mime: 3.0.0
@@ -13824,13 +13819,13 @@ snapshots:
ini: 1.3.8
proto-list: 1.2.4
connect-typeorm@1.1.4(typeorm@0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))):
connect-typeorm@1.1.4(typeorm@0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))):
dependencies:
'@types/debug': 0.0.31
'@types/express-session': 1.17.6
debug: 4.3.5(supports-color@8.1.1)
express-session: 1.18.0
typeorm: 0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))
typeorm: 0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))
transitivePeerDependencies:
- supports-color
@@ -14181,10 +14176,6 @@ snapshots:
date-fns@2.29.3: {}
date-fns@2.30.0:
dependencies:
'@babel/runtime': 7.24.7
dateformat@3.0.3: {}
dayjs@1.11.11: {}
@@ -15739,7 +15730,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
https-proxy-agent@7.0.4:
https-proxy-agent@7.0.5:
dependencies:
agent-base: 7.1.1
debug: 4.3.5(supports-color@8.1.1)
@@ -17149,8 +17140,6 @@ snapshots:
mkdirp@1.0.4: {}
mkdirp@2.1.6: {}
modify-values@1.0.1: {}
moment@2.30.1: {}
@@ -18372,8 +18361,6 @@ snapshots:
reflect-metadata@0.1.13: {}
reflect-metadata@0.1.14: {}
reflect.getprototypeof@1.0.6:
dependencies:
call-bind: 1.0.7
@@ -19431,23 +19418,23 @@ snapshots:
typedarray@0.0.6: {}
typeorm@0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)):
typeorm@0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)):
dependencies:
'@sqltools/formatter': 1.2.5
app-root-path: 3.1.0
buffer: 6.0.3
chalk: 4.1.2
cli-highlight: 2.1.11
date-fns: 2.30.0
date-fns: 2.29.3
debug: 4.3.5(supports-color@8.1.1)
dotenv: 16.4.5
glob: 8.1.0
glob: 7.2.3
js-yaml: 4.1.0
mkdirp: 2.1.6
reflect-metadata: 0.1.14
mkdirp: 1.0.4
reflect-metadata: 0.1.13
sha.js: 2.4.11
tslib: 2.6.3
uuid: 9.0.1
uuid: 8.3.2
xml2js: 0.4.23
yargs: 17.7.2
optionalDependencies:
@@ -19486,6 +19473,8 @@ snapshots:
undici-types@5.26.5: {}
undici@6.20.1: {}
unicode-canonical-property-names-ecmascript@2.0.0: {}
unicode-emoji-utils@1.2.0:

View File

@@ -37,6 +37,7 @@ import dns from 'node:dns';
import net from 'node:net';
import path from 'path';
import swaggerUi from 'swagger-ui-express';
import { ProxyAgent, setGlobalDispatcher } from 'undici';
import YAML from 'yamljs';
if (process.env.forceIpv4First === 'true') {
@@ -67,6 +68,11 @@ app
const settings = await getSettings().load();
restartFlag.initializeSettings(settings.main);
// Register HTTP proxy
if (settings.main.httpProxy) {
setGlobalDispatcher(new ProxyAgent(settings.main.httpProxy));
}
// Migrate library types
if (
settings.plex.libraries.length > 1 &&

View File

@@ -119,6 +119,7 @@ export interface MainSettings {
mediaServerType: number;
partialRequestsEnabled: boolean;
locale: string;
httpProxy: string;
}
interface PublicSettings {
@@ -325,6 +326,7 @@ class Settings {
mediaServerType: MediaServerType.NOT_CONFIGURED,
partialRequestsEnabled: true,
locale: 'en',
httpProxy: '',
},
plex: {
name: '',

View File

@@ -13,7 +13,8 @@ class RestartFlag {
return (
this.settings.csrfProtection !== settings.csrfProtection ||
this.settings.trustProxy !== settings.trustProxy
this.settings.trustProxy !== settings.trustProxy ||
this.settings.httpProxy !== settings.httpProxy
);
}
}

View File

@@ -9,7 +9,7 @@ import useDebouncedState from '@app/hooks/useDebouncedState';
import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams';
import { Permission, useUser } from '@app/hooks/useUser';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import {
ChevronLeftIcon,
@@ -75,7 +75,7 @@ const Blacklist = () => {
// check if there's no data and no errors in the table
// so as to show a spinner inside the table and not refresh the whole component
if (!data && error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const searchItem = (e: ChangeEvent<HTMLInputElement>) => {

View File

@@ -9,7 +9,7 @@ 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 ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper';
import { ArrowDownTrayIcon } from '@heroicons/react/24/outline';
@@ -91,7 +91,7 @@ const CollectionDetails = ({ collection }: CollectionDetailsProps) => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
let collectionStatus = MediaStatus.UNKNOWN;

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieResult } from '@server/models/Search';
import { useRouter } from 'next/router';
@@ -31,7 +31,7 @@ const DiscoverMovieGenre = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover, { encodeURIExtraParams } from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TmdbKeyword } from '@server/api/themoviedb/interfaces';
import type { MovieResult } from '@server/models/Search';
@@ -35,7 +35,7 @@ const DiscoverMovieKeyword = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieResult } from '@server/models/Search';
import { useRouter } from 'next/router';
@@ -37,7 +37,7 @@ const DiscoverMovieLanguage = () => {
>(`/api/v1/discover/movies/language/${router.query.language}`);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -10,7 +10,7 @@ import {
import FilterSlideover from '@app/components/Discover/FilterSlideover';
import useDiscover from '@app/hooks/useDiscover';
import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { BarsArrowDownIcon, FunnelIcon } from '@heroicons/react/24/solid';
import type { SortOptions as TMDBSortOptions } from '@server/api/themoviedb';
@@ -66,7 +66,7 @@ const DiscoverMovies = () => {
const [showFilters, setShowFilters] = useState(false);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = intl.formatMessage(messages.discovermovies);

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvNetwork } from '@server/models/common';
import type { TvResult } from '@server/models/Search';
@@ -33,7 +33,7 @@ const DiscoverTvNetwork = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { ProductionCompany } from '@server/models/common';
import type { MovieResult } from '@server/models/Search';
@@ -33,7 +33,7 @@ const DiscoverMovieStudio = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -10,7 +10,7 @@ import {
import FilterSlideover from '@app/components/Discover/FilterSlideover';
import useDiscover from '@app/hooks/useDiscover';
import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { BarsArrowDownIcon, FunnelIcon } from '@heroicons/react/24/solid';
import type { SortOptions as TMDBSortOptions } from '@server/api/themoviedb';
@@ -64,7 +64,7 @@ const DiscoverTv = () => {
});
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = intl.formatMessage(messages.discovertv);

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvResult } from '@server/models/Search';
import { useRouter } from 'next/router';
@@ -31,7 +31,7 @@ const DiscoverTvGenre = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover, { encodeURIExtraParams } from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TmdbKeyword } from '@server/api/themoviedb/interfaces';
import type { TvResult } from '@server/models/Search';
@@ -35,7 +35,7 @@ const DiscoverTvKeyword = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvResult } from '@server/models/Search';
import { useRouter } from 'next/router';
@@ -37,7 +37,7 @@ const DiscoverTvLanguage = () => {
>(`/api/v1/discover/tv/language/${router.query.language}`);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = isLoadingInitialData

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvResult } from '@server/models/Search';
import { useIntl } from 'react-intl';
@@ -23,7 +23,7 @@ const DiscoverTvUpcoming = () => {
} = useDiscover<TvResult>('/api/v1/discover/tv/upcoming');
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -3,7 +3,7 @@ import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import { useUser } from '@app/hooks/useUser';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { WatchlistItem } from '@server/interfaces/api/discoverInterfaces';
import Link from 'next/link';
@@ -43,7 +43,7 @@ const DiscoverWatchlist = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const title = intl.formatMessage(

View File

@@ -3,7 +3,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import { genreColorMap } from '@app/components/Discover/constants';
import GenreCard from '@app/components/GenreCard';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { GenreSliderItem } from '@server/interfaces/api/discoverInterfaces';
import { useIntl } from 'react-intl';
@@ -24,7 +24,7 @@ const MovieGenreList = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type {
MovieResult,
@@ -30,7 +30,7 @@ const Trending = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -3,7 +3,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import { genreColorMap } from '@app/components/Discover/constants';
import GenreCard from '@app/components/GenreCard';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { GenreSliderItem } from '@server/interfaces/api/discoverInterfaces';
import { useIntl } from 'react-intl';
@@ -24,7 +24,7 @@ const TvGenreList = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieResult } from '@server/models/Search';
import { useIntl } from 'react-intl';
@@ -25,7 +25,7 @@ const UpcomingMovies = () => {
} = useDiscover<MovieResult>('/api/v1/discover/movies/upcoming');
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import PersonCard from '@app/components/PersonCard';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieDetails } from '@server/models/Movie';
import Link from 'next/link';
@@ -26,7 +26,7 @@ const MovieCast = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import PersonCard from '@app/components/PersonCard';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieDetails } from '@server/models/Movie';
import Link from 'next/link';
@@ -26,7 +26,7 @@ const MovieCrew = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieDetails } from '@server/models/Movie';
import type { MovieResult } from '@server/models/Search';
@@ -34,7 +34,7 @@ const MovieRecommendations = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { MovieDetails } from '@server/models/Movie';
import type { MovieResult } from '@server/models/Search';
@@ -32,7 +32,7 @@ const MovieSimilar = () => {
} = useDiscover<MovieResult>(`/api/v1/movie/${router.query.movieId}/similar`);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -5,7 +5,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import TitleCard from '@app/components/TitleCard';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { PersonCombinedCreditsResponse } from '@server/interfaces/api/personInterfaces';
import type { PersonDetails as PersonDetailsType } from '@server/models/Person';
@@ -79,7 +79,7 @@ const PersonDetails = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
const personAttributes: string[] = [];

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type {
MovieResult,
@@ -38,7 +38,7 @@ const Search = () => {
);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -5,7 +5,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import Releases from '@app/components/Settings/SettingsAbout/Releases';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { InformationCircleIcon } from '@heroicons/react/24/solid';
import type {
@@ -51,7 +51,7 @@ const SettingsAbout = () => {
}
if (!data) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -8,7 +8,7 @@ import Tooltip from '@app/components/Common/Tooltip';
import useDebouncedState from '@app/hooks/useDebouncedState';
import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { Transition } from '@headlessui/react';
import {
@@ -128,7 +128,7 @@ const SettingsLogs = () => {
// check if there's no data and no errors in the table
// so as to show a spinner inside the table and not refresh the whole component
if (!data && error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const hasNextPage = data?.pageInfo.pages ?? 0 > pageIndex + 1;

View File

@@ -55,6 +55,8 @@ const messages = defineMessages('components.Settings.SettingsMain', {
validationApplicationUrlTrailingSlash: 'URL must not end in a trailing slash',
partialRequestsEnabled: 'Allow Partial Series Requests',
locale: 'Display Language',
httpProxy: 'HTTP Proxy',
httpProxyTip: 'Tooltip to write',
});
const SettingsMain = () => {
@@ -82,6 +84,9 @@ const SettingsMain = () => {
intl.formatMessage(messages.validationApplicationUrlTrailingSlash),
(value) => !value || !value.endsWith('/')
),
httpProxy: Yup.string().url(
intl.formatMessage(messages.validationApplicationUrl)
),
});
const regenerate = async () => {
@@ -137,6 +142,7 @@ const SettingsMain = () => {
partialRequestsEnabled: data?.partialRequestsEnabled,
trustProxy: data?.trustProxy,
cacheImages: data?.cacheImages,
httpProxy: data?.httpProxy,
}}
enableReinitialize
validationSchema={MainSettingsSchema}
@@ -158,6 +164,7 @@ const SettingsMain = () => {
partialRequestsEnabled: values.partialRequestsEnabled,
trustProxy: values.trustProxy,
cacheImages: values.cacheImages,
httpProxy: values.httpProxy,
}),
});
if (!res.ok) throw new Error();
@@ -437,6 +444,28 @@ const SettingsMain = () => {
/>
</div>
</div>
<div className="form-row">
<label htmlFor="httpProxy" className="checkbox-label">
<span className="mr-2">
{intl.formatMessage(messages.httpProxy)}
</span>
<SettingsBadge badgeType="advanced" className="mr-2" />
<SettingsBadge badgeType="restartRequired" />
<span className="label-tip">
{intl.formatMessage(messages.httpProxyTip)}
</span>
</label>
<div className="form-input-area">
<div className="form-input-field">
<Field id="httpProxy" name="httpProxy" type="text" />
</div>
{errors.httpProxy &&
touched.httpProxy &&
typeof errors.httpProxy === 'string' && (
<div className="error">{errors.httpProxy}</div>
)}
</div>
</div>
<div className="actions">
<div className="flex justify-end">
<span className="ml-3 inline-flex rounded-md shadow-sm">

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import PersonCard from '@app/components/PersonCard';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvDetails } from '@server/models/Tv';
import Link from 'next/link';
@@ -24,7 +24,7 @@ const TvCast = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
import PageTitle from '@app/components/Common/PageTitle';
import PersonCard from '@app/components/PersonCard';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvDetails } from '@server/models/Tv';
import Link from 'next/link';
@@ -24,7 +24,7 @@ const TvCrew = () => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvResult } from '@server/models/Search';
import type { TvDetails } from '@server/models/Tv';
@@ -30,7 +30,7 @@ const TvRecommendations = () => {
} = useDiscover<TvResult>(`/api/v1/tv/${router.query.tvId}/recommendations`);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -2,7 +2,7 @@ import Header from '@app/components/Common/Header';
import ListView from '@app/components/Common/ListView';
import PageTitle from '@app/components/Common/PageTitle';
import useDiscover from '@app/hooks/useDiscover';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { TvResult } from '@server/models/Search';
import type { TvDetails } from '@server/models/Tv';
@@ -30,7 +30,7 @@ const TvSimilar = () => {
} = useDiscover<TvResult>(`/api/v1/tv/${router.query.tvId}/similar`);
if (error) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -30,7 +30,7 @@ import useLocale from '@app/hooks/useLocale';
import useSettings from '@app/hooks/useSettings';
import { Permission, useUser } from '@app/hooks/useUser';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import { sortCrewPriority } from '@app/utils/creditHelpers';
import defineMessages from '@app/utils/defineMessages';
import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper';
@@ -177,7 +177,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
}
if (!data) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
const mediaLinks: PlayButtonLink[] = [];

View File

@@ -8,7 +8,7 @@ import type { SettingsRoute } from '@app/components/Common/SettingsTabs';
import SettingsTabs from '@app/components/Common/SettingsTabs';
import { useUser } from '@app/hooks/useUser';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { CloudIcon, EnvelopeIcon } from '@heroicons/react/24/solid';
import type { UserSettingsNotificationsResponse } from '@server/interfaces/api/userSettingsInterfaces';
@@ -124,7 +124,7 @@ const UserNotificationSettings = ({
}
if (!data) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
return (

View File

@@ -7,7 +7,7 @@ import ProfileHeader from '@app/components/UserProfile/ProfileHeader';
import useSettings from '@app/hooks/useSettings';
import { useUser } from '@app/hooks/useUser';
import globalMessages from '@app/i18n/globalMessages';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import type { UserSettingsNotificationsResponse } from '@server/interfaces/api/userSettingsInterfaces';
import { hasPermission, Permission } from '@server/lib/permissions';
@@ -43,7 +43,7 @@ const UserSettings = ({ children }: UserSettingsProps) => {
}
if (!user) {
return <ErrorPage statusCode={500} />;
return <Error statusCode={500} />;
}
const settingsRoutes: SettingsRoute[] = [

View File

@@ -7,7 +7,7 @@ import Slider from '@app/components/Slider';
import TmdbTitleCard from '@app/components/TitleCard/TmdbTitleCard';
import ProfileHeader from '@app/components/UserProfile/ProfileHeader';
import { Permission, UserType, useUser } from '@app/hooks/useUser';
import ErrorPage from '@app/pages/_error';
import Error from '@app/pages/_error';
import defineMessages from '@app/utils/defineMessages';
import { ArrowRightCircleIcon } from '@heroicons/react/24/outline';
import type { WatchlistResponse } from '@server/interfaces/api/discoverInterfaces';
@@ -116,7 +116,7 @@ const UserProfile = () => {
}
if (!user) {
return <ErrorPage statusCode={404} />;
return <Error statusCode={404} />;
}
const watchlistSliderTitle = intl.formatMessage(