Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Phelps
08afa0b747 check that content type exists before setting it 2022-09-05 10:08:02 +03:00
Ben Phelps
bad436b858 fix jellyfin widget api calls 2022-09-05 08:19:50 +03:00
4 changed files with 4 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import npmProxyHandler from "utils/proxies/npm";
const serviceProxyHandlers = {
// uses query param auth
emby: genericProxyHandler,
jellyfin: genericProxyHandler,
pihole: genericProxyHandler,
radarr: genericProxyHandler,
sonarr: genericProxyHandler,

View File

@@ -1,5 +1,6 @@
const formats = {
emby: `{url}/emby/{endpoint}?api_key={key}`,
jellyfin: `{url}/emby/{endpoint}?api_key={key}`,
pihole: `{url}/admin/{endpoint}`,
radarr: `{url}/api/v3/{endpoint}?apikey={key}`,
sonarr: `{url}/api/v3/{endpoint}?apikey={key}`,

View File

@@ -19,7 +19,7 @@ export default async function credentialedProxyHandler(req, res) {
},
});
res.setHeader("Content-Type", contentType);
if (contentType) res.setHeader("Content-Type", contentType);
return res.status(status).send(data);
}
}

View File

@@ -12,7 +12,7 @@ export default async function genericProxyHandler(req, res) {
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
const [status, contentType, data] = await httpProxy(url);
res.setHeader("Content-Type", contentType);
if (contentType) res.setHeader("Content-Type", contentType);
return res.status(status).send(data);
}
}