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

Electron: Load app from custom protocol #7943

Merged
merged 4 commits into from Jan 3, 2019

Conversation

@dbkr
Copy link
Member

dbkr commented Dec 21, 2018

This puts the app into its own origin so it doesn't have access to the filesystem via file:// URIs. This is done by serving the app using a custom protocol handler.

Automatically migrate the users login from the old origin to the new one.

May be easier to review this commit-by-commit (ie. the origin switch, then the migration tool).

This includes a minified copy of the browserified js-sdk with a getAllEndToEndSessions() function added to the crypto store (matrix-org/matrix-js-sdk#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.

dbkr added 3 commits Dec 19, 2018
This puts the app into its own origin so it doesn't have access
to the filesystem via file:// URIs.

Next step: migrate over localstorage & indexeddb data from the old
origin...
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
(matrix-org/matrix-js-sdk#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.
@dbkr dbkr requested a review from vector-im/riot-web Dec 21, 2018
Copy link
Member

turt2live left a comment

Seems to be doing the right thing.

// file:// as that's the origin we're migrating from).
baseDir = __dirname + "/../../origin_migrator/dest";
} else if (target[1] === 'webapp') {
baseDir = __dirname + "/../../webapp";

This comment has been minimized.

Copy link
@turt2live

turt2live Dec 21, 2018

Member

might be better to use path.join for this and the one above, because Windows. Not sure how badly it'll complain though.

This comment has been minimized.

Copy link
@turt2live

turt2live Dec 21, 2018

Member

nvm, path.normalize fixes it all

as per comment
Copy link
Member

turt2live left a comment

still lgtm

@dbkr dbkr merged commit 9e08551 into develop Jan 3, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.