It's still not 100% clear whether storage is always persistent on
Electron, but we seem to be getting reports of it being deleted in
the wild on Electron, so let's try calling the API to request
persistent storage. It won't pop up a dialog on Electron. In the
worst case it will give us some logging so we know what the API calls
return.
We could do this on non-desktop too but it's a bit of a mess because
Firefox prompts the user but Chrome makes a decision itself based on
how much the user visits the site.
in Electron get config via IPC from main process
which has access to the "local" config.json override file
and can make people happy :D
Remove bunch of duplicated code,
and move comments around to put them in the right place
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Implements the process described here: https://github.com/vector-im/riot-web/issues/9290#issuecomment-481966910
The expectation is that later layers (like the react-sdk) will make use of the `validated_discovery_config` option instead of interpreting the config themselves.
We intentionally block the UI from loading here to avoid races between discovery and the app loading.
This avoids a canvas permission prompt from appearing on page load for users in
Firefox's resist fingerprinting mode. The prompt will still happen once you log
in and receive a notification, but at least this prevents it from happening
during the initial app experience.
Fixes https://github.com/vector-im/riot-web/issues/9605
See https://github.com/vector-im/riot-web/issues/9360
This is to prevent it from always working. Cookies without an expiration are supposed to expire at the end of the session, however the nature of mobile browsers means that the session is unlikely to ever end.
App checks at startup for an existing session, if there isn't one,
it will start the tool to check for a login in the file:// origin.
If there is one, it will copy the login over to the vector://vector
origin.
In principle this could also be used to migrate logins between
other origins on the web if this were ever required.
This includes a minified copy of the browserified js-sdk with
a getAllEndToEndSessions() function added to the crypto store
(https://github.com/matrix-org/matrix-js-sdk/pull/812). This is
not great, but for a short-lived tool this seems better than
introducing more entry points into webpack only used for the
electron app.
Looks like this was broken in the webpack 4 upgrade due to the
worker script setter and the bundle being re-ordered in index.html.
* Remove the loop: we only use two scripts now, so import them
explicitly
* Remove outdated olm import code.
* Stop generating a script import for each theme: we were pulling
in 3 js files that did absolutely nothing.
* Fix worker 'onmessage' scope (set it as a global rather than
trying to make it an ES6 module which it isn't).
* Fail hard if the indexeddb worker script isn't set to avoid
this happening again.
Looks like this was broken in the webpack 4 upgrade due to the
worker script setter and the bundle being re-ordered in index.html.
* Remove the loop: we only use two scripts now, so import them
explicitly
* Remove outdated olm import code.
* Stop generating a script import for each theme: we were pulling
in 3 js files that did absolutely nothing.
* Fix worker 'onmessage' scope (set it as a global rather than
trying to make it an ES6 module which it isn't).
* Fail hard if the indexeddb worker script isn't set to avoid
this happening again.
* 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).
This is mostly useful for cases when the UI is broken or the user can't access the button because they aren't logged in. This is particularly helpful for troubleshooting issues with .well-known discovery if/when they come up.
Ref: https://github.com/vector-im/riot-web/issues/4802