hopefully address CSP problem with #66

This commit is contained in:
dragonwocky 2020-08-29 17:15:09 +10:00
parent e420172f31
commit 890c3cbc40
Signed by: dragonwocky
GPG Key ID: C7A48B7846AA706D
3 changed files with 37 additions and 17 deletions

View File

@ -9,6 +9,7 @@
### v0.8.5 (wip) ### v0.8.5 (wip)
- bugfix: separate text highlight and select tag variables. - bugfix: separate text highlight and select tag variables.
- bugfix: bypass CSP for the `enhancement://` protocol - was failing on some platforms?
### v0.8.4 (2020-08-29) ### v0.8.4 (2020-08-29)

View File

@ -30,34 +30,30 @@ a chrome extension may be coming soon for web client support.
## installation ## installation
**coming from <= v0.7.0? things are a bit different - have a read of [the update guide](UPDATING.md)** > coming from <= v0.7.0? things are a bit different - have a read of [the update guide](UPDATING.md)\*\*
**before following these instructions.** > before following these instructions.
<details> during installation/removal, make sure no notion processes are running! (check your task manager.)
<summary>Windows, macOS</summary>
**win10, macOS**
1. [install node.js](https://nodejs.org/en/download/) (_a computer restart may be required here._) 1. [install node.js](https://nodejs.org/en/download/) (_a computer restart may be required here._)
2. make sure no notion processes are running 2. execute `npm i -g notion-enhancer` in the terminal/command prompt as a root/admin user.
3. execute `npm i -g notion-enhancer` in the terminal/command prompt. Make sure you have root/admin rights.
</details>
<details> **debian/ubuntu, chromeOS, WSL (to modify the win10 app)**
<summary>Ubuntu-based distros, WSL, ChromeOS</summary>
execute the following lines in the terminal:
Execute the following commands:
``` ```
bash curl -sL https://deb.nodesource.com setup_current.x | sudo -E bash - bash curl -sL https://deb.nodesource.com setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
sudo npm i -g notion-enhancer sudo npm i -g notion-enhancer
``` ```
</details>
<details> **arch linux, manjaro**
<summary>Arch Linux, Manjaro:</summary>
Use the [AUR package]( https://aur.archlinux.org/packages/notion-enhancer ). install the [aur package](https://aur.archlinux.org/packages/notion-enhancer)
install with `yay -S notion-enhancer` (use your AUR helper instead of yay) with your aur helper (e.g. `yay -S notion-enhancer`).
</details>
### command-line interface ### command-line interface

View File

@ -17,7 +17,7 @@ module.exports = function (__file, __exports) {
.slice(path.resolve(`${__notion}/app`).length + 1) .slice(path.resolve(`${__notion}/app`).length + 1)
.replace(/\\/g, '/'); .replace(/\\/g, '/');
if (__file === 'main/main.js') { if (__file === 'main/security.js') {
const electron = require('electron'); const electron = require('electron');
electron.app.whenReady().then(() => { electron.app.whenReady().then(() => {
electron.session electron.session
@ -30,6 +30,29 @@ module.exports = function (__file, __exports) {
}); });
}); });
}); });
electron.protocol.registerSchemesAsPrivileged([
{
scheme: 'notion',
privileges: {
standard: true,
secure: true,
allowServiceWorkers: true,
supportFetchAPI: true,
corsEnabled: true,
},
},
{
scheme: 'enhancement',
privileges: {
standard: true,
secure: true,
allowServiceWorkers: true,
supportFetchAPI: true,
corsEnabled: true,
bypassCSP: true,
},
},
]);
} }
const modules = helpers.getEnhancements(); const modules = helpers.getEnhancements();