mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat: dynamically fetch login screen backdrop images (#2206)
* feat: dynamically fetch login screen backdrop images * fix: remove media check from backdrops endpoint * fix: remove mapping and work with TMDb data directly
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Router } from 'express';
|
||||
import GithubAPI from '../api/github';
|
||||
import TheMovieDb from '../api/themoviedb';
|
||||
import { TmdbMovieResult, TmdbTvResult } from '../api/themoviedb/interfaces';
|
||||
import { StatusResponse } from '../interfaces/api/settingsInterfaces';
|
||||
import { Permission } from '../lib/permissions';
|
||||
import { getSettings } from '../lib/settings';
|
||||
@@ -9,9 +10,10 @@ import { mapProductionCompany } from '../models/Movie';
|
||||
import { mapNetwork } from '../models/Tv';
|
||||
import { appDataPath, appDataStatus } from '../utils/appDataVolume';
|
||||
import { getAppVersion, getCommitTag } from '../utils/appVersion';
|
||||
import { isPerson } from '../utils/typeHelpers';
|
||||
import authRoutes from './auth';
|
||||
import collectionRoutes from './collection';
|
||||
import discoverRoutes from './discover';
|
||||
import discoverRoutes, { createTmdbWithRegionLanguage } from './discover';
|
||||
import mediaRoutes from './media';
|
||||
import movieRoutes from './movie';
|
||||
import personRoutes from './person';
|
||||
@@ -160,6 +162,28 @@ router.get('/genres/tv', isAuthenticated(), async (req, res) => {
|
||||
return res.status(200).json(genres);
|
||||
});
|
||||
|
||||
router.get('/backdrops', async (req, res) => {
|
||||
const tmdb = createTmdbWithRegionLanguage();
|
||||
|
||||
const data = (
|
||||
await tmdb.getAllTrending({
|
||||
page: 1,
|
||||
timeWindow: 'week',
|
||||
})
|
||||
).results.filter((result) => !isPerson(result)) as (
|
||||
| TmdbMovieResult
|
||||
| TmdbTvResult
|
||||
)[];
|
||||
|
||||
return res
|
||||
.status(200)
|
||||
.json(
|
||||
data
|
||||
.map((result) => result.backdrop_path)
|
||||
.filter((backdropPath) => !!backdropPath)
|
||||
);
|
||||
});
|
||||
|
||||
router.get('/', (_req, res) => {
|
||||
return res.status(200).json({
|
||||
api: 'Overseerr API',
|
||||
|
Reference in New Issue
Block a user