mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-07 22:28:48 +00:00
Private widget options API
This commit is contained in:
parent
8e2ff61f1c
commit
7c39cd8960
3 changed files with 39 additions and 4 deletions
|
@ -34,3 +34,16 @@ export function getSettings() {
|
|||
const fileContents = readFileSync(settingsYaml, "utf8");
|
||||
return yaml.load(fileContents);
|
||||
}
|
||||
|
||||
export function sanitizePrivateOptions(options, privateOnly = false) {
|
||||
const privateOptions = ["url", "username", "password", "key"];
|
||||
const sanitizedOptions = {};
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (!privateOnly && !privateOptions.includes(key)) {
|
||||
sanitizedOptions[key] = options[key];
|
||||
} else if (privateOnly && privateOptions.includes(key)) {
|
||||
sanitizedOptions[key] = options[key];
|
||||
}
|
||||
});
|
||||
return sanitizedOptions;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue