mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Merge branch 'main' of https://github.com/xicopitz/homepage
This commit is contained in:
commit
0c9c1c599f
27 changed files with 456 additions and 244 deletions
|
@ -13,8 +13,10 @@ const formats = {
|
|||
overseerr: `{url}/api/v1/{endpoint}`,
|
||||
ombi: `{url}/api/v1/{endpoint}`,
|
||||
npm: `{url}/api/{endpoint}`,
|
||||
readarr: `{url}/api/v1/{endpoint}?apikey={key}`,
|
||||
sabnzbd: `{url}/api/?apikey={key}&output=json&mode={endpoint}`,
|
||||
coinmarketcap: `{url}/{endpoint}`,
|
||||
gotify: `{url}/{endpoint}`,
|
||||
sabnzbd: `{url}/api?output=json&apikey={key}&{endpoint}`,
|
||||
};
|
||||
|
||||
export function formatApiCall(api, args) {
|
||||
|
|
|
@ -17,11 +17,22 @@ export default async function credentialedProxyHandler(req, res) {
|
|||
|
||||
if (widget) {
|
||||
const url = new URL(formatApiCall(widget.type, { endpoint, ...widget }));
|
||||
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
if (widget.type === "coinmarketcap") {
|
||||
headers["X-CMC_PRO_API_KEY"] = `${widget.key}`;
|
||||
} else {
|
||||
headers["X-API-Key"] = `${widget.key}`;
|
||||
}
|
||||
|
||||
const [status, contentType, data] = await httpProxy(url, {
|
||||
method: req.method,
|
||||
withCredentials: true,
|
||||
credentials: "include",
|
||||
headers: headersData,
|
||||
headers,
|
||||
});
|
||||
|
||||
if (status === 204 || status === 304) {
|
||||
|
|
|
@ -110,13 +110,18 @@ export function cleanServiceGroups(groups) {
|
|||
const cleanedService = { ...service };
|
||||
|
||||
if (cleanedService.widget) {
|
||||
const { type } = cleanedService.widget;
|
||||
const { type, server, container } = cleanedService.widget;
|
||||
|
||||
cleanedService.widget = {
|
||||
type,
|
||||
service_name: service.name,
|
||||
service_group: serviceGroup.name,
|
||||
};
|
||||
|
||||
if (type === "docker") {
|
||||
cleanedService.widget.server = server;
|
||||
cleanedService.widget.container = container;
|
||||
}
|
||||
}
|
||||
|
||||
return cleanedService;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue