Electron: Load app from custom protocol

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...
This commit is contained in:
David Baker 2018-12-19 12:04:40 +00:00
parent b35903bb19
commit fc4e1485ad
2 changed files with 56 additions and 2 deletions

View file

@ -19,3 +19,11 @@ const { ipcRenderer } = require('electron');
// expose ipcRenderer to the renderer process
window.ipcRenderer = ipcRenderer;
// Allow the fetch API to load resources from this
// protocol: this is necessary to load olm.wasm.
// (Also mark it a secure although we've already
// done this in the main process).
webFrame.registerURLSchemeAsPrivileged('vector', {
secure: true,
supportFetchAPI: true,
});