From 868c0129455e5ae3423cccf78416076ab2899dd3 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:01:37 -0500 Subject: [PATCH] Add a remote config option to disable libsignal transport in prod Co-authored-by: Sergey Skrobotov --- ts/RemoteConfig.ts | 1 + ts/textsecure/SocketManager.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index 42aea244ed..ed9a062113 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -27,6 +27,7 @@ export type ConfigKeyType = | 'desktop.senderKeyMaxAge' | 'desktop.experimentalTransportEnabled.alpha' | 'desktop.experimentalTransportEnabled.beta' + | 'desktop.experimentalTransportEnabled.prod' | 'desktop.cdsiViaLibsignal' | 'global.attachments.maxBytes' | 'global.attachments.maxReceiveBytes' diff --git a/ts/textsecure/SocketManager.ts b/ts/textsecure/SocketManager.ts index 53fc12697f..3a9945df32 100644 --- a/ts/textsecure/SocketManager.ts +++ b/ts/textsecure/SocketManager.ts @@ -559,8 +559,14 @@ export class SocketManager extends EventListener { : TransportOption.ShadowingLow; } - // in prod, using original - return TransportOption.ShadowingLow; + // in prod, switch to using 'ShadowingHigh' mode, unless user opts out, + // in which case switching to `ShadowingLow` + const configValue = window.Signal.RemoteConfig.isEnabled( + 'desktop.experimentalTransportEnabled.prod' + ); + return configValue + ? TransportOption.ShadowingLow + : TransportOption.Original; } private connectLibsignalUnauthenticated(): AbortableProcess {