2022-02-11 21:38:52 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { refreshRemoteConfig } from '../../RemoteConfig';
|
2023-07-13 19:06:42 +00:00
|
|
|
import type {
|
|
|
|
WebAPIType,
|
|
|
|
RemoteConfigResponseType,
|
|
|
|
} from '../../textsecure/WebAPI';
|
|
|
|
import { SECOND } from '../../util/durations';
|
2022-02-11 21:38:52 +00:00
|
|
|
|
|
|
|
export async function updateRemoteConfig(
|
2023-07-13 19:06:42 +00:00
|
|
|
newConfig: RemoteConfigResponseType['config']
|
2022-02-11 21:38:52 +00:00
|
|
|
): Promise<void> {
|
|
|
|
const fakeServer = {
|
|
|
|
async getConfig() {
|
2023-07-13 19:06:42 +00:00
|
|
|
return { config: newConfig, serverEpochTime: Date.now() / SECOND };
|
2022-02-11 21:38:52 +00:00
|
|
|
},
|
|
|
|
} as Partial<WebAPIType> as unknown as WebAPIType;
|
|
|
|
|
|
|
|
await refreshRemoteConfig(fakeServer);
|
|
|
|
}
|