diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-04-23 01:59:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 23:59:21 +0000 |
commit | d02644f7c41150709795e57bfd40351b4da35a7b (patch) | |
tree | 2403fb76bd5fae1703f8b55172ffce9e0a5d2bce /src/features/publishDebugInfo | |
parent | Complete tray icons redesign for all platforms (#28) (diff) | |
download | ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.gz ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.zst ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.zip |
Preload safe debug shim (#29)
In https://github.com/ferdium/ferdium-app/pull/23 we removed usages of
the debug package due to an electron bug.
This patch aims to restore some debug functionality by introducing a
shim. The shim detect whether if it is being introduced in a preload
script where the electron but would be triggered, and falls back to a
simple replacement for debug. However, in the main and renderer
processes, where a preload script is not being used, we still get full
debug functionality.
In this way, a module can be used both in a preload script and outside
of it, while still preserving debug functionality whenever possible.
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/features/publishDebugInfo')
-rw-r--r-- | src/features/publishDebugInfo/Component.js | 2 | ||||
-rw-r--r-- | src/features/publishDebugInfo/index.ts | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/features/publishDebugInfo/Component.js b/src/features/publishDebugInfo/Component.js index 3d4e85dbf..ff052a050 100644 --- a/src/features/publishDebugInfo/Component.js +++ b/src/features/publishDebugInfo/Component.js | |||
@@ -14,7 +14,7 @@ import { DEBUG_API } from '../../config'; | |||
14 | import AppStore from '../../stores/AppStore'; | 14 | import AppStore from '../../stores/AppStore'; |
15 | import ServicesStore from '../../stores/ServicesStore'; | 15 | import ServicesStore from '../../stores/ServicesStore'; |
16 | 16 | ||
17 | const debug = require('debug')('Ferdium:feature:publishDebugInfo'); | 17 | const debug = require('../../preload-safe-debug')('Ferdium:feature:publishDebugInfo'); |
18 | 18 | ||
19 | const messages = defineMessages({ | 19 | const messages = defineMessages({ |
20 | title: { | 20 | title: { |
diff --git a/src/features/publishDebugInfo/index.ts b/src/features/publishDebugInfo/index.ts index 33b8eb6f5..597bcdc12 100644 --- a/src/features/publishDebugInfo/index.ts +++ b/src/features/publishDebugInfo/index.ts | |||
@@ -3,7 +3,7 @@ import { state as ModalState } from './store'; | |||
3 | export { default as Component } from './Component'; | 3 | export { default as Component } from './Component'; |
4 | 4 | ||
5 | const state = ModalState; | 5 | const state = ModalState; |
6 | const debug = require('debug')('Ferdium:feature:publishDebugInfo'); | 6 | const debug = require('../../preload-safe-debug')('Ferdium:feature:publishDebugInfo'); |
7 | 7 | ||
8 | export default function initialize() { | 8 | export default function initialize() { |
9 | debug('Initialize publishDebugInfo feature'); | 9 | debug('Initialize publishDebugInfo feature'); |