Add Gotify Service

This commit is contained in:
Francisco Coelho 2022-09-11 04:11:02 +01:00
parent e3237b9022
commit 5e6312fe93
15 changed files with 95 additions and 4 deletions

View file

@ -12,6 +12,7 @@ const formats = {
jellyseerr: `{url}/api/v1/{endpoint}`,
ombi: `{url}/api/v1/{endpoint}`,
npm: `{url}/api/{endpoint}`,
gotify: `{url}/{endpoint}`,
};
export function formatApiCall(api, args) {

View file

@ -8,15 +8,19 @@ export default async function credentialedProxyHandler(req, res) {
if (group && service) {
const widget = await getServiceWidget(group, service);
var headersData
if(widget.type == "gotify"){
headersData = {"X-gotify-Key": `${widget.key}`,"Content-Type": "application/json",}
}else{
headersData = {"X-API-Key": `${widget.key}`,"Content-Type": "application/json",}
}
if (widget) {
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
const [status, contentType, data] = await httpProxy(url, {
withCredentials: true,
credentials: "include",
headers: {
"X-API-Key": `${widget.key}`,
"Content-Type": "application/json",
},
headers: headersData,
});
if (contentType) res.setHeader("Content-Type", contentType);