Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Consider Electron version and update checks according to new defaults (#23, #58) #66
Consider Electron version and update checks according to new defaults (#23, #58) #66
Changes from 5 commits
ba67bd8
85896b8
29a8627
3d1beb7
6c864b9
5278088
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Ideally creating something that dynamically confirms if these security flags are set correctly and working as intended would be preferable, but I can see how using
getWebPreferences()
is a lot easier in our case. I would settle for this defaults file as of now, maybe planning a more comprehensive version for a next release. Things currently missing that could be useful for future checks:enableRemoteModule
(Default should be true)safeDialogs
(Default should be false)navigateOnDragDrop
(Default should be false)spellCheck
(Default should be true)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.
I'll add those manually for now.
As per this,
enableRemoteModule
will default tofalse
from version 10.0.0, so I will also include a dump from the latest beta of 10. I'll also update the remote module check accordingly.The other prefs don't seem to have ever had their default changed.
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.
Heh. This also revealed a bug that should have been obvious in hindsight. :D
(Lexicographically) sorting the version keys using
.sort()
of course produces the wrong result as soon as we get into the double digit major versions. I'll correct this to usesemver
'scompare()
as the correct compare function instead.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.
In the future, I would like to create a coding style standard for the codebase, but as of now I'm inclined towards keeping the camel case for everything, as my guess is that most of the code is in that case.
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.
Ah yes, of course. Sorry, that's habit from my personal code style.
Btw: While it doesn't cover variable naming, I would definitely recommend considering Prettier if you want to adopt a code style. I've adopted that for all my JS projects a while ago and am really happy with it. As someone who is fairly opinionated about code styling, accepting their style was a little difficult in the beginning but having a consistent style across many projects and not having to worry about that at all (with everything being formatted on save or commit) is definitely worth it.
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.
Didn't know about this tool, thanks for sharing! So you can't rely on a per-project configuration file for the styling?
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.
Prettier explicitly only allows very minor per-project configs. You'll have to decide whether you can live with the sometimes controversial choices they have made. :D Personally, I think having a consistent style across most JS projects is worth it but I can totally see that other people might think differently.
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.
It would be nice to have some other tests checking e.g. if the minimum v0.1.0 fallback is actually used when the version can't be found, but we can add this a later PR too.
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.
I definitely agree but I'll have to leave this to someone else.