aboutsummaryrefslogtreecommitdiffstats
path: root/packages/service-preload/src/index.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-13 02:34:40 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-02-08 21:43:03 +0100
commit5dbe6b2735c6e0f0d92f5f53806bcbcaeebfbdf2 (patch)
tree80c2e3a72a06489ab7b54682b1b8546d6bf06985 /packages/service-preload/src/index.ts
parentfeat: Service switcher buttons (diff)
downloadsophie-5dbe6b2735c6e0f0d92f5f53806bcbcaeebfbdf2.tar.gz
sophie-5dbe6b2735c6e0f0d92f5f53806bcbcaeebfbdf2.tar.zst
sophie-5dbe6b2735c6e0f0d92f5f53806bcbcaeebfbdf2.zip
fix: Do not access localStorage in service-preload
loglevel wants to persist the current log level in localStorage, which apparently crashes the network service. We'll need to find another way to log in service preload scripts. The main window preload scripts seems unaffected, even though we use loglevel (and hence localStorage) in both the preload and the renderer script. Maybe related: https://github.com/electron/electron/issues/31689 Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/service-preload/src/index.ts')
-rw-r--r--packages/service-preload/src/index.ts6
1 files changed, 1 insertions, 5 deletions
diff --git a/packages/service-preload/src/index.ts b/packages/service-preload/src/index.ts
index bb4a62d..8b6630a 100644
--- a/packages/service-preload/src/index.ts
+++ b/packages/service-preload/src/index.ts
@@ -21,10 +21,6 @@
21import { ServiceToMainIpcMessage, webSource } from '@sophie/service-shared'; 21import { ServiceToMainIpcMessage, webSource } from '@sophie/service-shared';
22import { ipcRenderer, webFrame } from 'electron'; 22import { ipcRenderer, webFrame } from 'electron';
23 23
24import { getLogger } from './utils/log';
25
26const log = getLogger('index');
27
28if (webFrame.parent === null) { 24if (webFrame.parent === null) {
29 // Inject CSS to simulate `browserView.setBackgroundColor`. 25 // Inject CSS to simulate `browserView.setBackgroundColor`.
30 // This is injected before the page loads, so the styles from the website will overwrite it. 26 // This is injected before the page loads, so the styles from the website will overwrite it.
@@ -62,5 +58,5 @@ async function fetchAndExecuteInjectScript(): Promise<void> {
62} 58}
63 59
64fetchAndExecuteInjectScript().catch((error) => { 60fetchAndExecuteInjectScript().catch((error) => {
65 log.error('Failed to fetch inject source:', error); 61 console.error('Failed to fetch inject source:', error);
66}); 62});