mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-18 14:55:19 +01:00
Remove the "unrecognized UA" remote deprecation reason
This commit is contained in:
committed by
Jon Chambers
parent
5d59538924
commit
9dc807a255
@@ -16,15 +16,13 @@ public record DynamicRemoteDeprecationConfiguration(
|
|||||||
@NotNull Map<ClientPlatform, Semver> minimumVersions,
|
@NotNull Map<ClientPlatform, Semver> minimumVersions,
|
||||||
@NotNull Map<ClientPlatform, Semver> versionsPendingDeprecation,
|
@NotNull Map<ClientPlatform, Semver> versionsPendingDeprecation,
|
||||||
@NotNull Map<ClientPlatform, Set<Semver>> blockedVersions,
|
@NotNull Map<ClientPlatform, Set<Semver>> blockedVersions,
|
||||||
@NotNull Map<ClientPlatform, Set<Semver>> versionsPendingBlock,
|
@NotNull Map<ClientPlatform, Set<Semver>> versionsPendingBlock) {
|
||||||
@NotNull Boolean unrecognizedUserAgentAllowed) {
|
|
||||||
|
|
||||||
public static DynamicRemoteDeprecationConfiguration DEFAULT = new DynamicRemoteDeprecationConfiguration(
|
public static DynamicRemoteDeprecationConfiguration DEFAULT = new DynamicRemoteDeprecationConfiguration(
|
||||||
Collections.emptyMap(),
|
Collections.emptyMap(),
|
||||||
Collections.emptyMap(),
|
Collections.emptyMap(),
|
||||||
Collections.emptyMap(),
|
Collections.emptyMap(),
|
||||||
Collections.emptyMap(),
|
Collections.emptyMap());
|
||||||
true);
|
|
||||||
|
|
||||||
public DynamicRemoteDeprecationConfiguration {
|
public DynamicRemoteDeprecationConfiguration {
|
||||||
if (minimumVersions == null) {
|
if (minimumVersions == null) {
|
||||||
@@ -42,9 +40,5 @@ public record DynamicRemoteDeprecationConfiguration(
|
|||||||
if (versionsPendingBlock == null) {
|
if (versionsPendingBlock == null) {
|
||||||
versionsPendingBlock = DEFAULT.versionsPendingBlock();
|
versionsPendingBlock = DEFAULT.versionsPendingBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unrecognizedUserAgentAllowed == null) {
|
|
||||||
unrecognizedUserAgentAllowed = DEFAULT.unrecognizedUserAgentAllowed();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public class RemoteDeprecationFilter implements Filter, ServerInterceptor {
|
|||||||
private static final String REASON_TAG_NAME = "reason";
|
private static final String REASON_TAG_NAME = "reason";
|
||||||
private static final String EXPIRED_CLIENT_REASON = "expired";
|
private static final String EXPIRED_CLIENT_REASON = "expired";
|
||||||
private static final String BLOCKED_CLIENT_REASON = "blocked";
|
private static final String BLOCKED_CLIENT_REASON = "blocked";
|
||||||
private static final String UNRECOGNIZED_UA_REASON = "unrecognized_user_agent";
|
|
||||||
|
|
||||||
public RemoteDeprecationFilter(final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager) {
|
public RemoteDeprecationFilter(final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager) {
|
||||||
this.dynamicConfigurationManager = dynamicConfigurationManager;
|
this.dynamicConfigurationManager = dynamicConfigurationManager;
|
||||||
@@ -110,11 +109,7 @@ public class RemoteDeprecationFilter implements Filter, ServerInterceptor {
|
|||||||
boolean shouldBlock = false;
|
boolean shouldBlock = false;
|
||||||
|
|
||||||
if (userAgent == null) {
|
if (userAgent == null) {
|
||||||
if (configuration.unrecognizedUserAgentAllowed()) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
recordDeprecation(null, UNRECOGNIZED_UA_REASON);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockedVersionsByPlatform.containsKey(userAgent.platform())) {
|
if (blockedVersionsByPlatform.containsKey(userAgent.platform())) {
|
||||||
|
|||||||
@@ -111,8 +111,7 @@ class RemoteDeprecationFilterTest {
|
|||||||
minimumVersionsByPlatform,
|
minimumVersionsByPlatform,
|
||||||
versionsPendingDeprecationByPlatform,
|
versionsPendingDeprecationByPlatform,
|
||||||
blockedVersionsByPlatform,
|
blockedVersionsByPlatform,
|
||||||
versionsPendingBlockByPlatform,
|
versionsPendingBlockByPlatform);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|||||||
Reference in New Issue
Block a user