Compare commits

...
4 Commits
13 changed files with 48 additions and 9 deletions
+4
View File
@@ -68,6 +68,10 @@ token.key testim
##是否使用AES256加密。默认客户端和服务器都是AES128加密,如果需要开启AES256,需要客户端和IM服务同时开通。 ##是否使用AES256加密。默认客户端和服务器都是AES128加密,如果需要开启AES256,需要客户端和IM服务同时开通。
#encrypt.use_aes256 true #encrypt.use_aes256 true
##当创建一个对象时(用户,群组,频道,机器人等),如果没有传入ID,野火会为这个对象生成一个ID。如果id.use_uuid为true,会使用uuid作为对象ID,否则会使用野火短ID,默认为false。
## 短ID有个很大的风险是容易被人穷举进行攻击。建议用UUID。
id.use_uuid true
##首次登录,是否接收之前的历史消息。 ##首次登录,是否接收之前的历史消息。
##0 不接收历史消息,只接收${message.compensate_time_limit}毫秒以内的消息,由于服务器没有保存已经收取记录,所以如果有超过${message.compensate_time_limit}毫秒之前未收取的消息也不会收取下拉; ##0 不接收历史消息,只接收${message.compensate_time_limit}毫秒以内的消息,由于服务器没有保存已经收取记录,所以如果有超过${message.compensate_time_limit}毫秒之前未收取的消息也不会收取下拉;
##1接收,会接收 message.max_queue 配置的条数的历史消息 ##1接收,会接收 message.max_queue 配置的条数的历史消息
+1 -1
View File
@@ -5,7 +5,7 @@
<relativePath>../</relativePath> <relativePath>../</relativePath>
<artifactId>wildfirechat-parent</artifactId> <artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId> <groupId>cn.wildfirechat</groupId>
<version>1.2.8</version> <version>1.2.9</version>
</parent> </parent>
<artifactId>moquette-broker</artifactId> <artifactId>moquette-broker</artifactId>
@@ -53,6 +53,7 @@ public class GetGroupInfoAction extends AdminAction {
pojoGroupInfo.setPortrait(groupInfo.getPortrait()); pojoGroupInfo.setPortrait(groupInfo.getPortrait());
pojoGroupInfo.setTarget_id(groupInfo.getTargetId()); pojoGroupInfo.setTarget_id(groupInfo.getTargetId());
pojoGroupInfo.setType(groupInfo.getType()); pojoGroupInfo.setType(groupInfo.getType());
pojoGroupInfo.setMember_count(groupInfo.getMemberCount());
pojoGroupInfo.setMute(groupInfo.getMute()); pojoGroupInfo.setMute(groupInfo.getMute());
pojoGroupInfo.setJoin_type(groupInfo.getJoinType()); pojoGroupInfo.setJoin_type(groupInfo.getJoinType());
pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat()); pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat());
@@ -61,6 +62,8 @@ public class GetGroupInfoAction extends AdminAction {
pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage()); pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage());
pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0); pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0);
pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0); pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0);
pojoGroupInfo.setUpdate_dt(groupInfo.getUpdateDt());
pojoGroupInfo.setMember_update_dt(groupInfo.getMemberUpdateDt());
result = RestResult.ok(pojoGroupInfo); result = RestResult.ok(pojoGroupInfo);
} }
setResponseContent(result, response); setResponseContent(result, response);
@@ -52,6 +52,7 @@ public class GetGroupInfoAction extends RobotAction {
pojoGroupInfo.setPortrait(groupInfo.getPortrait()); pojoGroupInfo.setPortrait(groupInfo.getPortrait());
pojoGroupInfo.setTarget_id(groupInfo.getTargetId()); pojoGroupInfo.setTarget_id(groupInfo.getTargetId());
pojoGroupInfo.setType(groupInfo.getType()); pojoGroupInfo.setType(groupInfo.getType());
pojoGroupInfo.setMember_count(groupInfo.getMemberCount());
pojoGroupInfo.setMute(groupInfo.getMute()); pojoGroupInfo.setMute(groupInfo.getMute());
pojoGroupInfo.setJoin_type(groupInfo.getJoinType()); pojoGroupInfo.setJoin_type(groupInfo.getJoinType());
pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat()); pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat());
@@ -60,6 +61,8 @@ public class GetGroupInfoAction extends RobotAction {
pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage()); pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage());
pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0); pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0);
pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0); pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0);
pojoGroupInfo.setUpdate_dt(groupInfo.getUpdateDt());
pojoGroupInfo.setMember_update_dt(groupInfo.getMemberUpdateDt());
result = RestResult.ok(pojoGroupInfo); result = RestResult.ok(pojoGroupInfo);
} }
setResponseContent(result, response); setResponseContent(result, response);
@@ -115,6 +115,8 @@ public final class BrokerConstants {
public static final String CONNECT_CLIENT_SIGNATURE_LIST = "connect.client_signature_list"; public static final String CONNECT_CLIENT_SIGNATURE_LIST = "connect.client_signature_list";
public static final String CONNECT_REJECT_EMPTY_SIGNATURE = "connect.reject_empty_signature"; public static final String CONNECT_REJECT_EMPTY_SIGNATURE = "connect.reject_empty_signature";
public static final String ID_USE_UUID = "id.use_uuid";
public static final String EMBED_DB_PROPERTY_NAME = "embed.db"; public static final String EMBED_DB_PROPERTY_NAME = "embed.db";
public static final String DB_AUTO_CLEAN_HISTORY_MESSAGES = "db.auto_clean_history_messages"; public static final String DB_AUTO_CLEAN_HISTORY_MESSAGES = "db.auto_clean_history_messages";
public static final String H2DB_PATH = "h2db.path"; public static final String H2DB_PATH = "h2db.path";
@@ -166,6 +166,8 @@ public class MemoryMessagesStore implements IMessagesStore {
private Set<String> mAllowStrangerChatSet = new HashSet<>(); private Set<String> mAllowStrangerChatSet = new HashSet<>();
private boolean mDisableStrangerAddGroup = false; private boolean mDisableStrangerAddGroup = false;
private boolean mIDUseUUID = true;
private Set<String> mClientSignatureSet = new HashSet<>(); private Set<String> mClientSignatureSet = new HashSet<>();
private boolean mRejectEmptySignature = true; private boolean mRejectEmptySignature = true;
@@ -614,6 +616,11 @@ public class MemoryMessagesStore implements IMessagesStore {
} catch (Exception e) { } catch (Exception e) {
} }
try {
mIDUseUUID = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ID_USE_UUID, "false"));
} catch (Exception e) {
}
} }
private void printMissConfigLog(String config, String defaultValue) { private void printMissConfigLog(String config, String defaultValue) {
@@ -4791,9 +4798,11 @@ public class MemoryMessagesStore implements IMessagesStore {
@Override @Override
public String getShortUUID(){ public String getShortUUID(){
int id = databaseStore.getGeneratedId(); if(!mIDUseUUID) {
if (id > 0) { int id = databaseStore.getGeneratedId();
return IDUtils.toUid(id); if (id > 0) {
return IDUtils.toUid(id);
}
} }
return UUIDGenerator.getUUID(); return UUIDGenerator.getUUID();
} }
+1 -1
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>wildfirechat-parent</artifactId> <artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId> <groupId>cn.wildfirechat</groupId>
<version>1.2.8</version> <version>1.2.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -6,7 +6,7 @@
<!--<relativePath>../pom.xml</relativePath>--> <!--<relativePath>../pom.xml</relativePath>-->
<artifactId>wildfirechat-parent</artifactId> <artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId> <groupId>cn.wildfirechat</groupId>
<version>1.2.8</version> <version>1.2.9</version>
</parent> </parent>
<artifactId>distribution</artifactId> <artifactId>distribution</artifactId>
@@ -66,6 +66,10 @@ token.key testim
##是否使用AES256加密。默认客户端和服务器都是AES128加密,如果需要开启AES256,需要客户端和IM服务同时开通。 ##是否使用AES256加密。默认客户端和服务器都是AES128加密,如果需要开启AES256,需要客户端和IM服务同时开通。
#encrypt.use_aes256 true #encrypt.use_aes256 true
##当创建一个对象时(用户,群组,频道,机器人等),如果没有传入ID,野火会为这个对象生成一个ID。如果id.use_uuid为true,会使用uuid作为对象ID,否则会使用野火短ID,默认为false。
## 短ID有个很大的风险是容易被人穷举进行攻击。建议用UUID。
id.use_uuid true
##首次登录,是否接收之前的历史消息。 ##首次登录,是否接收之前的历史消息。
##0 不接收历史消息,只接收${message.compensate_time_limit}毫秒以内的消息,由于服务器没有保存已经收取记录,所以如果有超过${message.compensate_time_limit}毫秒之前未收取的消息也不会收取下拉; ##0 不接收历史消息,只接收${message.compensate_time_limit}毫秒以内的消息,由于服务器没有保存已经收取记录,所以如果有超过${message.compensate_time_limit}毫秒之前未收取的消息也不会收取下拉;
##1接收,会接收 message.max_queue 配置的条数的历史消息 ##1接收,会接收 message.max_queue 配置的条数的历史消息
+1 -1
View File
@@ -12,7 +12,7 @@
<artifactId>wildfirechat-parent</artifactId> <artifactId>wildfirechat-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.2.8</version> <version>1.2.9</version>
<name>Wildfire Chat</name> <name>Wildfire Chat</name>
<description>Wildfire Chat Server</description> <description>Wildfire Chat Server</description>
<inceptionYear>2019</inceptionYear> <inceptionYear>2019</inceptionYear>
+5
View File
@@ -12,6 +12,11 @@
# 更新记录 # 更新记录
--------------
Release note 1.2.9:
1. 解决server api获取群组信息不全的问题。
2. 添加配置使用uuid作为用户群组等ID。
-------------- --------------
Release note 1.2.8: Release note 1.2.8:
1. server api获取被封禁用户时,过滤掉正常用户。 1. server api获取被封禁用户时,过滤掉正常用户。
+1 -1
View File
@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>wildfirechat-parent</artifactId> <artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId> <groupId>cn.wildfirechat</groupId>
<version>1.2.8</version> <version>1.2.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -1,5 +1,6 @@
package cn.wildfirechat.sdk.utilities; package cn.wildfirechat.sdk.utilities;
import cn.wildfirechat.common.ErrorCode;
import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.model.IMResult;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@@ -157,7 +158,15 @@ public class AdminHttpUtils extends JsonUtils {
LOG.info("Request error: " + statusCode + " error msg:" + content); LOG.info("Request error: " + statusCode + " error msg:" + content);
throw new Exception("Http request error with code:" + statusCode); throw new Exception("Http request error with code:" + statusCode);
} else { } else {
return fromJsonObject(content, clazz); IMResult<T> result = fromJsonObject(content, clazz);
if(result != null){
if(result.getErrorCode() == ErrorCode.ERROR_CODE_AUTH_FAILURE) {
LOG.error("鉴权失败,IM服务地址或者密钥配置错误,请检查IM服务{}的配置文件中的http.admin.secret_key是否是{}", adminUrl, adminSecret);
} else if(result.getErrorCode() == ErrorCode.ERROR_CODE_SIGN_EXPIRED) {
LOG.error("时间验证失败,请确保当前服务和IM服务{}的时间是一致的", adminUrl);
}
}
return result;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();