-
-
Notifications
You must be signed in to change notification settings - Fork 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
Run the Desktop app in a sandbox #7907
Conversation
* Turn off node integration in the electron renderer process * Enable the chromium sandbox to put the renderer into its own process * Expose just the ipc module with a preload script * Introduce a little IPC call wrapper so we can call into the renderer process and await on the result. * Use this in a bunch of places we previously used direct calls to electron modules. * Convert other uses of node, eg. use of process to derive the platform (just look at the user agent) * Strip out the desktopCapturer integration which doesn't appear to have ever worked (probably best to just wait until getDisplayMedia() is available in chrome at this point: https://github.com/vector-im/riot-web/issues/4880).
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.
Thanks, this looks good to me. 😁
src/vector/index.js
Outdated
// set the platform for react sdk (our Platform object automatically picks the right one) | ||
PlatformPeg.set(new Platform()); | ||
// set the platform for react sdk | ||
//if (navigator.userAgent.toLowerCase().indexOf('electron') > 0) { |
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.
Maybe remove this commented code?
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.
Oops, good spot.
@@ -108,11 +108,6 @@ module.exports = { | |||
"matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'), | |||
}, | |||
}, | |||
externals: { |
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 am not sure I follow why this was removed... It seems unrelated to the rest of the changes. Is it something outdated that's no longer needed?
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.
The webpack side doesn't import electron anymore from what I can see. Means that it doesn't need to be declared anymore in the webpack config. (webpack side == everything that actually is riot)
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.
Yeah, it was just telling webpack to spit out a real 'require' into the bundle for electron rather than try to resolve it itself, but these are all gone now since they won't work in the renderer.
renderer process and await on the result.
to electron modules.
platform (just look at the user agent)
to have ever worked (probably best to just wait until
getDisplayMedia() is available in chrome at this point:
https://github.com/vector-im/riot-web/issues/4880).
Requires matrix-org/matrix-react-sdk#2372