Use synchronous IPC for passing config

This commit is contained in:
Fedor Indutny 2023-04-07 09:42:12 -07:00 committed by GitHub
parent 3e586be46a
commit bd41d7b216
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 97 deletions

View file

@ -1,12 +1,10 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { RendererConfigType } from '../types/RendererConfig';
import { strictAssert } from '../util/assert';
import { ipcRenderer } from 'electron';
const params = new URLSearchParams(document.location.search);
const configParam = params.get('config');
strictAssert(typeof configParam === 'string', 'config is not a string');
const config: RendererConfigType = JSON.parse(configParam);
import type { RendererConfigType } from '../types/RendererConfig';
const config: RendererConfigType = ipcRenderer.sendSync('get-config');
export { config };