Some info widgets exempt from cleaning private data

pull/430/head
Michael Shamoon 2 years ago
parent 9e8aad4cce
commit a3ed070921

@ -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,

Loading…
Cancel
Save