mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-12 00:15:48 +01:00
Merge branch 'feat/overseerr-widget' of https://github.com/ajnart/homarr into feat/overseerr-widget
This commit is contained in:
@@ -4,6 +4,7 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { getConfig } from '../../../../tools/config/getConfig';
|
||||
|
||||
import { MediaRequest } from '../../../../widgets/media-requests/media-request-types';
|
||||
import { ConfigAppType } from '../../../../types/app';
|
||||
|
||||
const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
||||
const configName = getCookie('config-name', { req: request });
|
||||
@@ -38,7 +39,7 @@ const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
||||
type: item.type,
|
||||
name: genericItem.name,
|
||||
userName: item.requestedBy.displayName,
|
||||
userLink: `${app.url}/users/${item.requestedBy.id}`,
|
||||
userLink: constructAvatarUrl(app, item),
|
||||
userProfilePicture: `${app.url}${item.requestedBy.avatar}`,
|
||||
airDate: genericItem.airDate,
|
||||
status: item.status,
|
||||
@@ -62,6 +63,14 @@ const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
||||
return response.status(200).json(mediaRequests);
|
||||
};
|
||||
|
||||
const constructAvatarUrl = (app: ConfigAppType, item: OverseerrResponseItem) => {
|
||||
if (item.requestedBy.avatar.startsWith('http://') || item.requestedBy.avatar.startsWith('https://')) {
|
||||
return item.requestedBy.avatar;
|
||||
}
|
||||
|
||||
return `${app.url}/users/${item.requestedBy.id}`;
|
||||
};
|
||||
|
||||
const retrieveDetailsForItem = async (
|
||||
baseUrl: string,
|
||||
type: OverseerrResponseItem['type'],
|
||||
|
||||
Reference in New Issue
Block a user