mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
27 lines
809 B
TypeScript
27 lines
809 B
TypeScript
// Copyright 2026 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import { getValue } from '../RemoteConfig.dom.js';
|
|
import { safeParseInteger } from './numbers.std.js';
|
|
import { DAY, SECOND } from './durations/index.std.js';
|
|
|
|
const DEFAULT_DELETE_MAX_AGE_MS = DAY;
|
|
|
|
function parseMaxAgeSecsToMs(configValue: string | undefined) {
|
|
if (configValue != null) {
|
|
const parsed = safeParseInteger(configValue);
|
|
if (parsed != null && parsed > 0) {
|
|
return parsed * SECOND;
|
|
}
|
|
}
|
|
return DEFAULT_DELETE_MAX_AGE_MS;
|
|
}
|
|
|
|
export function getNormalDeleteMaxAgeMs(): number {
|
|
return parseMaxAgeSecsToMs(getValue('global.normalDeleteMaxAgeInSeconds'));
|
|
}
|
|
|
|
export function getAdminDeleteMaxAgeMs(): number {
|
|
return parseMaxAgeSecsToMs(getValue('global.adminDeleteMaxAgeInSeconds'));
|
|
}
|