Skip to content
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

Merged
merged 14 commits into from
Jun 24, 2024

Conversation

bugsounet
Copy link
Contributor

Fix #3442

@bugsounet bugsounet marked this pull request as draft May 10, 2024 12:28
@KristjanESPERANTO
Copy link
Contributor

Just a thought: Wouldn't that be a thing that belongs in check_config.js?

@sdetweil
Copy link
Collaborator

yes, also.

@bugsounet
Copy link
Contributor Author

check_config.js check only syntax but it does not check the contents of the file

should we make some other checks on it too ?

@sdetweil
Copy link
Collaborator

sdetweil commented May 13, 2024

well, this one is the first actual content that is important..
altho position should be checked too.. at least valid if specified.. that is another crash..

the user that reporteds the split problem said they ran config:check but it was good..

@bugsounet
Copy link
Contributor Author

bugsounet commented May 13, 2024

So, we have to check module: <name>and position: <valid position> (if defined)

we check it on check_config.js and MM core ?

Personally, I think it's essential to apply the rules to both

@sdetweil
Copy link
Collaborator

I think so.. never crash..

@bugsounet
Copy link
Contributor Author

ok, I will see to code it

@bugsounet
Copy link
Contributor Author

Right, I will try to add needed rules with eslint in check_config.js ;)

I have never done this kind of test.
bugsounet, it's time to learn :)

@bugsounet
Copy link
Contributor Author

bugsounet commented May 18, 2024

module name error:
image

position error:
image

No error:
image

I'm not sure that i can integrate it into eslint

What do you think @sdetweil ?

@bugsounet bugsounet changed the title Fix crash possibility if module: <name> is not defined Fix crash possibility if module: <name> is not defined and on mistake position: <position> May 18, 2024
@bugsounet bugsounet marked this pull request as ready for review May 26, 2024 09:16
@bugsounet
Copy link
Contributor Author

Before approuve some new deps.
Thanks to review this :>

@khassel
Copy link
Collaborator

khassel commented Jun 7, 2024

If I use a module with a valid position and disabled: true , e.g.

		{
			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 ...

@sdetweil
Copy link
Collaborator

sdetweil commented Jun 8, 2024

i agree, no warning there.

@bugsounet
Copy link
Contributor Author

sure, it's not logical

@bugsounet
Copy link
Contributor Author

fixed

@khassel khassel requested a review from rejas June 8, 2024 18:31
js/loader.js Outdated Show resolved Hide resolved
js/loader.js Outdated Show resolved Hide resolved
@bugsounet
Copy link
Contributor Author

image

It's boring to redo the packages :/

@bugsounet
Copy link
Contributor Author

ping @rejas

Copy link
Collaborator

@rejas rejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @bugsounet

js/loader.js Outdated Show resolved Hide resolved
@bugsounet
Copy link
Contributor Author

@rejas:

  • I see that postions is again used in main.js. So I use it with MM.getAvailableModulePositions
    --> I able to have all position in loader.js

  • I have move position utils in utils.js
    --> used in app.js with Utils.moduleHasValidPosition()

@bugsounet bugsounet requested a review from rejas June 23, 2024 20:06
@bugsounet
Copy link
Contributor Author

@rejas: tell me

  • If it's ok for you or not ?
  • If you want really push it for MM² v2.28 ?

Sorry to say this but it's discouraging (this PR is open since May 10) :/

@rejas
Copy link
Collaborator

rejas commented Jun 24, 2024

@rejas: tell me

* If it's ok for you or not ?

* If you want really push it for MM² v2.28 ?

Sorry to say this but it's discouraging (this PR is open since May 10) :/

Of course its ok for me (I do trust your code :-) I was jsut pondering a lot if we could move ALL the position usages into the same file. but that would be as we say in germany: in schönheit sterben (meaning "to die in beauty" aka to work too much and never finish :-D

So sorry for my slow approbval, but will do now!

@rejas rejas merged commit e95c144 into MagicMirrorOrg:develop Jun 24, 2024
6 checks passed
@bugsounet bugsounet deleted the crashFix branch June 26, 2024 20:07
@khassel khassel mentioned this pull request Jun 30, 2024
khassel added a commit that referenced this pull request Jun 30, 2024
## [2.28.0] - 2024-07-01

Thanks to: @btoconnor, @bugsounet, @JasonStieber, @khassel,
@kleinmantara and @WallysWellies.

> ⚠️ This release needs nodejs version >= v20

### Added

- [calendar] Added config option "showEndsOnlyWithDuration" for default
calendar
- [compliments] Added `specialDayUnique` config option, defaults to
`false` (#3465)
- [weather] Provider weathergov: Use `precipitationLast3Hours` if
`precipitationLastHour` is `null` (#3124)

### Removed

- [tests] delete node v18 support (#3462)

### Updated

- [core] Update dependencies including electron to v31
- [core] use node >= v20 (#3462)
- [core] Update `config.js.sample` to use openmeteo as weather provider
which needs no api key
- [tests] Use latest@version of node for `automated-tests.yaml` (#3483)
- [updatenotification] Avoid using pm2 when running in docker container

### Fixed

- [core] Fixed crash possibility if `module: <name>` is not defined and
on `postion: <positon>` mistake (#3445)
- [weather] Fixed precipitationProbability in forecast for provider
openmeteo (#3446)
- [weather] Fixed type=daily for provider openmeteo having no data when
running after 23:00 (#3449)
- [weather] Fixed type=daily for provider openmeteo showing nightly
icons in forecast when current time is "nightly" (#3458)
- [weather] Fixed forecast and hourly weather for provider openmeteo to
use real temperatures, not apparent temperatures (#3466)
- [tests] Fixed e2e tests running in docker container which needs
`address: "0.0.0.0"` (#3479)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ross Younger <crazyscot@gmail.com>
Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: Bugsounet - Cédric <github@bugsounet.fr>
Co-authored-by: jkriegshauser <joshuakr@nvidia.com>
Co-authored-by: illimarkangur <116028111+illimarkangur@users.noreply.github.com>
Co-authored-by: sam detweiler <sdetweil@gmail.com>
Co-authored-by: vppencilsharpener <tim.pray@gmail.com>
Co-authored-by: veeck <michael.veeck@nebenan.de>
Co-authored-by: Paranoid93 <6515818+Paranoid93@users.noreply.github.com>
Co-authored-by: Brian O'Connor <btoconnor@users.noreply.github.com>
Co-authored-by: WallysWellies <59727507+WallysWellies@users.noreply.github.com>
Co-authored-by: Jason Stieber <jrstieber@gmail.com>
rejas pushed a commit that referenced this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants