mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 07:25:48 +01:00
🎨 Rename "services" to "apps" in entire project
This commit is contained in:
@@ -8,24 +8,24 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
|
||||
const configName = getCookie('config-name', { req });
|
||||
const { config }: { config: Config } = getConfig(configName?.toString() ?? 'default').props;
|
||||
const { query } = req.query;
|
||||
const service = config.services.find(
|
||||
(service) => service.type === 'Overseerr' || service.type === 'Jellyseerr'
|
||||
const app = config.apps.find(
|
||||
(app) => app.type === 'Overseerr' || app.type === 'Jellyseerr'
|
||||
);
|
||||
// If query is an empty string, return an empty array
|
||||
if (query === '' || query === undefined) {
|
||||
return res.status(200).json([]);
|
||||
}
|
||||
if (!service || !query || service === undefined || !service.apiKey) {
|
||||
if (!app || !query || app === undefined || !app.apiKey) {
|
||||
return res.status(400).json({
|
||||
error: 'Wrong request',
|
||||
});
|
||||
}
|
||||
const serviceUrl = new URL(service.url);
|
||||
const appUrl = new URL(app.url);
|
||||
const data = await axios
|
||||
.get(`${serviceUrl.origin}/api/v1/search?query=${query}`, {
|
||||
.get(`${appUrl.origin}/api/v1/search?query=${query}`, {
|
||||
headers: {
|
||||
// Set X-Api-Key to the value of the API key
|
||||
'X-Api-Key': service.apiKey,
|
||||
'X-Api-Key': app.apiKey,
|
||||
},
|
||||
})
|
||||
.then((res) => res.data);
|
||||
|
||||
Reference in New Issue
Block a user