mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 21:43:39 +01:00
Merge pull request #430 from benphelps/fix-search-url1
Fix: some info widgets exempt from cleaning private data
This commit is contained in:
commit
5c5a7ff79f
@ -5,6 +5,8 @@ import yaml from "js-yaml";
|
|||||||
|
|
||||||
import checkAndCopyConfig from "utils/config/config";
|
import checkAndCopyConfig from "utils/config/config";
|
||||||
|
|
||||||
|
const exemptWidgets = ["search"];
|
||||||
|
|
||||||
export async function widgetsFromConfig() {
|
export async function widgetsFromConfig() {
|
||||||
checkAndCopyConfig("widgets.yaml");
|
checkAndCopyConfig("widgets.yaml");
|
||||||
|
|
||||||
@ -29,11 +31,16 @@ export async function cleanWidgetGroups(widgets) {
|
|||||||
return widgets.map((widget, index) => {
|
return widgets.map((widget, index) => {
|
||||||
const sanitizedOptions = widget.options;
|
const sanitizedOptions = widget.options;
|
||||||
const optionKeys = Object.keys(sanitizedOptions);
|
const optionKeys = Object.keys(sanitizedOptions);
|
||||||
["url", "username", "password", "key"].forEach((pO) => {
|
if (!exemptWidgets.includes(widget.type)) {
|
||||||
if (optionKeys.includes(pO)) {
|
["url", "username", "password", "key"].forEach((pO) => {
|
||||||
delete sanitizedOptions[pO];
|
if (optionKeys.includes(pO)) {
|
||||||
}
|
// allow URL in search
|
||||||
});
|
if (widget.type !== "search" && pO !== "key") {
|
||||||
|
delete sanitizedOptions[pO];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: widget.type,
|
type: widget.type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user