Compare commits

...

2 Commits

Author SHA1 Message Date
Greyson Parrelli
94265ac5ed Bump version to 7.37.4 2025-03-25 09:31:37 -04:00
Cody Henthorne
e4894c55cf Only deprecate client on 499s from chat service. 2025-03-25 09:29:19 -04:00
4 changed files with 36 additions and 34 deletions

View File

@@ -21,8 +21,8 @@ plugins {
apply(from = "static-ips.gradle.kts")
val canonicalVersionCode = 1522
val canonicalVersionName = "7.37.3"
val currentHotfixVersion = 0
val canonicalVersionName = "7.37.4"
val currentHotfixVersion = 1
val maxHotfixVersions = 100
val keystores: Map<String, Properties?> = mapOf("debug" to loadKeystoreProperties("keystore.debug.properties"))

View File

@@ -1,31 +0,0 @@
package org.thoughtcrime.securesms.net;
import androidx.annotation.NonNull;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.Response;
/**
* Marks the client as remotely-deprecated when it receives a 499 response.
*/
public final class RemoteDeprecationDetectorInterceptor implements Interceptor {
private static final String TAG = Log.tag(RemoteDeprecationDetectorInterceptor.class);
@Override
public @NonNull Response intercept(@NonNull Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
if (response.code() == 499 && !SignalStore.misc().isClientDeprecated()) {
Log.w(TAG, "Received 499. Client version is deprecated.", true);
SignalStore.misc().setClientDeprecated(true);
}
return response;
}
}

View File

@@ -0,0 +1,33 @@
package org.thoughtcrime.securesms.net
import okhttp3.Interceptor
import okhttp3.Response
import org.signal.core.util.logging.Log
import org.signal.core.util.logging.Log.tag
import org.signal.core.util.orNull
import org.thoughtcrime.securesms.keyvalue.SignalStore.Companion.misc
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration
import java.io.IOException
/**
* Marks the client as remotely-deprecated when it receives a 499 response.
*/
class RemoteDeprecationDetectorInterceptor(private val getConfiguration: () -> SignalServiceConfiguration) : Interceptor {
companion object {
private val TAG = tag(RemoteDeprecationDetectorInterceptor::class.java)
}
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val response = chain.proceed(request)
if (response.code == 499 && !misc.isClientDeprecated && getConfiguration().signalServiceUrls.any { request.url.toString().startsWith(it.url) && it.hostHeader.orNull() == request.header("host") }) {
Log.w(TAG, "Received 499. Client version is deprecated.", true)
misc.isClientDeprecated = true
}
return response
}
}

View File

@@ -141,7 +141,7 @@ class SignalServiceNetworkAccess(context: Context) {
private val interceptors: List<Interceptor> = listOf(
StandardUserAgentInterceptor(),
RemoteDeprecationDetectorInterceptor(),
RemoteDeprecationDetectorInterceptor(this::getConfiguration),
DeprecatedClientPreventionInterceptor(),
DeviceTransferBlockingInterceptor.getInstance()
)