From 6c44662496376b97c8008722a8ae2a1210b87823 Mon Sep 17 00:00:00 2001 From: AsamK Date: Sun, 25 Feb 2024 18:27:20 +0100 Subject: [PATCH] Allow overriding user agent string Not recommended, as it could lead to issues with newer Signal protocol changes. Fixes #1476 --- src/main/java/org/asamk/signal/BaseConfig.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/asamk/signal/BaseConfig.java b/src/main/java/org/asamk/signal/BaseConfig.java index 406c3fb1..9f8eead1 100644 --- a/src/main/java/org/asamk/signal/BaseConfig.java +++ b/src/main/java/org/asamk/signal/BaseConfig.java @@ -1,11 +1,14 @@ package org.asamk.signal; +import java.util.Optional; + public class BaseConfig { public static final String PROJECT_NAME = BaseConfig.class.getPackage().getImplementationTitle(); public static final String PROJECT_VERSION = BaseConfig.class.getPackage().getImplementationVersion(); - static final String USER_AGENT_SIGNAL_ANDROID = "Signal-Android/6.46.0"; + static final String USER_AGENT_SIGNAL_ANDROID = Optional.ofNullable(System.getenv("SIGNAL_CLI_USER_AGENT")) + .orElse("Signal-Android/6.46.0"); static final String USER_AGENT_SIGNAL_CLI = PROJECT_NAME == null ? "signal-cli" : PROJECT_NAME + "/" + PROJECT_VERSION;