Compare commits

...

4 Commits

5 changed files with 52 additions and 19 deletions

View File

@@ -37,6 +37,8 @@ class ExternalAPI {
...options.headers, ...options.headers,
}, },
}); });
this.axios.interceptors.request = axios.interceptors.request;
this.axios.interceptors.response = axios.interceptors.response;
if (options.rateLimit) { if (options.rateLimit) {
this.axios = rateLimit(this.axios, { this.axios = rateLimit(this.axios, {

View File

@@ -123,6 +123,8 @@ class TautulliAPI {
}${settings.urlBase ?? ''}`, }${settings.urlBase ?? ''}`,
params: { apikey: settings.apiKey }, params: { apikey: settings.apiKey },
}); });
this.axios.interceptors.request = axios.interceptors.request;
this.axios.interceptors.response = axios.interceptors.response;
} }
public async getInfo(): Promise<TautulliInfo> { public async getInfo(): Promise<TautulliInfo> {

View File

@@ -150,6 +150,8 @@ class ImageProxy {
baseURL: baseUrl, baseURL: baseUrl,
headers: options.headers, headers: options.headers,
}); });
this.axios.interceptors.request = axios.interceptors.request;
this.axios.interceptors.response = axios.interceptors.response;
if (options.rateLimitOptions) { if (options.rateLimitOptions) {
this.axios = rateLimit(this.axios, options.rateLimitOptions); this.axios = rateLimit(this.axios, options.rateLimitOptions);

View File

@@ -56,12 +56,9 @@ export default async function createCustomProxyAgent(
: undefined; : undefined;
try { try {
const proxyUrl = const proxyUrl = `${proxySettings.useSsl ? 'https' : 'http'}://${
(proxySettings.useSsl ? 'https://' : 'http://') + proxySettings.hostname
proxySettings.hostname + }:${proxySettings.port}`;
':' +
proxySettings.port;
const proxyAgent = new ProxyAgent({ const proxyAgent = new ProxyAgent({
uri: proxyUrl, uri: proxyUrl,
token, token,
@@ -70,10 +67,17 @@ export default async function createCustomProxyAgent(
setGlobalDispatcher(proxyAgent.compose(noProxyInterceptor)); setGlobalDispatcher(proxyAgent.compose(noProxyInterceptor));
axios.defaults.httpAgent = new HttpProxyAgent(proxyUrl); axios.defaults.httpAgent = new HttpProxyAgent(proxyUrl, {
axios.defaults.httpsAgent = new HttpsProxyAgent(proxyUrl); headers: token ? { 'proxy-authorization': token } : undefined,
});
axios.defaults.httpsAgent = new HttpsProxyAgent(proxyUrl, {
headers: token ? { 'proxy-authorization': token } : undefined,
});
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
if (config.url && skipUrl(config.url)) { const url = config.baseURL
? new URL(config.baseURL + (config.url || ''))
: config.url;
if (url && skipUrl(url)) {
config.httpAgent = false; config.httpAgent = false;
config.httpsAgent = false; config.httpsAgent = false;
} }

View File

@@ -1,5 +1,6 @@
import Badge from '@app/components/Common/Badge'; import Badge from '@app/components/Common/Badge';
import Button from '@app/components/Common/Button'; import Button from '@app/components/Common/Button';
import CachedImage from '@app/components/Common/CachedImage';
import Tooltip from '@app/components/Common/Tooltip'; import Tooltip from '@app/components/Common/Tooltip';
import RequestModal from '@app/components/RequestModal'; import RequestModal from '@app/components/RequestModal';
import useRequestOverride from '@app/hooks/useRequestOverride'; import useRequestOverride from '@app/hooks/useRequestOverride';
@@ -95,36 +96,58 @@ const RequestBlock = ({ request, onUpdate }: RequestBlockProps) => {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="mr-6 min-w-0 flex-1 flex-col items-center text-sm leading-5"> <div className="mr-6 min-w-0 flex-1 flex-col items-center text-sm leading-5">
<div className="white mb-1 flex flex-nowrap"> <div className="white mb-1 flex flex-nowrap">
<Tooltip content={intl.formatMessage(messages.requestedby)}> <span className="flex w-40 items-center truncate md:w-auto">
<UserIcon className="mr-1.5 h-5 w-5 min-w-0 flex-shrink-0" /> <Tooltip content={intl.formatMessage(messages.requestedby)}>
</Tooltip> <UserIcon className="mr-1.5 h-5 w-5 min-w-0 flex-shrink-0" />
<span className="w-40 truncate md:w-auto"> </Tooltip>
<Link <Link
href={ href={
request.requestedBy.id === user?.id request.requestedBy.id === user?.id
? '/profile' ? '/profile'
: `/users/${request.requestedBy.id}` : `/users/${request.requestedBy.id}`
} }
className="font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline" className="flex items-center font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline"
> >
<span className="avatar-sm">
<CachedImage
type="avatar"
src={request.requestedBy.avatar}
alt=""
className="avatar-sm object-cover"
width={20}
height={20}
/>
</span>
{request.requestedBy.displayName} {request.requestedBy.displayName}
</Link> </Link>
</span> </span>
</div> </div>
{request.modifiedBy && ( {request.modifiedBy && (
<div className="flex flex-nowrap"> <div className="flex flex-nowrap">
<Tooltip content={intl.formatMessage(messages.lastmodifiedby)}> <span className="flex w-40 items-center truncate md:w-auto">
<EyeIcon className="mr-1.5 h-5 w-5 flex-shrink-0" /> <Tooltip
</Tooltip> content={intl.formatMessage(messages.lastmodifiedby)}
<span className="w-40 truncate md:w-auto"> >
<EyeIcon className="mr-1.5 h-5 w-5 flex-shrink-0" />
</Tooltip>
<Link <Link
href={ href={
request.modifiedBy.id === user?.id request.modifiedBy.id === user?.id
? '/profile' ? '/profile'
: `/users/${request.modifiedBy.id}` : `/users/${request.modifiedBy.id}`
} }
className="font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline" className="flex items-center font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline"
> >
<span className="avatar-sm">
<CachedImage
type="avatar"
src={request.modifiedBy.avatar}
alt=""
className="avatar-sm object-cover"
width={20}
height={20}
/>
</span>
{request.modifiedBy.displayName} {request.modifiedBy.displayName}
</Link> </Link>
</span> </span>