diff --git a/src/main/java/org/qortal/api/resource/ChatResource.java b/src/main/java/org/qortal/api/resource/ChatResource.java index 66a2bd462..99b37934c 100644 --- a/src/main/java/org/qortal/api/resource/ChatResource.java +++ b/src/main/java/org/qortal/api/resource/ChatResource.java @@ -22,6 +22,7 @@ import org.qortal.repository.DataException; import org.qortal.repository.Repository; import org.qortal.repository.RepositoryManager; +import org.qortal.settings.Settings; import org.qortal.transaction.ChatTransaction; import org.qortal.transaction.Transaction; import org.qortal.transaction.Transaction.TransactionType; @@ -273,7 +274,8 @@ public ActiveChats getActiveChats(@PathParam("address") String address, @QueryPa @ApiErrors({ApiError.TRANSACTION_INVALID, ApiError.TRANSFORMATION_ERROR, ApiError.REPOSITORY_ISSUE}) @SecurityRequirement(name = "apiKey") public String buildChat(@HeaderParam(Security.API_KEY_HEADER) String apiKey, ChatTransactionData transactionData) { - Security.checkApiCallAllowed(request); + if (!Settings.getInstance().isChatAuthBypassEnabled()) + Security.checkApiCallAllowed(request); try (final Repository repository = RepositoryManager.getRepository()) { ChatTransaction chatTransaction = (ChatTransaction) Transaction.fromData(repository, transactionData); diff --git a/src/main/java/org/qortal/settings/Settings.java b/src/main/java/org/qortal/settings/Settings.java index df59c0371..99ef8b8ea 100644 --- a/src/main/java/org/qortal/settings/Settings.java +++ b/src/main/java/org/qortal/settings/Settings.java @@ -367,6 +367,9 @@ public class Settings { /** Whether to serve QDN data without authentication */ private boolean qdnAuthBypassEnabled = true; + /** Whether to accept CHAT transactions without authentication */ + private boolean chatAuthBypassEnabled = false; + /** Limit threads per message type */ private Set maxThreadsPerMessageType = new HashSet<>(); @@ -1110,6 +1113,10 @@ public boolean isQDNAuthBypassEnabled() { return this.qdnAuthBypassEnabled; } + public boolean isChatAuthBypassEnabled() { + return this.chatAuthBypassEnabled; + } + public Integer getMaxThreadsForMessageType(MessageType messageType) { if (maxThreadsPerMessageType != null) { for (ThreadLimit threadLimit : maxThreadsPerMessageType) {