diff --git a/README.md b/README.md
index aca1534..7d51b21 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,10 @@ otherwise:
the enhancements should be automatically applied on installation
and automatically removed on uninstallation.
-if you want to do things yourself, though, you can.
+
+on some platforms this may throw errors if done without
+elevated/admin permissions, though, so if it hasn't automatically
+installed you will still need to use these commands.
```
Usage:
@@ -52,6 +55,7 @@ For more info, run any command with the `--help` flag:
Options:
-y, --yes : skip prompts (may overwrite data)
+ -d, --dev : show detailed error messages (not recommended)
-h, --help : display usage information
-v, --version : display version number
```
@@ -231,7 +235,7 @@ these include:
**author:** [alexander-kazakov](https://github.com/alexander-kazakov/)
-**version:** v0.2.1
+**version:** v0.2.2
### right-to-left
diff --git a/bin.js b/bin.js
index 4fb2586..06529c8 100644
--- a/bin.js
+++ b/bin.js
@@ -20,26 +20,27 @@ const cli = require('cac')('notion-enhancer'),
// ### error ###
cli.option('-y, --yes', ': skip prompts (may overwrite data)');
+cli.option('-d, --dev', ': show detailed error messages');
cli
.command('apply', ': add the enhancer to the notion app')
.action(async (options) => {
console.info('=== NOTION ENHANCEMENT LOG ===');
- await require('./pkg/apply.js')();
+ await require('./pkg/apply.js')({
+ overwrite_version: options.yes,
+ friendly_errors: !options.dev,
+ });
console.info('=== END OF LOG ===');
});
cli
.command('remove', ': return notion to its pre-enhanced/pre-modded state')
.action(async (options) => {
console.info('=== NOTION RESTORATION LOG ===');
- await require('./pkg/remove.js')(
- options.yes
- ? {
- overwrite_asar: true,
- delete_data: true,
- }
- : {}
- );
+ await require('./pkg/remove.js')({
+ overwrite_asar: options.yes,
+ delete_data: options.yes,
+ friendly_errors: !options.dev,
+ });
console.info('=== END OF LOG ===');
});
cli
diff --git a/mods/core/css/dark.css b/mods/core/css/dark.css
index 3400dea..2b4d9ed 100644
--- a/mods/core/css/dark.css
+++ b/mods/core/css/dark.css
@@ -46,7 +46,6 @@
background: var(--theme--card) !important;
}
.dark
- .notion-page-content
.notion-page-block.notion-collection-item
[style*='background: rgba(255, 255, 255, 0.05)'] {
background: var(--theme--gallery) !important;
diff --git a/mods/core/css/light.css b/mods/core/css/light.css
index d9cd17e..1dba650 100644
--- a/mods/core/css/light.css
+++ b/mods/core/css/light.css
@@ -56,7 +56,6 @@
background: var(--theme--card) !important;
}
.notion-body:not(.dark)
- .notion-page-content
.notion-page-block.notion-collection-item
[style*='background: rgba(55, 53, 47, 0.024)'] {
background: var(--theme--gallery) !important;
diff --git a/mods/core/css/menu.css b/mods/core/css/menu.css
index 6048460..339c09e 100644
--- a/mods/core/css/menu.css
+++ b/mods/core/css/menu.css
@@ -158,6 +158,11 @@ s {
background: var(--theme--bg_green);
}
+#alerts code {
+ background: transparent;
+ text-decoration: underline;
+}
+
[data-relaunch] {
text-decoration: underline dotted;
cursor: pointer;
diff --git a/mods/core/menu.js b/mods/core/menu.js
index f1c4ce8..a3e28ee 100644
--- a/mods/core/menu.js
+++ b/mods/core/menu.js
@@ -107,9 +107,7 @@ window['__start'] = async () => {
'warning',
version.sorted[0] == version.local
? `update v${version.repo} available!
- run npm i -g notion-enhancer
- (or yarn global add notion-enhancer
),
- and notion-enhancer apply
.`
+ run npm i -g notion-enhancer
`
: `local build v${raw_v} is unstable.`
).prepend();
});
diff --git a/mods/property-layout/mod.js b/mods/property-layout/mod.js
index 48f5729..6df88c4 100644
--- a/mods/property-layout/mod.js
+++ b/mods/property-layout/mod.js
@@ -12,7 +12,7 @@ module.exports = {
tags: ['extension'],
name: 'property layout',
desc: 'auto-collapse page properties that usually push down page content.',
- version: '0.2.1',
+ version: '0.2.2',
author: 'alexander-kazakov',
hacks: {
'renderer/preload.js'(store, __exports) {
diff --git a/pkg/apply.js b/pkg/apply.js
index ff58681..fb4a9a3 100644
--- a/pkg/apply.js
+++ b/pkg/apply.js
@@ -22,7 +22,7 @@ const fs = require('fs-extra'),
// ### error ###
let __notion = helpers.getNotion();
-module.exports = async function ({ overwrite_version } = {}) {
+module.exports = async function ({ overwrite_version, friendly_errors } = {}) {
try {
await fs.ensureDir(helpers.data_folder);
@@ -114,7 +114,13 @@ module.exports = async function ({ overwrite_version } = {}) {
return true;
} catch (err) {
console.error('### ERROR ###');
- console.error(err);
+ if (err.toString().includes('EACCESS') && friendly_errors) {
+ console.error(
+ 'file access forbidden: try again with sudo or in an elevated/admin prompt.'
+ );
+ } else if (err.toString().includes('EIO') && friendly_errors) {
+ console.error('file access failed: is notion running?');
+ } else console.error(err);
return false;
}
};
diff --git a/pkg/remove.js b/pkg/remove.js
index 3c5610a..98d608c 100644
--- a/pkg/remove.js
+++ b/pkg/remove.js
@@ -19,7 +19,11 @@ const fs = require('fs-extra'),
// ### error ###
let __notion = helpers.getNotion();
-module.exports = async function ({ overwrite_asar, delete_data } = {}) {
+module.exports = async function ({
+ overwrite_asar,
+ delete_data,
+ friendly_errors,
+} = {}) {
try {
const file_operations = [];
@@ -27,7 +31,7 @@ module.exports = async function ({ overwrite_asar, delete_data } = {}) {
const app_folder = path.resolve(`${__notion}/app`);
if (await fs.pathExists(app_folder)) {
console.info(` ...removing folder ${app_folder}`);
- file_operations.push(fs.remove(app_folder));
+ await fs.remove(app_folder);
} else console.warn(` * ${app_folder} not found: step skipped.`);
// restoring original asar
@@ -55,13 +59,11 @@ module.exports = async function ({ overwrite_asar, delete_data } = {}) {
);
}
- file_operations.push(
- overwrite_asar || overwrite_asar === undefined
- ? fs.move(asar_bak, path.resolve(`${__notion}/app.asar`), {
- overwrite: true,
- })
- : fs.remove(asar_bak)
- );
+ await (overwrite_asar || overwrite_asar === undefined
+ ? fs.move(asar_bak, path.resolve(`${__notion}/app.asar`), {
+ overwrite: true,
+ })
+ : fs.remove(asar_bak));
} else console.warn(` * ${asar_bak} not found: step skipped.`);
// cleaning data folder: ~/.notion-enhancer
@@ -83,12 +85,10 @@ module.exports = async function ({ overwrite_asar, delete_data } = {}) {
: ` -- keeping ${helpers.data_folder}`
);
if (delete_data) {
- file_operations.push(fs.remove(helpers.data_folder));
+ await fs.remove(helpers.data_folder);
} else fs.remove(path.resolve(`${helpers.data_folder}/version.txt`));
} else console.warn(` * ${helpers.data_folder} not found: step skipped.`);
- await Promise.all(file_operations);
-
// patching launch script target of custom wrappers
if (
[
@@ -119,7 +119,13 @@ module.exports = async function ({ overwrite_asar, delete_data } = {}) {
return true;
} catch (err) {
console.error('### ERROR ###');
- console.error(err);
+ if (err.toString().includes('EACCESS') && friendly_errors) {
+ console.error(
+ 'file access forbidden: try again with sudo or in an elevated/admin prompt.'
+ );
+ } else if (err.toString().includes('EIO') && friendly_errors) {
+ console.error('file access failed: is notion running?');
+ } else console.error(err);
return false;
}
};