From 34ad99fc0df3f4dece5daefbd6bd451c392de9e3 Mon Sep 17 00:00:00 2001 From: Nick Oliveira <87996659+noliveira95@users.noreply.github.com> Date: Fri, 24 Jun 2022 16:58:28 -0700 Subject: [PATCH 1/7] chore: created enum for ipcMain eventNames --- src/auto-updater/index.js | 5 +++-- src/automatic-gc.js | 3 ++- src/daemon/index.js | 3 ++- src/enable-namesys-pubsub.js | 3 ++- src/enable-pubsub.js | 3 ++- src/i18n.js | 3 ++- src/run-gc.js | 5 +++-- src/tray.js | 7 ++++--- src/utils/create-toggler.js | 3 ++- src/utils/ipcMainEvents.js | 19 +++++++++++++++++++ 10 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 src/utils/ipcMainEvents.js diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index c0cd2ae90..6777f7081 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -5,6 +5,7 @@ const { ipcMain } = require('electron') const logger = require('../common/logger') const { showDialog } = require('../dialogs') const { IS_MAC, IS_WIN, IS_APPIMAGE } = require('../common/consts') +const ipcMainEvents = require('../utils/ipc-main-events') function isAutoUpdateSupported () { // atm only macOS, windows and AppImage builds support autoupdate mechanism, @@ -140,13 +141,13 @@ function setup (ctx) { } async function checkForUpdates () { - ipcMain.emit('updating') + ipcMain.emit(ipcMainEvents.UPDATING) try { await autoUpdater.checkForUpdates() } catch (_) { // Ignore. The errors are already handled on 'error' event. } - ipcMain.emit('updatingEnded') + ipcMain.emit(ipcMainEvents.UPDATING_ENDED) } module.exports = async function (ctx) { diff --git a/src/automatic-gc.js b/src/automatic-gc.js index 18e636fa1..0558e583b 100644 --- a/src/automatic-gc.js +++ b/src/automatic-gc.js @@ -3,6 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { AUTO_GARBAGE_COLLECTOR: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') +const ipcMainEvents = require('./utils/ipc-main-events') const gcFlag = '--enable-gc' const isEnabled = flags => flags.some(f => f === gcFlag) @@ -25,7 +26,7 @@ function disable () { function applyConfig (newFlags) { store.set('ipfsConfig.flags', newFlags) - ipcMain.emit('ipfsConfigChanged') // trigger node restart + ipcMain.emit(ipcMainEvents.IPFS_CONFIG_CHANGED) // trigger node restart } module.exports = async function () { diff --git a/src/daemon/index.js b/src/daemon/index.js index 7e1c56bcb..efce51992 100644 --- a/src/daemon/index.js +++ b/src/daemon/index.js @@ -6,6 +6,7 @@ const store = require('../common/store') const logger = require('../common/logger') const { STATUS } = require('./consts') const createDaemon = require('./daemon') +const ipcMainEvents = require('../utils/ipc-main-events') module.exports = async function (ctx) { let ipfsd = null @@ -14,7 +15,7 @@ module.exports = async function (ctx) { const updateStatus = (stat, id = null) => { status = stat - ipcMain.emit('ipfsd', status, id) + ipcMain.emit(ipcMainEvents.IPFSD, status, id) } const getIpfsd = async (optional = false) => { diff --git a/src/enable-namesys-pubsub.js b/src/enable-namesys-pubsub.js index 0e619e39e..1cd482c12 100644 --- a/src/enable-namesys-pubsub.js +++ b/src/enable-namesys-pubsub.js @@ -3,6 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { EXPERIMENT_PUBSUB_NAMESYS: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') +const ipcMainEvents = require('./utils/ipc-main-events') const namesysPubsubFlag = '--enable-namesys-pubsub' const isEnabled = flags => flags.some(f => f === namesysPubsubFlag) @@ -25,7 +26,7 @@ function disable () { function applyConfig (newFlags) { store.set('ipfsConfig.flags', newFlags) - ipcMain.emit('ipfsConfigChanged') // trigger node restart + ipcMain.emit(ipcMainEvents.IPFS_CONFIG_CHANGED) // trigger node restart } module.exports = async function () { diff --git a/src/enable-pubsub.js b/src/enable-pubsub.js index bc2006e68..1a2368c88 100644 --- a/src/enable-pubsub.js +++ b/src/enable-pubsub.js @@ -3,6 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { EXPERIMENT_PUBSUB: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') +const ipcMainEvents = require('./utils/ipc-main-events') const pubsubFlag = '--enable-pubsub-experiment' const isEnabled = flags => flags.some(f => f === pubsubFlag) @@ -25,7 +26,7 @@ function disable () { function applyConfig (newFlags) { store.set('ipfsConfig.flags', newFlags) - ipcMain.emit('ipfsConfigChanged') // trigger node restart + ipcMain.emit(ipcMainEvents.IPFS_CONFIG_CHANGED) // trigger node restart } module.exports = async function () { diff --git a/src/i18n.js b/src/i18n.js index 6e6d69c69..67a08f872 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -4,6 +4,7 @@ const i18n = require('i18next') const ICU = require('i18next-icu') const Backend = require('i18next-fs-backend') const store = require('./common/store') +const ipcMainEvents = require('./utils/ipc-main-events') module.exports = async function () { await i18n @@ -30,6 +31,6 @@ module.exports = async function () { store.set('language', lang) await i18n.changeLanguage(lang) - ipcMain.emit('languageUpdated', lang) + ipcMain.emit(ipcMainEvents.LANG_UPDATED, lang) }) } diff --git a/src/run-gc.js b/src/run-gc.js index 7b6879bc3..92f5b6d2f 100644 --- a/src/run-gc.js +++ b/src/run-gc.js @@ -3,6 +3,7 @@ const { ipcMain } = require('electron') const logger = require('./common/logger') const { showDialog, recoverableErrorDialog } = require('./dialogs') const dock = require('./utils/dock') +const ipcMainEvents = require('./utils/ipc-main-events') module.exports = function runGarbageCollector ({ getIpfsd }) { dock.run(async () => { @@ -30,7 +31,7 @@ module.exports = function runGarbageCollector ({ getIpfsd }) { return } - ipcMain.emit('gcRunning') + ipcMain.emit(ipcMainEvents.GC_RUNNING) try { const errors = [] @@ -63,6 +64,6 @@ module.exports = function runGarbageCollector ({ getIpfsd }) { }) } - ipcMain.emit('gcEnded') + ipcMain.emit(ipcMainEvents.GC_ENDED) }) } diff --git a/src/tray.js b/src/tray.js index e745b64a2..1a9bd141a 100644 --- a/src/tray.js +++ b/src/tray.js @@ -6,6 +6,7 @@ const logger = require('./common/logger') const store = require('./common/store') const moveRepositoryLocation = require('./move-repository-location') const runGarbageCollector = require('./run-gc') +const ipcMainEvents = require('./utils/ipc-main-events') const { setCustomBinary, clearCustomBinary, hasCustomBinary } = require('./custom-ipfs-binary') const { STATUS } = require('./daemon') const { IS_MAC, IS_WIN, VERSION, GO_IPFS_VERSION } = require('./common/consts') @@ -19,7 +20,7 @@ function buildCheckbox (key, label) { return { id: key, label: i18n.t(label), - click: () => { ipcMain.emit(`toggle_${key}`) }, + click: () => { ipcMainEvents.TOGGLE(key) }, type: 'checkbox', checked: false } @@ -261,8 +262,8 @@ module.exports = function (ctx) { tray.setContextMenu(menu) tray.setToolTip('IPFS Desktop') - menu.on('menu-will-show', () => { ipcMain.emit('menubar-will-open') }) - menu.on('menu-will-close', () => { ipcMain.emit('menubar-will-close') }) + menu.on('menu-will-show', () => ipcMain.emit(ipcMainEvents.MENUBAR_OPEN)) + menu.on('menu-will-close', () => ipcMain.emit(ipcMainEvents.MENUBAR_CLOSE)) updateMenu() } diff --git a/src/utils/create-toggler.js b/src/utils/create-toggler.js index ab179e61b..bb2719a9e 100644 --- a/src/utils/create-toggler.js +++ b/src/utils/create-toggler.js @@ -1,6 +1,7 @@ const { ipcMain } = require('electron') const store = require('../common/store') const logger = require('../common/logger') +const ipcMainEvents = require('./ipc-main-events') module.exports = function (settingsOption, activate) { ipcMain.on(`toggle_${settingsOption}`, async () => { @@ -17,6 +18,6 @@ module.exports = function (settingsOption, activate) { // We always emit the event so any handlers for it can act upon // the current configuration, whether it was successfully // updated or not. - ipcMain.emit('configUpdated') + ipcMain.emit(ipcMainEvents.CONFIG_UPDATED) }) } diff --git a/src/utils/ipcMainEvents.js b/src/utils/ipcMainEvents.js new file mode 100644 index 000000000..cfee367a7 --- /dev/null +++ b/src/utils/ipcMainEvents.js @@ -0,0 +1,19 @@ +const { ipcMain } = require('electron') + +const ipcMainEvents = Object.freeze({ + CONFIG_UPDATED: 'configUpdated', + GC_ENDED: 'gcEnded', + GC_RUNNING: 'gcRunning', + IPFSD: 'ipfsd', + IPFS_CONFIG_CHANGED: 'ipfsConfigChanged', + LANG_UPDATED: 'languageUpdated', + MENUBAR_CLOSE: 'menubar-will-close', + MENUBAR_OPEN: 'menubar-will-open', + UPDATING: 'updating', + UPDATING_ENDED: 'updatingEnded', + TOGGLE: function (key) { + ipcMain.emit(`toggle_${key}`) + } +}) + +module.exports = ipcMainEvents From 137eb8c5a44c685cd761147966f1d2781fd7ed75 Mon Sep 17 00:00:00 2001 From: Nick Oliveira <87996659+noliveira95@users.noreply.github.com> Date: Fri, 24 Jun 2022 21:01:45 -0700 Subject: [PATCH 2/7] changed ipc-main-events to ipcMainEvents --- src/auto-updater/index.js | 2 +- src/automatic-gc.js | 2 +- src/daemon/index.js | 2 +- src/enable-namesys-pubsub.js | 2 +- src/enable-pubsub.js | 2 +- src/i18n.js | 2 +- src/run-gc.js | 2 +- src/tray.js | 2 +- src/utils/create-toggler.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index 6777f7081..7e056a416 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -5,7 +5,7 @@ const { ipcMain } = require('electron') const logger = require('../common/logger') const { showDialog } = require('../dialogs') const { IS_MAC, IS_WIN, IS_APPIMAGE } = require('../common/consts') -const ipcMainEvents = require('../utils/ipc-main-events') +const ipcMainEvents = require('../utils/ipcMainEvents') function isAutoUpdateSupported () { // atm only macOS, windows and AppImage builds support autoupdate mechanism, diff --git a/src/automatic-gc.js b/src/automatic-gc.js index 0558e583b..d68f80bc6 100644 --- a/src/automatic-gc.js +++ b/src/automatic-gc.js @@ -3,7 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { AUTO_GARBAGE_COLLECTOR: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') -const ipcMainEvents = require('./utils/ipc-main-events') +const ipcMainEvents = require('./utils/ipcMainEvents') const gcFlag = '--enable-gc' const isEnabled = flags => flags.some(f => f === gcFlag) diff --git a/src/daemon/index.js b/src/daemon/index.js index efce51992..21bca0c1a 100644 --- a/src/daemon/index.js +++ b/src/daemon/index.js @@ -6,7 +6,7 @@ const store = require('../common/store') const logger = require('../common/logger') const { STATUS } = require('./consts') const createDaemon = require('./daemon') -const ipcMainEvents = require('../utils/ipc-main-events') +const ipcMainEvents = require('../utils/ipcMainEvents') module.exports = async function (ctx) { let ipfsd = null diff --git a/src/enable-namesys-pubsub.js b/src/enable-namesys-pubsub.js index 1cd482c12..e2bb3f423 100644 --- a/src/enable-namesys-pubsub.js +++ b/src/enable-namesys-pubsub.js @@ -3,7 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { EXPERIMENT_PUBSUB_NAMESYS: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') -const ipcMainEvents = require('./utils/ipc-main-events') +const ipcMainEvents = require('./utils/ipcMainEvents') const namesysPubsubFlag = '--enable-namesys-pubsub' const isEnabled = flags => flags.some(f => f === namesysPubsubFlag) diff --git a/src/enable-pubsub.js b/src/enable-pubsub.js index 1a2368c88..73cc69954 100644 --- a/src/enable-pubsub.js +++ b/src/enable-pubsub.js @@ -3,7 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { EXPERIMENT_PUBSUB: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') -const ipcMainEvents = require('./utils/ipc-main-events') +const ipcMainEvents = require('./utils/ipcMainEvents') const pubsubFlag = '--enable-pubsub-experiment' const isEnabled = flags => flags.some(f => f === pubsubFlag) diff --git a/src/i18n.js b/src/i18n.js index 67a08f872..339dbd85e 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -4,7 +4,7 @@ const i18n = require('i18next') const ICU = require('i18next-icu') const Backend = require('i18next-fs-backend') const store = require('./common/store') -const ipcMainEvents = require('./utils/ipc-main-events') +const ipcMainEvents = require('./utils/ipcMainEvents') module.exports = async function () { await i18n diff --git a/src/run-gc.js b/src/run-gc.js index 92f5b6d2f..5bcc37a2c 100644 --- a/src/run-gc.js +++ b/src/run-gc.js @@ -3,7 +3,7 @@ const { ipcMain } = require('electron') const logger = require('./common/logger') const { showDialog, recoverableErrorDialog } = require('./dialogs') const dock = require('./utils/dock') -const ipcMainEvents = require('./utils/ipc-main-events') +const ipcMainEvents = require('./utils/ipcMainEvents') module.exports = function runGarbageCollector ({ getIpfsd }) { dock.run(async () => { diff --git a/src/tray.js b/src/tray.js index 1a9bd141a..24461a2d1 100644 --- a/src/tray.js +++ b/src/tray.js @@ -6,7 +6,7 @@ const logger = require('./common/logger') const store = require('./common/store') const moveRepositoryLocation = require('./move-repository-location') const runGarbageCollector = require('./run-gc') -const ipcMainEvents = require('./utils/ipc-main-events') +const ipcMainEvents = require('./utils/ipcMainEvents') const { setCustomBinary, clearCustomBinary, hasCustomBinary } = require('./custom-ipfs-binary') const { STATUS } = require('./daemon') const { IS_MAC, IS_WIN, VERSION, GO_IPFS_VERSION } = require('./common/consts') diff --git a/src/utils/create-toggler.js b/src/utils/create-toggler.js index bb2719a9e..716ca555d 100644 --- a/src/utils/create-toggler.js +++ b/src/utils/create-toggler.js @@ -1,7 +1,7 @@ const { ipcMain } = require('electron') const store = require('../common/store') const logger = require('../common/logger') -const ipcMainEvents = require('./ipc-main-events') +const ipcMainEvents = require('./ipcMainEvents') module.exports = function (settingsOption, activate) { ipcMain.on(`toggle_${settingsOption}`, async () => { From fe4f5aca3be205913f5c1afd20d0c63ed7c62a6f Mon Sep 17 00:00:00 2001 From: Nick Oliveira <87996659+noliveira95@users.noreply.github.com> Date: Fri, 24 Jun 2022 21:08:37 -0700 Subject: [PATCH 3/7] destructured ipcMain emit --- src/tray.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tray.js b/src/tray.js index 24461a2d1..61274b37b 100644 --- a/src/tray.js +++ b/src/tray.js @@ -262,8 +262,8 @@ module.exports = function (ctx) { tray.setContextMenu(menu) tray.setToolTip('IPFS Desktop') - menu.on('menu-will-show', () => ipcMain.emit(ipcMainEvents.MENUBAR_OPEN)) - menu.on('menu-will-close', () => ipcMain.emit(ipcMainEvents.MENUBAR_CLOSE)) + menu.on('menu-will-show', () => { ipcMain.emit(ipcMainEvents.MENUBAR_OPEN) }) + menu.on('menu-will-close', () => { ipcMain.emit(ipcMainEvents.MENUBAR_CLOSE) }) updateMenu() } From e44d7a96db430e6fe85814f778c34652263ef413 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 18 Jul 2022 10:35:56 -0700 Subject: [PATCH 4/7] Update create-toggler.js --- src/utils/create-toggler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/create-toggler.js b/src/utils/create-toggler.js index 716ca555d..57743332f 100644 --- a/src/utils/create-toggler.js +++ b/src/utils/create-toggler.js @@ -4,7 +4,7 @@ const logger = require('../common/logger') const ipcMainEvents = require('./ipcMainEvents') module.exports = function (settingsOption, activate) { - ipcMain.on(`toggle_${settingsOption}`, async () => { + ipcMain.on(ipcMainEvents.TOGGLE(settingsOption), async () => { const oldValue = store.get(settingsOption, null) const newValue = !oldValue From 3d4c48e7a99c2e2aaef8570a0e6866d63f72fee4 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 18 Jul 2022 10:51:33 -0700 Subject: [PATCH 5/7] Update ipcMainEvents.js --- src/utils/ipcMainEvents.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/utils/ipcMainEvents.js b/src/utils/ipcMainEvents.js index cfee367a7..628cc4bf5 100644 --- a/src/utils/ipcMainEvents.js +++ b/src/utils/ipcMainEvents.js @@ -1,4 +1,3 @@ -const { ipcMain } = require('electron') const ipcMainEvents = Object.freeze({ CONFIG_UPDATED: 'configUpdated', @@ -11,9 +10,7 @@ const ipcMainEvents = Object.freeze({ MENUBAR_OPEN: 'menubar-will-open', UPDATING: 'updating', UPDATING_ENDED: 'updatingEnded', - TOGGLE: function (key) { - ipcMain.emit(`toggle_${key}`) - } + TOGGLE: (key) => `toggle_${key}` }) module.exports = ipcMainEvents From f4de29bbc8830064f07c313c5cd983e893d94a17 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 18 Jul 2022 10:53:23 -0700 Subject: [PATCH 6/7] Update tray.js --- src/tray.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tray.js b/src/tray.js index 61274b37b..73c823eb8 100644 --- a/src/tray.js +++ b/src/tray.js @@ -20,7 +20,7 @@ function buildCheckbox (key, label) { return { id: key, label: i18n.t(label), - click: () => { ipcMainEvents.TOGGLE(key) }, + click: () => { ipcMain.emit(ipcMainEvents.TOGGLE(key)) }, type: 'checkbox', checked: false } From 24c693ae6e6f9067ff6fd52b16f7c33016ea40ac Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 20 Jul 2022 12:17:37 +0200 Subject: [PATCH 7/7] chore: rename file for consistency --- src/auto-updater/index.js | 2 +- src/automatic-gc.js | 2 +- src/{utils/ipcMainEvents.js => common/ipc-main-events.js} | 1 - src/daemon/index.js | 2 +- src/enable-namesys-pubsub.js | 2 +- src/enable-pubsub.js | 2 +- src/i18n.js | 2 +- src/run-gc.js | 2 +- src/tray.js | 2 +- src/utils/create-toggler.js | 2 +- 10 files changed, 9 insertions(+), 10 deletions(-) rename src/{utils/ipcMainEvents.js => common/ipc-main-events.js} (99%) diff --git a/src/auto-updater/index.js b/src/auto-updater/index.js index 7e056a416..f9caabf9e 100644 --- a/src/auto-updater/index.js +++ b/src/auto-updater/index.js @@ -5,7 +5,7 @@ const { ipcMain } = require('electron') const logger = require('../common/logger') const { showDialog } = require('../dialogs') const { IS_MAC, IS_WIN, IS_APPIMAGE } = require('../common/consts') -const ipcMainEvents = require('../utils/ipcMainEvents') +const ipcMainEvents = require('../common/ipc-main-events') function isAutoUpdateSupported () { // atm only macOS, windows and AppImage builds support autoupdate mechanism, diff --git a/src/automatic-gc.js b/src/automatic-gc.js index d68f80bc6..fc366379e 100644 --- a/src/automatic-gc.js +++ b/src/automatic-gc.js @@ -3,7 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { AUTO_GARBAGE_COLLECTOR: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') -const ipcMainEvents = require('./utils/ipcMainEvents') +const ipcMainEvents = require('./common/ipc-main-events') const gcFlag = '--enable-gc' const isEnabled = flags => flags.some(f => f === gcFlag) diff --git a/src/utils/ipcMainEvents.js b/src/common/ipc-main-events.js similarity index 99% rename from src/utils/ipcMainEvents.js rename to src/common/ipc-main-events.js index 628cc4bf5..eefea57e8 100644 --- a/src/utils/ipcMainEvents.js +++ b/src/common/ipc-main-events.js @@ -1,4 +1,3 @@ - const ipcMainEvents = Object.freeze({ CONFIG_UPDATED: 'configUpdated', GC_ENDED: 'gcEnded', diff --git a/src/daemon/index.js b/src/daemon/index.js index 21bca0c1a..828cc417f 100644 --- a/src/daemon/index.js +++ b/src/daemon/index.js @@ -6,7 +6,7 @@ const store = require('../common/store') const logger = require('../common/logger') const { STATUS } = require('./consts') const createDaemon = require('./daemon') -const ipcMainEvents = require('../utils/ipcMainEvents') +const ipcMainEvents = require('../common/ipc-main-events') module.exports = async function (ctx) { let ipfsd = null diff --git a/src/enable-namesys-pubsub.js b/src/enable-namesys-pubsub.js index e2bb3f423..ab51167fd 100644 --- a/src/enable-namesys-pubsub.js +++ b/src/enable-namesys-pubsub.js @@ -3,7 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { EXPERIMENT_PUBSUB_NAMESYS: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') -const ipcMainEvents = require('./utils/ipcMainEvents') +const ipcMainEvents = require('./common/ipc-main-events') const namesysPubsubFlag = '--enable-namesys-pubsub' const isEnabled = flags => flags.some(f => f === namesysPubsubFlag) diff --git a/src/enable-pubsub.js b/src/enable-pubsub.js index 73cc69954..13b3fe670 100644 --- a/src/enable-pubsub.js +++ b/src/enable-pubsub.js @@ -3,7 +3,7 @@ const logger = require('./common/logger') const store = require('./common/store') const { EXPERIMENT_PUBSUB: CONFIG_KEY } = require('./common/config-keys') const { ipcMain } = require('electron') -const ipcMainEvents = require('./utils/ipcMainEvents') +const ipcMainEvents = require('./common/ipc-main-events') const pubsubFlag = '--enable-pubsub-experiment' const isEnabled = flags => flags.some(f => f === pubsubFlag) diff --git a/src/i18n.js b/src/i18n.js index 339dbd85e..c23090c7b 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -4,7 +4,7 @@ const i18n = require('i18next') const ICU = require('i18next-icu') const Backend = require('i18next-fs-backend') const store = require('./common/store') -const ipcMainEvents = require('./utils/ipcMainEvents') +const ipcMainEvents = require('./common/ipc-main-events') module.exports = async function () { await i18n diff --git a/src/run-gc.js b/src/run-gc.js index 5bcc37a2c..afb88990e 100644 --- a/src/run-gc.js +++ b/src/run-gc.js @@ -3,7 +3,7 @@ const { ipcMain } = require('electron') const logger = require('./common/logger') const { showDialog, recoverableErrorDialog } = require('./dialogs') const dock = require('./utils/dock') -const ipcMainEvents = require('./utils/ipcMainEvents') +const ipcMainEvents = require('./common/ipc-main-events') module.exports = function runGarbageCollector ({ getIpfsd }) { dock.run(async () => { diff --git a/src/tray.js b/src/tray.js index 73c823eb8..f640ca3da 100644 --- a/src/tray.js +++ b/src/tray.js @@ -6,7 +6,7 @@ const logger = require('./common/logger') const store = require('./common/store') const moveRepositoryLocation = require('./move-repository-location') const runGarbageCollector = require('./run-gc') -const ipcMainEvents = require('./utils/ipcMainEvents') +const ipcMainEvents = require('./common/ipc-main-events') const { setCustomBinary, clearCustomBinary, hasCustomBinary } = require('./custom-ipfs-binary') const { STATUS } = require('./daemon') const { IS_MAC, IS_WIN, VERSION, GO_IPFS_VERSION } = require('./common/consts') diff --git a/src/utils/create-toggler.js b/src/utils/create-toggler.js index 57743332f..fc32e39c5 100644 --- a/src/utils/create-toggler.js +++ b/src/utils/create-toggler.js @@ -1,7 +1,7 @@ const { ipcMain } = require('electron') const store = require('../common/store') const logger = require('../common/logger') -const ipcMainEvents = require('./ipcMainEvents') +const ipcMainEvents = require('../common/ipc-main-events') module.exports = function (settingsOption, activate) { ipcMain.on(ipcMainEvents.TOGGLE(settingsOption), async () => {