diff --git a/repo/core/client.js b/repo/core/client.js index 575226e..a6eddd0 100644 --- a/repo/core/client.js +++ b/repo/core/client.js @@ -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; diff --git a/repo/core/createWindow.js b/repo/core/createWindow.js index 91ef38d..c9883f7 100644 --- a/repo/core/createWindow.js +++ b/repo/core/createWindow.js @@ -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, diff --git a/repo/core/render.js b/repo/core/render.js index 516812a..cfc1857 100644 --- a/repo/core/render.js +++ b/repo/core/render.js @@ -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`), diff --git a/repo/core/systemMenu.js b/repo/core/systemMenu.js index d301476..2fb0535 100644 --- a/repo/core/systemMenu.js +++ b/repo/core/systemMenu.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`), diff --git a/repo/core/tray.js b/repo/core/tray.js index 45325c5..461f60c 100644 --- a/repo/core/tray.js +++ b/repo/core/tray.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,