migration to electron-forge, secure app #277
Open
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.
Refactoring
Initial goal
Update and secure the new lobby, be idiomatic to the electron way
It meant removing all node integration stuff, re-enabling all security features including sandbox mode and context isolation
--> refactoring is needed to move node api calls to the main process
--> ended up having to cleanup some logic when rendering concerns and "backend" concerns were intertwined
I quickly found out that it wouldn't be possible without a big update of deps, of electron, of node.
Some dependencies were problematic :
Changes
Disclaimer, some things are going to be a bit controversial.
Moving all code depending on node apis to main.
Adding preload.ts to conform to the context isolation security feature:
Removed api.ts, replaced by ipc apis, or composables (case of the router), or self contained module (see audio)
Removed sqlite3 and cache-db.ts, replaced by IndexedDB (with dexiejs) in the renderer process.
sqlite3, I really tried to make it work but I hit a wall when it came to generating a working executable.
The concerns were to have a place where we can easily look through what's installed, it's particularly usefull for maps because we can query against our db.
Theses concerns can all be adressed in IndexedDB (the db that ships with chrome).
Removing internal deps (jazcashutils, map-parser, sdfz-demo-parser) by including the code directly in this project.
Overall, reduced the amount of dependencies. Big update, some things were not used anymore, or deprecated, or sometimes we had 2 dep for doing the same thing (see markdown).
Rewrites
rewrite of main/main window to be more idiomatic with electron's way of doing things
rewrite of abstract battle
rewrite of the initialization step of content apis to scan the filesystem for packages, maps, replays. Using chokidar to detect automatically new replays in the replay folder
introduction of the store pattern in Vue so that different components can react to changes.