Use synchronous IPC for passing config
This commit is contained in:
parent
3e586be46a
commit
bd41d7b216
6 changed files with 87 additions and 97 deletions
|
@ -1,8 +1,6 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { mapValues } from 'lodash';
|
||||
|
||||
export function maybeParseUrl(value: string): undefined | URL {
|
||||
if (typeof value === 'string') {
|
||||
try {
|
||||
|
@ -20,9 +18,13 @@ export function setUrlSearchParams(
|
|||
searchParams: Readonly<Record<string, unknown>>
|
||||
): URL {
|
||||
const result = cloneUrl(url);
|
||||
result.search = new URLSearchParams(
|
||||
mapValues(searchParams, stringifySearchParamValue)
|
||||
).toString();
|
||||
result.search = '';
|
||||
for (const [key, value] of Object.entries(searchParams)) {
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
result.searchParams.append(key, String(value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -30,10 +32,6 @@ function cloneUrl(url: Readonly<URL>): URL {
|
|||
return new URL(url.href);
|
||||
}
|
||||
|
||||
function stringifySearchParamValue(value: unknown): string {
|
||||
return value == null ? '' : String(value);
|
||||
}
|
||||
|
||||
export function urlPathFromComponents(
|
||||
components: ReadonlyArray<string>
|
||||
): string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue