From a3ed0709212b11482205bc989ffe816012368209 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 21 Oct 2022 15:54:21 -0700 Subject: [PATCH] Some info widgets exempt from cleaning private data --- src/utils/config/widget-helpers.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/utils/config/widget-helpers.js b/src/utils/config/widget-helpers.js index c9bdd0fbb..1c5398c27 100644 --- a/src/utils/config/widget-helpers.js +++ b/src/utils/config/widget-helpers.js @@ -5,6 +5,8 @@ import yaml from "js-yaml"; import checkAndCopyConfig from "utils/config/config"; +const exemptWidgets = ["search"]; + export async function widgetsFromConfig() { checkAndCopyConfig("widgets.yaml"); @@ -29,11 +31,16 @@ export async function cleanWidgetGroups(widgets) { return widgets.map((widget, index) => { const sanitizedOptions = widget.options; const optionKeys = Object.keys(sanitizedOptions); - ["url", "username", "password", "key"].forEach((pO) => { - if (optionKeys.includes(pO)) { - delete sanitizedOptions[pO]; - } - }); + if (!exemptWidgets.includes(widget.type)) { + ["url", "username", "password", "key"].forEach((pO) => { + if (optionKeys.includes(pO)) { + // allow URL in search + if (widget.type !== "search" && pO !== "key") { + delete sanitizedOptions[pO]; + } + } + }); + } return { type: widget.type,