-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash possibility if module: <name>
is not defined and on mistake position: <position>
#3445
base: develop
Are you sure you want to change the base?
Conversation
Just a thought: Wouldn't that be a thing that belongs in |
yes, also. |
should we make some other checks on it too ? |
well, this one is the first actual content that is important.. the user that reporteds the split problem said they ran config:check but it was good.. |
So, we have to check we check it on Personally, I think it's essential to apply the rules to both |
I think so.. never crash.. |
ok, I will see to code it |
Right, I will try to add needed rules with eslint in I have never done this kind of test. |
I'm not sure that i can integrate it into eslint What do you think @sdetweil ? |
module: <name>
is not definedmodule: <name>
is not defined and on mistake position: <position>
Before approuve some new deps. |
If I use a module with a valid position and {
module: "weather",
header: "default weather module current",
position: "top_left",
disabled: true,
config: {
weatherProvider: "openmeteo",
lat: 50.17659,
lon: 8.62685,
useCorsProxy: true,
roundTemp: true,
showPrecipitationProbability: true,
showHumidity: "wind",
showUVIndex: true,
appendLocationNameToHeader: false,
windUnits: "kmh",
showFeelsLike: false,
bridgeId: "abc",
},
}, I get a warning [2024-06-07 23:21:00.091] [WARN] No module name found for this configuration: {
module: 'weather',
header: 'default weather module current',
position: 'top_left',
disabled: true,
config: {
weatherProvider: 'openmeteo',
lat: 50.17659,
lon: 8.62685,
useCorsProxy: true,
roundTemp: true,
showPrecipitationProbability: true,
showHumidity: 'wind',
showUVIndex: true,
appendLocationNameToHeader: false,
windUnits: 'kmh',
showFeelsLike: false,
bridgeId: 'abc'
}
} Is this intended? I think we need no such warning for disabled modules ... |
i agree, no warning there. |
sure, it's not logical |
fixed |
@@ -7,6 +7,7 @@ const Loader = (function () { | |||
const loadedModuleFiles = []; | |||
const loadedFiles = []; | |||
const moduleObjects = []; | |||
const positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "bottom_bar", "fullscreen_above", "fullscreen_below"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code seems double, can we put it in a common class?
@@ -50,7 +51,8 @@ const Loader = (function () { | |||
* @returns {object[]} module data as configured in config | |||
*/ | |||
const getAllModules = function () { | |||
return config.modules; | |||
const AllModules = config.modules.filter((module) => (module.module !== undefined) && (positions.indexOf(module.position) > -1 || typeof (module.position) === "undefined")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
part of this code seems double, can we put it in a common function?
Fix #3442