mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Add Docker, Emby, Gotify, Jackett, and JellySeerr widgets
This commit is contained in:
parent
035dd25ece
commit
808e79e2ac
15 changed files with 510 additions and 9 deletions
|
@ -32,15 +32,28 @@ export function formatApiCall(url, args) {
|
|||
return url.replace(find, replace);
|
||||
}
|
||||
|
||||
export function formatProxyUrl(widget, endpoint, endpointParams) {
|
||||
function getURLSearchParams(widget, endpoint) {
|
||||
const params = new URLSearchParams({
|
||||
type: widget.type,
|
||||
group: widget.service_group,
|
||||
service: widget.service_name,
|
||||
endpoint,
|
||||
});
|
||||
if (endpointParams) {
|
||||
params.append("params", JSON.stringify(endpointParams));
|
||||
return params;
|
||||
}
|
||||
|
||||
export function formatProxyUrlWithSegments(widget, endpoint, segments) {
|
||||
const params = getURLSearchParams(widget, endpoint);
|
||||
if (segments) {
|
||||
params.append("segments", JSON.stringify(segments))
|
||||
}
|
||||
return `/api/services/proxy?${params.toString()}`;
|
||||
}
|
||||
|
||||
export function formatProxyUrl(widget, endpoint, queryParams) {
|
||||
const params = getURLSearchParams(widget, endpoint);
|
||||
if (queryParams) {
|
||||
params.append("query", JSON.stringify(queryParams));
|
||||
}
|
||||
return `/api/services/proxy?${params.toString()}`;
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
export default function calculateCPUPercent(stats) {
|
||||
let cpuPercent = 0.0;
|
||||
const cpuDelta = stats.cpu_stats.cpu_usage.total_usage - stats.precpu_stats.cpu_usage.total_usage;
|
||||
const systemDelta = stats.cpu_stats.system_cpu_usage - stats.precpu_stats.system_cpu_usage;
|
||||
|
||||
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
||||
cpuPercent = (cpuDelta / systemDelta) * stats.cpu_stats.online_cpus * 100.0;
|
||||
}
|
||||
|
||||
return Math.round(cpuPercent * 10) / 10;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue