mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-14 08:50:31 +00:00
Merge pull request #377 from shamoon/unified-infowidget-settings
Feature: Unified info widget settings
This commit is contained in:
commit
4ea279856f
7 changed files with 99 additions and 41 deletions
|
@ -3,8 +3,8 @@ import cache from "memory-cache";
|
|||
import { formatApiCall } from "utils/proxy/api-helpers";
|
||||
import { httpProxy } from "utils/proxy/http";
|
||||
import { addCookieToJar, setCookieHeader } from "utils/proxy/cookie-jar";
|
||||
import { getSettings } from "utils/config/config";
|
||||
import getServiceWidget from "utils/config/service-helpers";
|
||||
import { getPrivateWidgetOptions } from "utils/config/widget-helpers";
|
||||
import createLogger from "utils/logger";
|
||||
import widgets from "widgets/widgets";
|
||||
|
||||
|
@ -15,13 +15,13 @@ const logger = createLogger(proxyName);
|
|||
|
||||
async function getWidget(req) {
|
||||
const { group, service, type } = req.query;
|
||||
|
||||
|
||||
let widget = null;
|
||||
if (type === "unifi_console") {
|
||||
const settings = getSettings();
|
||||
widget = settings.unifi_console;
|
||||
if (type === "unifi_console") { // info widget
|
||||
const index = req.query?.query ? JSON.parse(req.query.query).index : undefined;
|
||||
widget = await getPrivateWidgetOptions(type, index);
|
||||
if (!widget) {
|
||||
logger.debug("There is no unifi_console section in settings.yaml");
|
||||
logger.debug("Error retrieving settings for this Unifi widget");
|
||||
return null;
|
||||
}
|
||||
widget.type = "unifi";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue