Allow overriding user agent string

Not recommended, as it could lead to issues with newer Signal protocol changes.

Fixes #1476
This commit is contained in:
AsamK 2024-02-25 18:27:20 +01:00
parent 22ac3cb50f
commit 6c44662496

View file

@ -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;