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