diff --git a/app/main.ts b/app/main.ts index e70940e36..99482de9e 100644 --- a/app/main.ts +++ b/app/main.ts @@ -2498,9 +2498,6 @@ ipc.on('get-config', async event => { preferredSystemLocales: getPreferredSystemLocales(), localeOverride: getLocaleOverride(), version: app.getVersion(), - libsignalNetEnvironment: config.has('libsignalNetEnvironment') - ? config.get('libsignalNetEnvironment') - : undefined, buildCreation: config.get('buildCreation'), buildExpiration: config.get('buildExpiration'), challengeUrl: config.get('challengeUrl'), diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 14bc53d2e..b7aace75c 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -82,7 +82,7 @@ const DEFAULT_TIMEOUT = 30 * SECOND; // (and other connectivity params) of the services. function resolveLibsignalNetEnvironment( appEnv: Environment, - libsignalNetEnv: string | undefined + url: string ): Net.Environment { switch (appEnv) { case Environment.Production: @@ -91,12 +91,10 @@ function resolveLibsignalNetEnvironment( // In the case of the `Development` Desktop env, // we should be checking the provided string value // of `libsignalNetEnv` - switch (libsignalNetEnv) { - case 'production': - return Net.Environment.Production; - default: - return Net.Environment.Staging; + if (/staging/i.test(url)) { + return Net.Environment.Staging; } + return Net.Environment.Production; case Environment.Test: case Environment.Staging: default: @@ -654,7 +652,6 @@ type InitializeOptionsType = { proxyUrl: string | undefined; version: string; directoryConfig: DirectoryConfigType; - libsignalNetEnvironment: string | undefined; disableIPv6: boolean; }; @@ -1498,7 +1495,6 @@ export function initialize({ contentProxyUrl, proxyUrl, version, - libsignalNetEnvironment, disableIPv6, }: InitializeOptionsType): WebAPIConnectType { if (!isString(url)) { @@ -1542,10 +1538,7 @@ export function initialize({ // for providing network layer API and related functionality. // It's important to have a single instance of this class as it holds // resources that are shared across all other use cases. - const env = resolveLibsignalNetEnvironment( - getEnvironment(), - libsignalNetEnvironment - ); + const env = resolveLibsignalNetEnvironment(getEnvironment(), url); log.info(`libsignal net environment resolved to [${Net.Environment[env]}]`); const libsignalNet = new Net.Net(env, getUserAgent(version)); libsignalNet.setIpv6Enabled(!disableIPv6); diff --git a/ts/types/RendererConfig.ts b/ts/types/RendererConfig.ts index ad363f923..6eba20603 100644 --- a/ts/types/RendererConfig.ts +++ b/ts/types/RendererConfig.ts @@ -73,7 +73,6 @@ export const rendererConfigSchema = z.object({ resourcesUrl: configRequiredStringSchema, userDataPath: configRequiredStringSchema, version: configRequiredStringSchema, - libsignalNetEnvironment: configOptionalStringSchema, directoryConfig: directoryConfigSchema, // Only used by main window diff --git a/ts/windows/main/phase2-dependencies.ts b/ts/windows/main/phase2-dependencies.ts index 9775cf309..c7e303b13 100644 --- a/ts/windows/main/phase2-dependencies.ts +++ b/ts/windows/main/phase2-dependencies.ts @@ -37,7 +37,6 @@ window.WebAPI = window.textsecure.WebAPI.initialize({ contentProxyUrl: config.contentProxyUrl, proxyUrl: config.proxyUrl, version: config.version, - libsignalNetEnvironment: config.libsignalNetEnvironment, disableIPv6: config.disableIPv6, });