mdwheele / owls

🦉 Easy management of /etc/hosts built on top of Electron.
MIT License
3 stars 0 forks source link

Use loader.js instead of nodeIntegration #6

Open mdwheele opened 4 years ago

mdwheele commented 4 years ago

Currently, we enable the Node integration setting for our BrowserWindow instance. My understanding is this basically attaches Node APIs to window so they are accessible to our Vue application.

Instead, we should use the loader.js pattern, which exports explicitly what the BrowserWindow has access to. In this way, we could actually export our OWN public "system" API rather than the low level Node facilities.

Because security and shit.

mdwheele commented 4 years ago

When vue-cli-plugin-electron-builder v.2.0.0 is release (currently beta), we can do this. Until then, it's just a lot of work to do this. You basically have to configure Webpack to run preload.js through with target set to electron-preload. I'll wait.

For now, we can go ahead and develop a "system" public API that we use in the Vue.js application so that when ready, we can simply drop it in.