mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 06:38:46 +00:00
Enhancement: support for glances v4 (#3196)
This commit is contained in:
parent
4fe4ae9622
commit
def9b27006
14 changed files with 38 additions and 18 deletions
|
@ -13,7 +13,7 @@ async function retrieveFromGlancesAPI(privateWidgetOptions, endpoint) {
|
|||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
const apiUrl = `${url}/api/3/${endpoint}`;
|
||||
const apiUrl = `${url}/api/${privateWidgetOptions.version}/${endpoint}`;
|
||||
const headers = {
|
||||
"Accept-Encoding": "application/json",
|
||||
};
|
||||
|
@ -42,9 +42,10 @@ async function retrieveFromGlancesAPI(privateWidgetOptions, endpoint) {
|
|||
}
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const { index, cputemp: includeCpuTemp, uptime: includeUptime, disk: includeDisks } = req.query;
|
||||
const { index, cputemp: includeCpuTemp, uptime: includeUptime, disk: includeDisks, version } = req.query;
|
||||
|
||||
const privateWidgetOptions = await getPrivateWidgetOptions("glances", index);
|
||||
privateWidgetOptions.version = version ?? 3;
|
||||
|
||||
try {
|
||||
const cpuData = await retrieveFromGlancesAPI(privateWidgetOptions, "cpu");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue