Compare commits

..
8 Commits
Author SHA1 Message Date
imhao183 51bfb788ac version 0.64 -> 0.65 2021-06-04 18:01:53 +08:00
dependabot[bot] 82088db682 Bump httpclient from 4.4.1 to 4.5.13 in /broker
Bumps httpclient from 4.4.1 to 4.5.13.

---
updated-dependencies:
- dependency-name: org.apache.httpcomponents:httpclient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-06-04 17:58:45 +08:00
dependabot[bot] 463e3e766a Bump httpclient from 4.5.3 to 4.5.13 in /sdk
Bumps httpclient from 4.5.3 to 4.5.13.

---
updated-dependencies:
- dependency-name: org.apache.httpcomponents:httpclient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-06-04 17:58:34 +08:00
imhao183 4b00b873c3 同步会议参数 2021-06-04 17:52:37 +08:00
imhao183 0c06e28116 解决server api强制添加好友请求时被限制的问题 2021-06-04 17:42:17 +08:00
imndx 7ea6ea08fd update readme 2021-06-01 15:50:07 +08:00
imhao183 b61d292fb5 同步会议API 2021-06-01 08:45:00 +08:00
imhao183 0aba453a24 添加分段同步好友/好友请求/用户设置的功能 2021-05-24 14:44:40 +08:00
33 changed files with 327 additions and 26 deletions
+13 -12
View File
@@ -2,18 +2,19 @@
野火IM是一套跨平台、核心功能开源的即时通讯解决方案,主要包含以下内容。
| 仓库 | 说明 | 备注 |
| ------------------------------------------------------------ | ------------------------------------------------------- | ---- |
| [android-chat](https://github.com/wildfirechat/android-chat) | 野火IM Android SDK源码和App源码 |可以很方便地进行二次开发,或集成到现有应用当中 |
| [ios-chat](https://github.com/wildfirechat/ios-chat) | 野火IM iOS SDK源码和App源码 |可以很方便地进行二次开发,或集成到现有应用当中 |
| [pc-chat](https://github.com/wildfirechat/pc-chat) | 基于[Electron](https://electronjs.org/)开发的PC平台应用 | |
| [web-chat](https://github.com/wildfirechat/web-chat) | Web平台的Demo, [体验地址](http://web.wildfirechat.net) | |
| [wx-chat](https://github.com/wildfirechat/wx-chat) | 微信小程序平台的Demo | |
| [server](https://github.com/wildfirechat/server) | IM server | |
| [app server](https://github.com/wildfirechat/app_server) | 应用服务端 | |
| [robot_server](https://github.com/wildfirechat/robot_server) | 机器人服务端 | |
| [push_server](https://github.com/wildfirechat/push_server) | 推送服务器 | |
| [docs](https://github.com/wildfirechat/docs) | 野火IM相关文档,包含设计、概念、开发、使用说明 | | | |
| [GitHub仓库地址(主站)](https://github.com/wildfirechat) | [码云仓库地址(镜像)](https://gitee.com/wfchat) | 说明 | 备注 |
| ------------------------------------------------------------ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [android-chat](https://github.com/wildfirechat/android-chat) | [android-chat](https://gitee.com/wfchat/android-chat) | 野火IM Android SDK源码和App源码 | 可以很方便地进行二次开发,或集成到现有应用当中 |
| [ios-chat](https://github.com/wildfirechat/ios-chat) | [ios-chat](https://gitee.com/wfchat/ios-chat) | 野火IM iOS SDK源码和App源码 | 可以很方便地进行二次开发,或集成到现有应用当中 |
| [pc-chat](https://github.com/wildfirechat/pc-chat) | [pc-chat](https://gitee.com/wfchat/pc-chat) | 基于[Electron](https://electronjs.org/)开发的PC平台应用 | |
| [web-chat](https://github.com/wildfirechat/web-chat) | [web-chat](https://gitee.com/wfchat/web-chat) | Web平台的Demo, [体验地址](http://web.wildfirechat.cn) | |
| [wx-chat](https://github.com/wildfirechat/wx-chat) | [wx-chat](https://gitee.com/wfchat/wx-chat) | 微信小程序平台的Demo | |
| [server](https://github.com/wildfirechat/server) | [server](https://gitee.com/wfchat/server) | IM server | |
| [app server](https://github.com/wildfirechat/app_server) | [app server](https://gitee.com/wfchat/app_server) | 应用服务端 | |
| [robot_server](https://github.com/wildfirechat/robot_server) | [robot_server](https://gitee.com/wfchat/robot_server) | 机器人服务端 | |
| [push_server](https://github.com/wildfirechat/push_server) | [push_server](https://gitee.com/wfchat/push_server) | 推送服务器 | |
| [docs](https://github.com/wildfirechat/docs) | [docs](https://gitee.com/wfchat/docs) | 野火IM相关文档,包含设计、概念、开发、使用说明,[在线查看](https://docs.wildfirechat.cn/) | | |
# server
本工程为野火IM 社区版IM服务软件。野火IM作为一个通用的即时通讯解决方案,可以集成到各种应用中。请阅读[docs](http://docs.wildfirechat.net)或下载服务器[发布版本](https://github.com/wildfirechat/server/releases)
+4
View File
@@ -135,6 +135,10 @@ group.visible_quit_or_kickoff_notification 0
## 注意,修改本配置不会对已经同步的信息产生影响。
#user.hide_properties 3,4,5
# 好友/好友请求/用户设置 这三类数据同步的最大条目数。之前是客户第一次登录时,会把所有的对应数据一次下载到客户端,但如果有特别多的信息,会导致无法同步到客户端,
# 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。
#sync.data_part_size 1000
#*********************************************************************
# hazelcase configuration
#*********************************************************************
+2 -2
View File
@@ -5,7 +5,7 @@
<relativePath>../</relativePath>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>0.64</version>
<version>0.65</version>
</parent>
<artifactId>moquette-broker</artifactId>
@@ -84,7 +84,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
<version>4.5.13</version>
</dependency>
<dependency>
@@ -47,7 +47,7 @@ public class AddFriendRequestAction extends AdminAction {
byteBuf.writeBytes(result);
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
return new Result(errorCode);
}, !input.isForce());
}, input.isForce());
return false;
}
return true;
@@ -157,6 +157,7 @@ public final class BrokerConstants {
public static final String GROUP_Visible_Quit_Kickoff_Notification = "group.visible_quit_or_kickoff_notification";
public static final String USER_HIDE_PROPERTIES = "user.hide_properties";
public static final String SYNC_Data_Part_Size = "sync.data_part_size";
public static final String MESSAGES_FORBIDDEN_CLIENT_SEND_TYPES = "message.forbidden_client_send_types";
public static final String MESSAGES_BLACKLIST_EXCEPTION_TYPES = "message.blacklist_exception_types";
@@ -154,6 +154,7 @@ public class MemoryMessagesStore implements IMessagesStore {
private String mChatroomMemberUpdateCallback;
private boolean mGroupAllowClientCustomOperationNotification;
private int mGroupVisibleQuitKickoffNotification;
private int mSyncDataPartSize = 0;
private Set<Integer> mUserHideProperties = new HashSet<>();
@@ -381,6 +382,12 @@ public class MemoryMessagesStore implements IMessagesStore {
}
try {
mSyncDataPartSize = Integer.parseInt(server.getConfig().getProperty(SYNC_Data_Part_Size, "0"));
} catch (Exception e) {
}
try {
String userHideStr = server.getConfig().getProperty(USER_HIDE_PROPERTIES);
@@ -2573,6 +2580,11 @@ public class MemoryMessagesStore implements IMessagesStore {
}
}
if(mSyncDataPartSize > 0 && out.size() > mSyncDataPartSize) {
out.sort(Comparator.comparingLong(FriendData::getTimestamp));
out = out.subList(0, mSyncDataPartSize);
}
return out;
}
@@ -2618,12 +2630,16 @@ public class MemoryMessagesStore implements IMessagesStore {
}
}
if(mSyncDataPartSize > 0 && out.size() > mSyncDataPartSize) {
out.sort(Comparator.comparingLong(WFCMessage.FriendRequest::getUpdateDt));
out = out.subList(0, mSyncDataPartSize);
}
return out;
}
@Override
public ErrorCode saveAddFriendRequest(String userId, WFCMessage.AddFriendRequest request, long[] head, boolean isAdmin) {
if (mDisableFriendRequest) {
if (!isAdmin && mDisableFriendRequest) {
return ErrorCode.ERROR_CODE_NOT_RIGHT;
}
@@ -3111,6 +3127,12 @@ public class MemoryMessagesStore implements IMessagesStore {
}
}
if(mSyncDataPartSize > 0 && ec == ErrorCode.ERROR_CODE_SUCCESS && builder.getEntryCount() > mSyncDataPartSize) {
List<WFCMessage.UserSettingEntry> list = new ArrayList<>(builder.getEntryList());
list.sort(Comparator.comparingLong(WFCMessage.UserSettingEntry::getUpdateDt));
list = list.subList(0, mSyncDataPartSize);
builder.clearEntry().addAllEntry(list);
}
return ec;
}
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>0.64</version>
<version>0.65</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -70,6 +70,11 @@ public interface APIPath {
String Get_System_Setting = "/admin/system/get_setting";
String Put_System_Setting = "/admin/system/put_setting";
String Conference_List = "/admin/conference/list";
String Conference_List_Participant = "/admin/conference/list_participant";
String Conference_Create = "/admin/conference/create";
String Conference_Destroy = "/admin/conference/destroy";
String Channel_User_Info = "/channel/user_info";
String Channel_Update_Profile = "/channel/update_profile";
String Channel_Get_Profile = "/channel/get_profile";
@@ -38,6 +38,7 @@ public enum ErrorCode {
ERROR_CODE_NOT_IN_CHANNEL(21, "not in channel"),
ERROR_CODE_NOT_LICENSED(22, "not licensed"),
ERROR_CODE_ALREADY_FRIENDS(23, "already friends"),
ERROR_CODE_RECALL_TIME_EXPIRED(24, "time expired"),
@@ -50,7 +51,7 @@ public enum ErrorCode {
ERROR_CODE_SIGN_EXPIRED(243, "sign expired"),
ERROR_CODE_AUTH_FAILURE(244, "auth failure"),
ERROR_CODE_CLIENT_COUNT_OUT_OF_LIMIT(245, "client count out of limit"),
ERROR_CODE_IN_BLACK_LIST(246, "user in balck list"),
ERROR_CODE_IN_BLACK_LIST(246, "user in black list"),
ERROR_CODE_FORBIDDEN_SEND_MSG(247, "forbidden send msg globally"),
ERROR_CODE_NOT_RIGHT(248, "no right to operate"),
ERROR_CODE_TIMEOUT(249, "timeout"),
@@ -0,0 +1,13 @@
package cn.wildfirechat.pojos;
public class ConferenceCreateEvent {
public String userId;
public String roomId;
public String serverId;
public String description;
public String pin;
public int max_publishers;
public int bitrate;
public boolean advance;
public boolean recording;
}
@@ -0,0 +1,6 @@
package cn.wildfirechat.pojos;
public class ConferenceDestroyEvent {
public String userId;
public String roomId;
}
@@ -0,0 +1,6 @@
package cn.wildfirechat.pojos;
public class ConferenceJoinEvent {
public String userId;
public String roomId;
}
@@ -0,0 +1,6 @@
package cn.wildfirechat.pojos;
public class ConferenceLeaveEvent {
public String userId;
public String roomId;
}
@@ -0,0 +1,7 @@
package cn.wildfirechat.pojos;
public class ConferencePublishEvent {
public String userId;
public boolean video;
public String roomId;
}
@@ -0,0 +1,6 @@
package cn.wildfirechat.pojos;
public class ConferenceUnpublishEvent {
public String userId;
public String roomId;
}
@@ -27,6 +27,8 @@ public class InputDismissGroup extends InputGroupBase {
}
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator))
return false;
return true;
}
@@ -35,6 +35,8 @@ public class InputKickoffGroupMember extends InputGroupBase {
}
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator) || members == null || members.isEmpty())
return false;
return true;
}
@@ -22,7 +22,9 @@ public class InputModifyGroupInfo extends InputGroupBase {
private String value;
public boolean isValide() {
return !StringUtil.isNullOrEmpty(group_id);
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator))
return false;
return true;
}
public String getGroup_id() {
return group_id;
@@ -10,6 +10,7 @@ package cn.wildfirechat.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.List;
@@ -25,6 +26,8 @@ public class InputQuitGroup extends InputGroupBase {
}
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator))
return false;
return true;
}
@@ -18,6 +18,8 @@ public class InputTransferGroup extends InputGroupBase {
public boolean isValide() {
if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator) || StringUtil.isNullOrEmpty(new_owner))
return false;
return true;
}
@@ -0,0 +1,21 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package cn.wildfirechat.pojos;
public class InputVerifyApplicationUser {
private String token;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
@@ -0,0 +1,21 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package cn.wildfirechat.pojos;
public class OutputVerifyApplicationUser {
private String userId;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
@@ -0,0 +1,11 @@
package cn.wildfirechat.pojos;
public class PojoConferenceCreate {
public String roomId;
public String description;
public String pin;
public int max_publishers;
public int bitrate;
public boolean advance;
public boolean recording;
}
@@ -0,0 +1,12 @@
package cn.wildfirechat.pojos;
public class PojoConferenceInfo {
public String roomId;
public String serverId;
public String description;
public int max_publishers;
public int num_publishers;
public int bitrate;
public boolean advance;
public boolean recording;
}
@@ -0,0 +1,21 @@
package cn.wildfirechat.pojos;
import java.util.ArrayList;
import java.util.List;
public class PojoConferenceInfoList {
public PojoConferenceInfoList(List<PojoConferenceInfo> conferenceInfoList) {
this.conferenceInfoList = conferenceInfoList;
}
public PojoConferenceInfoList() {
conferenceInfoList = new ArrayList<>();
}
public List<PojoConferenceInfo> conferenceInfoList;
public void addConferenceInfo(PojoConferenceInfo conferenceInfo) {
this.conferenceInfoList.add(conferenceInfo);
}
}
@@ -0,0 +1,6 @@
package cn.wildfirechat.pojos;
public class PojoConferenceParticipant {
public String userId;
public boolean publishing;
}
@@ -0,0 +1,21 @@
package cn.wildfirechat.pojos;
import java.util.ArrayList;
import java.util.List;
public class PojoConferenceParticipantList {
public PojoConferenceParticipantList(List<PojoConferenceParticipant> participantList) {
this.participantList = participantList;
}
public PojoConferenceParticipantList() {
participantList = new ArrayList<>();
}
public List<PojoConferenceParticipant> participantList;
public void addConferenceInfo(PojoConferenceParticipant participant) {
this.participantList.add(participant);
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<!--<relativePath>../pom.xml</relativePath>-->
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>0.64</version>
<version>0.65</version>
</parent>
<artifactId>distribution</artifactId>
@@ -130,6 +130,10 @@ group.visible_quit_or_kickoff_notification 0
## 注意,修改本配置不会对已经同步的信息产生影响。
#user.hide_properties 3,4
# 好友/好友请求/用户设置 这三类数据同步的最大条目数。之前是客户第一次登录时,会把所有的对应数据一次下载到客户端,但如果有特别多的信息,会导致无法同步到客户端,
# 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。
#sync.data_part_size 1000
#*********************************************************************
# hazelcase configuration
#*********************************************************************
+1 -1
View File
@@ -12,7 +12,7 @@
<artifactId>wildfirechat-parent</artifactId>
<packaging>pom</packaging>
<version>0.64</version>
<version>0.65</version>
<name>Wildfire Chat</name>
<description>Wildfire Chat Server</description>
<inceptionYear>2019</inceptionYear>
+2 -2
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>0.64</version>
<version>0.65</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -67,7 +67,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
<version>4.5.13</version>
</dependency>
<dependency>
@@ -0,0 +1,36 @@
package cn.wildfirechat.sdk;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.pojos.*;
import cn.wildfirechat.sdk.model.IMResult;
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
public class ConferenceAdmin {
public static IMResult<PojoConferenceInfoList> listConferences() throws Exception {
String path = APIPath.Conference_List;
return AdminHttpUtils.httpJsonPost(path, null, PojoConferenceInfoList.class);
}
public static IMResult<PojoConferenceParticipantList> listParticipants(String roomId) throws Exception {
String path = APIPath.Conference_List_Participant;
return AdminHttpUtils.httpJsonPost(path, roomId, PojoConferenceParticipantList.class);
}
public static IMResult<Void> createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording) throws Exception {
String path = APIPath.Conference_Create;
PojoConferenceCreate create = new PojoConferenceCreate();
create.roomId = roomId;
create.description = description;
create.pin = pin;
create.max_publishers = maxPublisher;
create.advance = advance;
create.bitrate = bitrate;
create.recording = recording;
return AdminHttpUtils.httpJsonPost(path, create, Void.class);
}
public static IMResult<Void> destroy(String roomId) throws Exception {
String path = APIPath.Conference_Destroy;
return AdminHttpUtils.httpJsonPost(path, roomId, Void.class);
}
}
@@ -43,9 +43,9 @@ public class Main {
testSensitiveApi();
if (commercialServer) {
testDevice();
testConference();
}
System.out.println("Congratulation, all admin test case passed!!!!!!!");
}
@@ -133,7 +133,6 @@ public class Main {
System.out.println("get user info by userId failure");
System.exit(-1);
}
InputOutputUserInfo updateUserInfo = new InputOutputUserInfo();
updateUserInfo.setUserId(System.currentTimeMillis()+"");
updateUserInfo.setDisplayName("updatedUserName");
@@ -1184,6 +1183,8 @@ public class Main {
ChannelServiceApi channelServiceApi = new ChannelServiceApi("http://localhost", resultCreateChannel.getResult().getTargetId(), secret);
if (commercialServer) {
//3. 测试channel api功能
IMResult<Void> resultVoid = channelServiceApi.subscribe("userId2");
if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
@@ -1200,6 +1201,7 @@ public class Main {
System.out.println("subscribe failure");
System.exit(-1);
}
IMResult<OutputStringList> resultStringList = channelServiceApi.getSubscriberList();
if (resultStringList != null && resultStringList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultStringList.getResult().getList().contains("userId2") && resultStringList.getResult().getList().contains("userId3")) {
System.out.println("get subscriber done");
@@ -1231,7 +1233,7 @@ public class Main {
System.out.println("get user info failure");
System.exit(-1);
}
}
MessagePayload payload = new MessagePayload();
@@ -1352,4 +1354,61 @@ public class Main {
System.exit(-1);
}
}
/*
会议相关接口,仅音视频高级版服务支持
*/
public static void testConference() throws Exception {
IMResult<PojoConferenceInfoList> listResult = ConferenceAdmin.listConferences();
if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("get conference list failure");
System.exit(-1);
} else {
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
}
for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) {
IMResult<Void> destroyResult = ConferenceAdmin.destroy(conferenceInfo.roomId);
if(destroyResult == null || destroyResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("destroy room failure");
System.exit(-1);
} else {
System.out.println("destroy room success");
}
}
listResult = ConferenceAdmin.listConferences();
if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("get conference list failure");
System.exit(-1);
} else {
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
}
IMResult<Void> createResult = ConferenceAdmin.createRoom("helloroomid", "hello room description", "123456", 20, false, 0, false);
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("create conference list failure");
System.exit(-1);
} else {
System.out.println("create conference");
}
listResult = ConferenceAdmin.listConferences();
if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("get conference list failure");
System.exit(-1);
} else {
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
}
for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) {
IMResult<PojoConferenceParticipantList> listParticipantsResult = ConferenceAdmin.listParticipants(conferenceInfo.roomId);
if(listParticipantsResult == null || listParticipantsResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("destroy room failure");
System.exit(-1);
} else {
System.out.println("destroy room success");
}
}
}
}