mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-09 15:09:02 +00:00
refactor __notion back to a function for error handling, replace missing executables with backups in check
This commit is contained in:
parent
894f2578df
commit
be40723e1c
@ -10,10 +10,9 @@
|
|||||||
module.exports = (store, __exports) => {
|
module.exports = (store, __exports) => {
|
||||||
const electron = require('electron'),
|
const electron = require('electron'),
|
||||||
helpers = require('../../pkg/helpers.js'),
|
helpers = require('../../pkg/helpers.js'),
|
||||||
notionIpc = require(`${helpers.__notion.replace(
|
notionIpc = require(`${helpers
|
||||||
/\\/g,
|
.getNotionResources()
|
||||||
'/'
|
.replace(/\\/g, '/')}/app/helpers/notionIpc.js`),
|
||||||
)}/app/helpers/notionIpc.js`),
|
|
||||||
{ toKeyEvent } = require('keyboardevent-from-electron-accelerator'),
|
{ toKeyEvent } = require('keyboardevent-from-electron-accelerator'),
|
||||||
tabsEnabled = (store('mods')['e1692c29-475e-437b-b7ff-3eee872e1a42'] || {})
|
tabsEnabled = (store('mods')['e1692c29-475e-437b-b7ff-3eee872e1a42'] || {})
|
||||||
.enabled;
|
.enabled;
|
||||||
|
@ -19,13 +19,14 @@ module.exports = (store, __exports) => {
|
|||||||
|
|
||||||
__exports.createWindow = function (relativeUrl, focused_window) {
|
__exports.createWindow = function (relativeUrl, focused_window) {
|
||||||
if (!relativeUrl) relativeUrl = '';
|
if (!relativeUrl) relativeUrl = '';
|
||||||
const window_state = require(`${helpers.__notion.replace(
|
const window_state = require(`${helpers
|
||||||
/\\/g,
|
.getNotionResources()
|
||||||
'/'
|
.replace(/\\/g, '/')}/app/node_modules/electron-window-state/index.js`)(
|
||||||
)}/app/node_modules/electron-window-state/index.js`)({
|
{
|
||||||
defaultWidth: 1320,
|
defaultWidth: 1320,
|
||||||
defaultHeight: 860,
|
defaultHeight: 860,
|
||||||
}),
|
}
|
||||||
|
),
|
||||||
rect = {
|
rect = {
|
||||||
x: window_state.x,
|
x: window_state.x,
|
||||||
y: window_state.y,
|
y: window_state.y,
|
||||||
@ -46,7 +47,9 @@ module.exports = (store, __exports) => {
|
|||||||
titleBarStyle: 'hiddenInset',
|
titleBarStyle: 'hiddenInset',
|
||||||
frame: !store().frameless,
|
frame: !store().frameless,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.resolve(`${helpers.__notion}/app/renderer/index.js`),
|
preload: path.resolve(
|
||||||
|
`${helpers.getNotionResources()}/app/renderer/index.js`
|
||||||
|
),
|
||||||
webviewTag: true,
|
webviewTag: true,
|
||||||
session: electron.session.fromPartition('persist:notion'),
|
session: electron.session.fromPartition('persist:notion'),
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
|
@ -11,10 +11,11 @@ const url = require('url'),
|
|||||||
electron = require('electron'),
|
electron = require('electron'),
|
||||||
fs = require('fs-extra'),
|
fs = require('fs-extra'),
|
||||||
{
|
{
|
||||||
__notion,
|
getNotionResources,
|
||||||
getEnhancements,
|
getEnhancements,
|
||||||
createElement,
|
createElement,
|
||||||
} = require('../../pkg/helpers.js'),
|
} = require('../../pkg/helpers.js'),
|
||||||
|
__notion = getNotionResources(),
|
||||||
config = require(`${__notion}/app/config.js`),
|
config = require(`${__notion}/app/config.js`),
|
||||||
constants = require(`${__notion}/app/shared/constants.js`),
|
constants = require(`${__notion}/app/shared/constants.js`),
|
||||||
notion_intl = require(`${__notion}/app/shared/notion-intl/index.js`),
|
notion_intl = require(`${__notion}/app/shared/notion-intl/index.js`),
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
module.exports = (store, __exports) => {
|
module.exports = (store, __exports) => {
|
||||||
const electron = require('electron'),
|
const electron = require('electron'),
|
||||||
fs = require('fs-extra'),
|
fs = require('fs-extra'),
|
||||||
{ __notion } = require('../../pkg/helpers.js'),
|
{ getNotionResources } = require('../../pkg/helpers.js'),
|
||||||
|
__notion = getNotionResources(),
|
||||||
createWindow = require(`${__notion}/app/main/createWindow.js`),
|
createWindow = require(`${__notion}/app/main/createWindow.js`),
|
||||||
config = require(`${__notion}/app/config.js`),
|
config = require(`${__notion}/app/config.js`),
|
||||||
notion_intl = require(`${__notion}/app/shared/notion-intl/index.js`),
|
notion_intl = require(`${__notion}/app/shared/notion-intl/index.js`),
|
||||||
|
@ -20,7 +20,9 @@ module.exports = (store, __exports) => {
|
|||||||
function newWindow() {
|
function newWindow() {
|
||||||
require('./createWindow.js')(
|
require('./createWindow.js')(
|
||||||
store,
|
store,
|
||||||
require(path.resolve(`${helpers.__notion}/app/main/createWindow.js`))
|
require(path.resolve(
|
||||||
|
`${helpers.getNotionResources()}/app/main/createWindow.js`
|
||||||
|
))
|
||||||
)(
|
)(
|
||||||
'',
|
'',
|
||||||
getAllWindows().find((win) => win !== enhancer_menu)
|
getAllWindows().find((win) => win !== enhancer_menu)
|
||||||
@ -113,15 +115,16 @@ module.exports = (store, __exports) => {
|
|||||||
|
|
||||||
function openEnhancerMenu() {
|
function openEnhancerMenu() {
|
||||||
if (enhancer_menu) return enhancer_menu.show();
|
if (enhancer_menu) return enhancer_menu.show();
|
||||||
const window_state = require(`${helpers.__notion.replace(
|
const window_state = require(`${helpers
|
||||||
/\\/g,
|
.getNotionResources()
|
||||||
'/'
|
.replace(/\\/g, '/')}/app/node_modules/electron-window-state/index.js`)(
|
||||||
)}/app/node_modules/electron-window-state/index.js`)({
|
{
|
||||||
file: 'menu.windowstate.json',
|
file: 'menu.windowstate.json',
|
||||||
path: helpers.__data,
|
path: helpers.__data,
|
||||||
defaultWidth: 275,
|
defaultWidth: 275,
|
||||||
defaultHeight: 600,
|
defaultHeight: 600,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
enhancer_menu = new electron.BrowserWindow({
|
enhancer_menu = new electron.BrowserWindow({
|
||||||
show: true,
|
show: true,
|
||||||
frame: !store().frameless,
|
frame: !store().frameless,
|
||||||
|
Loading…
Reference in New Issue
Block a user