Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e1ba9440e | ||
|
|
c284272b06 | ||
|
|
6746a54659 | ||
|
|
93be667e17 | ||
|
|
f11da6225d | ||
|
|
e28a4c6cbf | ||
|
|
fa8a2bef32 | ||
|
|
1c9d238734 | ||
|
|
2f7f4e6456 | ||
|
|
6e83ec85c7 | ||
|
|
cc561b846e | ||
|
|
4628b3b0b6 | ||
|
|
9c69fbc7d4 | ||
|
|
9047020d69 | ||
|
|
1c18d862a1 | ||
|
|
b0ddca985a | ||
|
|
996e06c451 | ||
|
|
612747203a | ||
|
|
f7853ae299 | ||
|
|
7443db3078 | ||
|
|
ad5f6cb228 |
@@ -39,6 +39,7 @@
|
||||
| [open-platform](https://github.com/wildfirechat/open-platform) | [open-platform](https://gitee.com/wfchat/open-platform) | 野火开放平台服务。 |
|
||||
| [daily-report](https://github.com/wildfirechat/daily-report) | [daily-report](https://github.com/wildfirechat/daily-report) | 野火开放平台日报 demo服务。 |
|
||||
| [channel-platform](https://github.com/wildfirechat/channel-platform) | [channel-platform](https://gitee.com/wfchat/channel-platform) | 野火频道(公众号)平台服务。 |
|
||||
| [organization-platform](https://github.com/wildfirechat/organization-platform) | [organization-platform](https://gitee.com/wfchat/organization-platform) | 野火组织通讯录服务。 |
|
||||
| [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/vue-pc-chat) | [pc-chat](https://gitee.com/wfchat/vue-pc-chat) | 基于[Electron](https://electronjs.org/)的PC 端,支持Windows、Mac、Linux(包括国产化linux系统和CPU)。 |
|
||||
@@ -46,7 +47,7 @@
|
||||
| [wx-chat](https://github.com/wildfirechat/wx-chat) | [wx-chat](https://gitee.com/wfchat/wx-chat) | 小程序平台的Demo(支持微信、百度、阿里、字节、QQ 等小程序平台)。 |
|
||||
| [uni-chat](https://github.com/wildfirechat/uni-chat) | [uni-chat](https://gitee.com/wfchat/uni-chat) | UniApp平台移动端应用(使用原生插件)。 |
|
||||
| [uni-wfc-client](https://github.com/wildfirechat/uni-wfc-client) | [uni-wfc-client](https://gitee.com/wfchat/uni-wfc-client) | UniApp平台原生插件。已[商店](https://ext.dcloud.net.cn/plugin?id=7895)上架 |
|
||||
| [flutter_imclient](https://github.com/wildfirechat/flutter_imclient) | [flutter_imclient](https://gitee.com/wfchat/flutter_imclient) | Flutter平台原生插件。 |
|
||||
| [wfc_flutter_plugins](https://github.com/wildfirechat/wfc_flutter_plugins) | [flutter_imclient](https://gitee.com/wfchat/wfc_flutter_plugins) | Flutter平台原生插件,支持IM和音视频通话。 |
|
||||
| [docs](https://github.com/wildfirechat/docs) | [docs](https://gitee.com/wfchat/docs) | 野火IM相关文档,包含设计、概念、开发、使用说明,[在线查看](https://docs.wildfirechat.cn/)。 |
|
||||
|
||||
## 野火开发文档
|
||||
|
||||
@@ -170,6 +170,10 @@ group.allow_robot_custom_operation_notification true
|
||||
## 0 不发送,1 退群时发送,2 踢人时发送,3 退群和踢人时都发送。
|
||||
group.visible_quit_or_kickoff_notification 0
|
||||
|
||||
## 禁止客户端群操作。第1位是禁止创建群组,第2位是禁止销毁群组,3位禁止加入群,4位禁止退出群,5位禁止邀请群成员,6位禁止移出群成员,7位禁止转移群,8位禁止设置群管理员,9位禁止白名单处理,10位禁止群禁言,11位禁止修改群组信息,12位禁止群成员禁言。
|
||||
## Server API不受此限制。
|
||||
#group.forbidden_client_operation 0xFFF
|
||||
|
||||
## 隐藏用户信息属性类型,2是性别,3是电话号码,4是邮箱,5是地址,6是公司信息,7是社交账号,8是Extra信息。当需要隐藏多个时以英文逗号分开;
|
||||
## 本配置是为了提高安全性,避免把对应信息同步到客户端,这样就能防止程序被破解从而拿到用户关键信息。仅对客户端有效,server api不受影响。
|
||||
## 注意,修改本配置不会对已经同步的信息产生影响。
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>0.99</version>
|
||||
<version>1.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>moquette-broker</artifactId>
|
||||
|
||||
@@ -90,6 +90,8 @@ public class FileAction extends Action {
|
||||
}
|
||||
|
||||
response.setContent(file);
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,6 +187,10 @@ public class UploadFileAction extends Action {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(remoteFileName != null && remoteFileName.length() > 2 && remoteFileName.startsWith("'") && remoteFileName.endsWith("'")) {
|
||||
remoteFileName = remoteFileName.substring(1, remoteFileName.length()-1);
|
||||
}
|
||||
|
||||
if (StringUtil.isNullOrEmpty(remoteFileName)) {
|
||||
logger.warn("remoteFileName is empty!");
|
||||
|
||||
@@ -235,7 +239,7 @@ public class UploadFileAction extends Action {
|
||||
int offset = 0; // 断点续传开始位置
|
||||
|
||||
Date nowTime=new Date();
|
||||
SimpleDateFormat time=new SimpleDateFormat("yyyy/MM/dd/HH");
|
||||
SimpleDateFormat time=new SimpleDateFormat("yyyy/MM/dd/HH/mm/ss");
|
||||
String datePath = time.format(nowTime);
|
||||
|
||||
datePath = "fs/" + bucket[0] + "/" + datePath; //add bucket
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 com.xiaoleilu.loServer.action.channel;
|
||||
|
||||
import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.pojos.InputChannelSubscribe;
|
||||
import cn.wildfirechat.pojos.InputUserId;
|
||||
import cn.wildfirechat.pojos.OutputStringList;
|
||||
import com.xiaoleilu.loServer.RestResult;
|
||||
import com.xiaoleilu.loServer.annotation.HttpMethod;
|
||||
import com.xiaoleilu.loServer.annotation.Route;
|
||||
import com.xiaoleilu.loServer.handler.Request;
|
||||
import com.xiaoleilu.loServer.handler.Response;
|
||||
import io.netty.handler.codec.http.FullHttpRequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Route(APIPath.Channel_Is_Subscriber)
|
||||
@HttpMethod("POST")
|
||||
public class GetIsChannelSubscriberAction extends ChannelAction {
|
||||
|
||||
@Override
|
||||
public boolean action(Request request, Response response) {
|
||||
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||
InputUserId input = getRequestBody(request.getNettyRequest(), InputUserId.class);
|
||||
boolean isSubscriber = messagesStore.checkUserInChannel(input.getUserId(), channelInfo.getTargetId());
|
||||
setResponseContent(RestResult.ok(isSubscriber), response);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.handler.codec.http.FullHttpRequest;
|
||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import win.liyufan.im.Utility;
|
||||
@@ -108,7 +109,7 @@ abstract public class ActionHandler extends SimpleChannelInboundHandler<FullHttp
|
||||
* @param response 响应对象
|
||||
*/
|
||||
private void doAction(ChannelHandlerContext ctx, Request request, Response response){
|
||||
if(("/route".equalsIgnoreCase(request.getPath()) || request.getPath().startsWith("/fs/"))
|
||||
if(("/route".equalsIgnoreCase(request.getPath()) || (!StringUtil.isNullOrEmpty(request.getPath()) && request.getPath().startsWith("/fs/")))
|
||||
&& "OPTIONS".equalsIgnoreCase(request.getMethod())){
|
||||
handleOptions(ctx, request, response);
|
||||
return;
|
||||
|
||||
@@ -171,6 +171,7 @@ public final class BrokerConstants {
|
||||
public static final String GROUP_Allow_Robot_Custom_Operation_Notification = "group.allow_robot_custom_operation_notificatio";
|
||||
|
||||
public static final String GROUP_Visible_Quit_Kickoff_Notification = "group.visible_quit_or_kickoff_notification";
|
||||
public static final String GROUP_Forbidden_Client_Operation = "group.forbidden_client_operation";
|
||||
|
||||
public static final String USER_HIDE_PROPERTIES = "user.hide_properties";
|
||||
public static final String USER_KEEP_DISPLAY_NAME_WHEN_DESTROY = "user.keep_display_name_when_destroy";
|
||||
|
||||
@@ -24,6 +24,20 @@ public class AddGroupMember extends GroupHandler<WFCMessage.AddGroupMemberReques
|
||||
@Override
|
||||
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.AddGroupMemberRequest request, Qos1PublishHandler.IMCallback callback) {
|
||||
boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin;
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if(request.getAddedMemberList().size() == 1 && request.getAddedMember(0).getMemberId().equals(fromUser)) {
|
||||
if ((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Join_Group) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
} else {
|
||||
if ((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Invite_Group_Member) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode errorCode = m_messagesStore.addGroupMembers(fromUser, isAdmin, request.getGroupId(), request.getAddedMemberList(), request.getExtra());
|
||||
if (errorCode == ERROR_CODE_SUCCESS) {
|
||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import win.liyufan.im.IMTopic;
|
||||
public class CreateGroupHandler extends GroupHandler<WFCMessage.CreateGroupRequest> {
|
||||
@Override
|
||||
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.CreateGroupRequest request, Qos1PublishHandler.IMCallback callback) {
|
||||
if(request.getGroup().getGroupInfo().getType() < 0 || request.getGroup().getGroupInfo().getType() > 2) {
|
||||
if(request.getGroup().getGroupInfo().getType() < 0 || request.getGroup().getGroupInfo().getType() > 3) {
|
||||
return ErrorCode.ERROR_CODE_INVALID_DATA;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ public class CreateGroupHandler extends GroupHandler<WFCMessage.CreateGroupReque
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Create_Group) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
WFCMessage.GroupInfo groupInfo = m_messagesStore.createGroup(fromUser, request.getGroup().getGroupInfo(), request.getGroup().getMembersList(), request.getMemberExtra(), isAdmin);
|
||||
if (groupInfo != null) {
|
||||
if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
|
||||
@@ -26,7 +26,6 @@ public class DismissGroupHandler extends GroupHandler<WFCMessage.DismissGroupReq
|
||||
ErrorCode errorCode;
|
||||
if (groupInfo == null) {
|
||||
errorCode = m_messagesStore.dismissGroup(fromUser, request.getGroupId(), isAdmin);
|
||||
|
||||
} else if (isAdmin || (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted)
|
||||
&& groupInfo.getOwner() != null && groupInfo.getOwner().equals(fromUser)) {
|
||||
|
||||
@@ -38,6 +37,13 @@ public class DismissGroupHandler extends GroupHandler<WFCMessage.DismissGroupReq
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Dismiss_Group) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
//send notify message first, then dismiss group
|
||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent());
|
||||
|
||||
@@ -62,6 +62,13 @@ public class KickoffGroupMember extends GroupHandler<WFCMessage.RemoveGroupMembe
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Kickoff_Group_Member) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
//send notify message first, then kickoff the member
|
||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent());
|
||||
|
||||
@@ -31,6 +31,19 @@ public class ModifyGroupInfoHandler extends GroupHandler<WFCMessage.ModifyGroupI
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if(request.getType() == Modify_Group_Mute) {
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Mute_Group) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
} else {
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Modify_Group_Info) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode errorCode= m_messagesStore.modifyGroupInfo(fromUser, request.getGroupId(), request.getType(), request.getValue(), isAdmin);
|
||||
if (errorCode == ERROR_CODE_SUCCESS) {
|
||||
if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
|
||||
@@ -31,6 +31,13 @@ public class QuitGroupHandler extends GroupHandler<WFCMessage.QuitGroupRequest>
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Quit_Group) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode errorCode = m_messagesStore.quitGroup(fromUser, request.getGroupId(), isAdmin);
|
||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
|
||||
@@ -182,6 +182,15 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group) {
|
||||
if(m_messagesStore.getGroupInfo(message.getConversation().getTarget()) == null) {
|
||||
return ErrorCode.ERROR_CODE_NOT_EXIST;
|
||||
}
|
||||
} else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) {
|
||||
WFCMessage.ChannelInfo channelData = m_messagesStore.getChannelInfo(message.getConversation().getTarget());
|
||||
if(channelData == null || channelData.getStatus() == ProtoConstants.ChannelState.Channel_State_Mask_Deleted) {
|
||||
return ErrorCode.ERROR_CODE_NOT_EXIST;
|
||||
}
|
||||
}
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
|
||||
@@ -30,6 +30,13 @@ public class SetGroupManagerHandler extends GroupHandler<WFCMessage.SetGroupMana
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Set_Group_Manage) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode errorCode = m_messagesStore.setGroupManager(fromUser, request.getGroupId(), request.getType(), request.getUserIdList(), isAdmin);
|
||||
if (errorCode == ERROR_CODE_SUCCESS) {
|
||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
|
||||
@@ -30,6 +30,13 @@ public class TransferGroupHandler extends GroupHandler<WFCMessage.TransferGroupR
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
|
||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||
int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation();
|
||||
if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Transfer_Group) > 0) {
|
||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
ErrorCode errorCode = m_messagesStore.transferGroup(fromUser, request.getGroupId(), request.getNewOwner(), isAdmin);
|
||||
if (errorCode == ERROR_CODE_SUCCESS) {
|
||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||
|
||||
@@ -25,9 +25,11 @@ public class UploadDeviceTokenHandler extends IMHandler<WFCMessage.UploadDeviceT
|
||||
session.setPlatform(request.getPlatform());
|
||||
session.setAppName(request.getAppName());
|
||||
if (request.getPlatform() == ProtoConstants.Platform.Platform_iOS && request.getPushType() == 2) {
|
||||
LOG.info("Set device token, userId {}", fromUser);
|
||||
session.setVoipDeviceToken(request.getDeviceToken());
|
||||
m_sessionsStore.updateSessionToken(session, true);
|
||||
} else {
|
||||
LOG.info("Set device token, userId {}, platform {}, pushType {}", fromUser, session.getPlatform(), request.getPushType());
|
||||
session.setDeviceToken(request.getDeviceToken());
|
||||
session.setPushType(request.getPushType());
|
||||
m_sessionsStore.updateSessionToken(session, false);
|
||||
|
||||
@@ -1493,12 +1493,6 @@ public class DatabaseStore {
|
||||
if (!strEqual(session.getAppName(), request.getApp())) {
|
||||
sql += " `_package_name` = ?,";
|
||||
}
|
||||
if (session.getPlatform() != request.getPlatform()) {
|
||||
sql += " `_platform` = ?,";
|
||||
}
|
||||
if (session.getPushType() != request.getPushType()) {
|
||||
sql += " `_push_type` = ?,";
|
||||
}
|
||||
if (!strEqual(session.getDeviceName(), request.getDeviceName())) {
|
||||
sql += " `_device_name` = ?,";
|
||||
}
|
||||
@@ -1526,12 +1520,6 @@ public class DatabaseStore {
|
||||
if (!strEqual(session.getAppName(), request.getApp())) {
|
||||
statement.setString(index++, request.getApp());
|
||||
}
|
||||
if (session.getPlatform() != request.getPlatform()) {
|
||||
statement.setInt(index++, request.getPlatform());
|
||||
}
|
||||
if (session.getPushType() != request.getPushType()) {
|
||||
statement.setInt(index++, request.getPushType() >= 32 ? 0 : request.getPushType());
|
||||
}
|
||||
if (!strEqual(session.getDeviceName(), request.getDeviceName())) {
|
||||
statement.setString(index++, request.getDeviceName());
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
private boolean mGroupAllowClientCustomOperationNotification;
|
||||
private boolean mGroupAllowRobotCustomOperationNotification;
|
||||
private int mGroupVisibleQuitKickoffNotification;
|
||||
private int mGroupForbiddenClientOperation;
|
||||
private int mSyncDataPartSize = 0;
|
||||
private boolean keepDisplayNameWhenDestroyUser = true;
|
||||
|
||||
@@ -460,6 +461,35 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
String s = server.getConfig().getProperty(GROUP_Forbidden_Client_Operation, null);
|
||||
if(!StringUtil.isNullOrEmptyAfterTrim(s)) {
|
||||
s = s.toLowerCase();
|
||||
if(s.startsWith("0x")) {
|
||||
s = s.substring(2);
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(s.length()-1-i);
|
||||
mGroupForbiddenClientOperation <<= 4;
|
||||
if(ch <= 9) {
|
||||
mGroupForbiddenClientOperation += ch;
|
||||
} else {
|
||||
if(ch > 'f' || ch < 'a') {
|
||||
mGroupForbiddenClientOperation = 0;
|
||||
LOG.error("Invalid group.forbidden_client_operation {}", server.getConfig().getProperty(GROUP_Forbidden_Client_Operation, null));
|
||||
break;
|
||||
} else {
|
||||
mGroupForbiddenClientOperation += (ch - 'a' + 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mGroupForbiddenClientOperation = Integer.parseInt(s);
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
LOG.error("Invalid group.forbidden_client_operation {}", server.getConfig().getProperty(GROUP_Forbidden_Client_Operation, null));
|
||||
}
|
||||
|
||||
try {
|
||||
mSyncDataPartSize = Integer.parseInt(server.getConfig().getProperty(SYNC_Data_Part_Size, "0"));
|
||||
} catch (Exception e) {
|
||||
@@ -4214,6 +4244,11 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
return mGroupVisibleQuitKickoffNotification;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupForbiddenClientOperation() {
|
||||
return mGroupForbiddenClientOperation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForwardMessageWithClientInfo() {
|
||||
return mForwardMessageWithClientInfo;
|
||||
|
||||
@@ -233,6 +233,8 @@ public interface IMessagesStore {
|
||||
boolean isAllowRobotCustomGroupNotification();
|
||||
int getVisibleQuitKickoffNotification();
|
||||
|
||||
int getGroupForbiddenClientOperation();
|
||||
|
||||
boolean isForwardMessageWithClientInfo();
|
||||
boolean isRobotCallbackWithClientInfo();
|
||||
boolean isChannelCallbackWithClientInfo();
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
<RollingRandomAccessFile name="RollingFileInfo" immediateFlush="false"
|
||||
fileName="${MSG_LOG_HOME}/wildfirechat.log"
|
||||
filePattern="${MSG_LOG_HOME}/backup/wildfirechat.%d{yyyyMMddHH}.zip">
|
||||
filePattern="${MSG_LOG_HOME}/backup/wildfirechat.%d{yyyyMMddHHmm}.zip">
|
||||
<Filters>
|
||||
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
</Filters>
|
||||
<PatternLayout pattern="${pattern}" />
|
||||
<Policies>
|
||||
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||
<!-- <TimeBasedTriggeringPolicy interval="6" modulate="true"/>-->
|
||||
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
|
||||
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>0.99</version>
|
||||
<version>1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ public interface APIPath {
|
||||
String Conference_Create = "/admin/conference/create";
|
||||
String Conference_Destroy = "/admin/conference/destroy";
|
||||
String Conference_Recording = "/admin/conference/recording";
|
||||
String Conference_Rtp_Forward = "/admin/conference/rtp_forward";
|
||||
String Conference_Stop_Rtp_Forward = "/admin/conference/stop_rtp_forward";
|
||||
String Conference_List_Rtp_Forward = "/admin/conference/list_rtp_forward";
|
||||
|
||||
String Channel_User_Info = "/channel/user_info";
|
||||
String Channel_Update_Profile = "/channel/update_profile";
|
||||
@@ -101,6 +104,7 @@ public interface APIPath {
|
||||
String Channel_Message_Send = "/channel/message/send";
|
||||
String Channel_Subscribe = "/channel/subscribe";
|
||||
String Channel_Subscriber_List = "/channel/subscriber_list";
|
||||
String Channel_Is_Subscriber = "/channel/is_subscriber";
|
||||
String Channel_Application_Get_UserInfo = "/channel/application/get_user_info";
|
||||
|
||||
String Robot_User_Info = "/robot/user_info";
|
||||
|
||||
@@ -61,6 +61,8 @@ public enum ErrorCode {
|
||||
ERROR_CODE_SECRET_CHAT_MO_DISABLED(86, "origin side disable secret chat"),
|
||||
ERROR_CODE_SECRET_CHAT_MT_DISABLED(87, "target side disable secret chat"),
|
||||
|
||||
ERROR_CODE_CONFERENCE_ERROR(90, "Conference server response error"),
|
||||
|
||||
ERROR_CODE_FUNCTION_DISABLED(220, "function disabled"),
|
||||
|
||||
ERROR_CODE_CHANNEL_NO_EXIST(236, "channel no exist"),
|
||||
|
||||
@@ -3,5 +3,7 @@ package cn.wildfirechat.pojos;
|
||||
public class ConferenceLeaveEvent {
|
||||
public String userId;
|
||||
public String roomId;
|
||||
public boolean rejoin;
|
||||
public boolean kicked;
|
||||
public boolean screenSharing;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
package cn.wildfirechat.pojos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PojoConferenceParticipant {
|
||||
public static class Stream {
|
||||
public String type;
|
||||
public String mid;
|
||||
public String codec;
|
||||
}
|
||||
|
||||
public String userId;
|
||||
public boolean publishing;
|
||||
public List<Stream> streams;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.wildfirechat.pojos;
|
||||
|
||||
public class PojoConferenceRtpForwardReq {
|
||||
public String roomId;
|
||||
public String publisherId;
|
||||
public String host;
|
||||
public int audioPort;
|
||||
public int audioPt;
|
||||
public long audioSSRC;
|
||||
public int videoPort;
|
||||
public int videoPt;
|
||||
public long videoSSRC;
|
||||
|
||||
public PojoConferenceRtpForwardReq() {
|
||||
}
|
||||
|
||||
public PojoConferenceRtpForwardReq(String roomId, String publisherId, String host, int audioPort, int audioPt, long audioSSRC, int videoPort, int videoPt, long videoSSRC) {
|
||||
this.roomId = roomId;
|
||||
this.publisherId = publisherId;
|
||||
this.host = host;
|
||||
this.audioPort = audioPort;
|
||||
this.audioPt = audioPt;
|
||||
this.audioSSRC = audioSSRC;
|
||||
this.videoPort = videoPort;
|
||||
this.videoPt = videoPt;
|
||||
this.videoSSRC = videoSSRC;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.wildfirechat.pojos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PojoConferenceRtpForwarders {
|
||||
public static class RtpForwarder {
|
||||
public static class RtpStream {
|
||||
public long streamId;
|
||||
public String type;
|
||||
public String host;
|
||||
public int port;
|
||||
public long ssrc;
|
||||
public int pt;
|
||||
}
|
||||
|
||||
public String publisherId;
|
||||
public List<RtpStream> streams;
|
||||
}
|
||||
public String roomId;
|
||||
public List<RtpForwarder> forwarders;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.wildfirechat.pojos;
|
||||
|
||||
public class PojoConferenceStopRtpForwardReq {
|
||||
public String roomId;
|
||||
public String publisherId;
|
||||
public long streamId;
|
||||
|
||||
public PojoConferenceStopRtpForwardReq() {
|
||||
}
|
||||
|
||||
public PojoConferenceStopRtpForwardReq(String roomId, String publisherId, long streamId) {
|
||||
this.roomId = roomId;
|
||||
this.publisherId = publisherId;
|
||||
this.streamId = streamId;
|
||||
}
|
||||
}
|
||||
@@ -292,6 +292,34 @@ public class ProtoConstants {
|
||||
int ApplicationType_Admin = 2;
|
||||
}
|
||||
|
||||
//禁止客户端群操作。
|
||||
// 第1位是禁止创建群组,
|
||||
// 第2位是禁止销毁群组,
|
||||
// 3位禁止加入群,
|
||||
// 4位禁止退出群,
|
||||
// 5位禁止邀请群成员,
|
||||
// 6位禁止移出群成员,
|
||||
// 7位禁止转移群
|
||||
// 8位禁止设置群管理员
|
||||
// 9位禁止允许群成员(专业版支持),
|
||||
// 10位禁止群禁言
|
||||
// 11位禁止修改群组信息,
|
||||
// 12位禁止群成员禁言(专业版支持)
|
||||
public interface ForbiddenClientGroupOperationMask {
|
||||
int Forbidden_Create_Group = 0x01;
|
||||
int Forbidden_Dismiss_Group = 0x02;
|
||||
int Forbidden_Join_Group = 0x04;
|
||||
int Forbidden_Quit_Group = 0x08;
|
||||
int Forbidden_Invite_Group_Member = 0x10;
|
||||
int Forbidden_Kickoff_Group_Member = 0x20;
|
||||
int Forbidden_Transfer_Group = 0x40;
|
||||
int Forbidden_Set_Group_Manage = 0x80;
|
||||
int Forbidden_Allow_Group_Member = 0x100;
|
||||
int Forbidden_Mute_Group = 0x200;
|
||||
int Forbidden_Modify_Group_Info = 0x400;
|
||||
int Forbidden_Mute_Group_Member = 0x800;
|
||||
}
|
||||
|
||||
public static final int MESSAGE_CONTENT_TYPE_CREATE_GROUP = 104;
|
||||
public static final int MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER = 105;
|
||||
public static final int MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER = 106;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!--<relativePath>../pom.xml</relativePath>-->
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>0.99</version>
|
||||
<version>1.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>distribution</artifactId>
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
<fileMode>0755</fileMode>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/scripts/stop.sh</source>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<fileMode>0755</fileMode>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>src/main/scripts/wildfirechat.bat</source>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
<RollingRandomAccessFile name="RollingFileInfo" immediateFlush="false"
|
||||
fileName="${MSG_LOG_HOME}/wildfirechat.log"
|
||||
filePattern="${MSG_LOG_HOME}/backup/wildfirechat.%d{yyyyMMddHH}.zip">
|
||||
filePattern="${MSG_LOG_HOME}/backup/wildfirechat.%d{yyyyMMddHHmm}.zip">
|
||||
<Filters>
|
||||
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
</Filters>
|
||||
<PatternLayout pattern="${pattern}" />
|
||||
<Policies>
|
||||
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||
<!-- <TimeBasedTriggeringPolicy interval="6" modulate="true"/>-->
|
||||
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
|
||||
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
|
||||
@@ -32,6 +32,7 @@ local_port 80
|
||||
## 是否使用内置DB。0使用mysql;1使用h2db。
|
||||
## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改
|
||||
## 如果使用MySQL,请在c3p0.xml文件中配置JDBC信息。
|
||||
## 如果是MySQL5.7,需要开启长索引的支持,在数据库中执行命令:"set global innodb_large_prefix=on;"。其他版本默认支持,不用修改。
|
||||
embed.db 1
|
||||
|
||||
## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。
|
||||
@@ -168,6 +169,10 @@ group.allow_robot_custom_operation_notification true
|
||||
## 如果应用需要退群或者踢人不通知普通成员,请设置此参数为3,然后修改客户端踢人或退群消息的flag为not_presist。
|
||||
group.visible_quit_or_kickoff_notification 0
|
||||
|
||||
## 禁止客户端群操作。第1位是禁止创建群组,第2位是禁止销毁群组,3位禁止加入群,4位禁止退出群,5位禁止邀请群成员,6位禁止移出群成员,7位禁止转移群,8位禁止设置群管理员,9位禁止白名单处理,10位禁止群禁言,11位禁止修改群组信息,12位禁止群成员禁言。
|
||||
## 如果有客户端有被破解的风险,可以禁止客户端群操作,然后通过Server API操作。Server API不受限制。
|
||||
#group.forbidden_client_operation 0xFFF
|
||||
|
||||
## 隐藏用户信息属性类型,2是性别,3是电话号码,4是邮箱,5是地址,6是公司信息,7是社交账号,8是Extra信息。当需要隐藏多个时以英文逗号分开;
|
||||
## 本配置是为了提高安全性,避免把对应信息同步到客户端,这样就能防止程序被破解从而拿到用户关键信息。仅对客户端有效,server api不受影响。
|
||||
## 注意,修改本配置不会对已经同步的信息产生影响。
|
||||
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
pid=`ps -ef | grep wildfirechat.server.Server | grep -v grep | awk '{print $2}'`
|
||||
|
||||
if [ -z $pid ]; then
|
||||
echo "野火IM服务不存在"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
kill -15 $pid
|
||||
|
||||
for i in {1..15}
|
||||
do
|
||||
pid=`ps -ef | grep wildfirechat.server.Server | grep -v grep | awk '{print $2}'`
|
||||
if [ -z $pid ]; then
|
||||
echo "野火IM服务已结束"
|
||||
exit 0
|
||||
else
|
||||
echo "正在结束中,请等待..."
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "正常结束失败,强制结束!"
|
||||
kill -9 $pid
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<version>0.99</version>
|
||||
<version>1.1</version>
|
||||
<name>Wildfire Chat</name>
|
||||
<description>Wildfire Chat Server</description>
|
||||
<inceptionYear>2019</inceptionYear>
|
||||
|
||||
@@ -12,6 +12,24 @@
|
||||
|
||||
# 更新记录
|
||||
|
||||
--------------
|
||||
Release note 1.1:
|
||||
1. Channel API添加检查用户是否订阅接口
|
||||
2. Server API发送消息时添加检查对象是否存在
|
||||
3. Channel API添加修改频道菜单接口
|
||||
4. 内置对象存储的优化
|
||||
|
||||
--------------
|
||||
Release note 1.0:
|
||||
1. SDK检查工具添加help命令
|
||||
2. 去掉短连接端口被网络爬虫扫描输出的异常日志
|
||||
3. API支持创建组织群
|
||||
4. 添加配置禁止客户端进行某些群操作
|
||||
5. 解决route请求时可能不能正确携带推送类型的问题
|
||||
6. 会议成员离开加上离开原因
|
||||
7. 添加停止程序的命令
|
||||
8. 添加RTP Forward的API
|
||||
|
||||
--------------
|
||||
Release note 0.99:
|
||||
1. API获取用户信息时,过滤掉已经删除用户。
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>0.99</version>
|
||||
<version>1.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -2,14 +2,15 @@ package cn.wildfirechat.sdk;
|
||||
|
||||
import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
import cn.wildfirechat.proto.ProtoConstants;
|
||||
import cn.wildfirechat.sdk.model.IMResult;
|
||||
import cn.wildfirechat.sdk.utilities.ChannelHttpUtils;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.wildfirechat.proto.ProtoConstants.ApplicationType.ApplicationType_Channel;
|
||||
import static cn.wildfirechat.proto.ProtoConstants.ApplicationType.ApplicationType_Robot;
|
||||
|
||||
//仅专业版支持,社区版不支持
|
||||
public class ChannelServiceApi {
|
||||
@@ -50,6 +51,11 @@ public class ChannelServiceApi {
|
||||
return channelHttpUtils.httpJsonPost(path, null, OutputGetChannelInfo.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> modifyChannelMenu(List<OutputGetChannelInfo.OutputMenu> menus) throws Exception {
|
||||
String menuStr = new Gson().toJson(menus);
|
||||
return modifyChannelInfo(ProtoConstants.ModifyChannelInfoType.Modify_Channel_Menu, menuStr);
|
||||
}
|
||||
|
||||
public IMResult<SendMessageResult> sendMessage(int line, List<String> targets, MessagePayload payload) throws Exception {
|
||||
String path = APIPath.Channel_Message_Send;
|
||||
SendChannelMessageData messageData = new SendChannelMessageData();
|
||||
@@ -80,6 +86,12 @@ public class ChannelServiceApi {
|
||||
return channelHttpUtils.httpJsonPost(path, null, OutputStringList.class);
|
||||
}
|
||||
|
||||
public IMResult<Boolean> isSubscriber(String userId) throws Exception {
|
||||
String path = APIPath.Channel_Is_Subscriber;
|
||||
InputUserId input = new InputUserId(userId);
|
||||
return channelHttpUtils.httpJsonPost(path, input, Boolean.class);
|
||||
}
|
||||
|
||||
public IMResult<OutputApplicationUserInfo> applicationGetUserInfo(String authCode) throws Exception {
|
||||
String path = APIPath.Channel_Application_Get_UserInfo;
|
||||
InputApplicationGetUserInfo input = new InputApplicationGetUserInfo();
|
||||
|
||||
@@ -45,4 +45,23 @@ public class ConferenceAdmin {
|
||||
PojoConferenceRoomId conferenceRoomId = new PojoConferenceRoomId(roomId, advance);
|
||||
return AdminHttpUtils.httpJsonPost(path, conferenceRoomId, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> rtpForward(String roomId, String userId, String rtpHost, int audioPort, int audioPt, long audioSSRC, int videoPort, int videoPt, long videoSSRC) throws Exception {
|
||||
String path = APIPath.Conference_Rtp_Forward;
|
||||
PojoConferenceRtpForwardReq req = new PojoConferenceRtpForwardReq(roomId, userId, rtpHost, audioPort, audioPt, audioSSRC, videoPort, videoPt, videoSSRC);
|
||||
return AdminHttpUtils.httpJsonPost(path, req, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> stopRtpForward(String roomId, String userId, long streamId) throws Exception {
|
||||
String path = APIPath.Conference_Stop_Rtp_Forward;
|
||||
PojoConferenceStopRtpForwardReq req = new PojoConferenceStopRtpForwardReq(roomId, userId, streamId);
|
||||
return AdminHttpUtils.httpJsonPost(path, req, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<PojoConferenceRtpForwarders> listRtpForwarders(String roomId) throws Exception {
|
||||
String path = APIPath.Conference_List_Rtp_Forward;
|
||||
PojoConferenceRoomId req = new PojoConferenceRoomId();
|
||||
req.roomId = roomId;
|
||||
return AdminHttpUtils.httpJsonPost(path, req, PojoConferenceRtpForwarders.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ public class Main {
|
||||
commercialServer = Boolean.parseBoolean(args[3]);
|
||||
advanceVoip = Boolean.parseBoolean(args[4]);
|
||||
} else {
|
||||
if(args.length == 1 && (args[0].equals("-h") || args[0].equals("--help") || args[0].equals("-help"))) {
|
||||
System.out.println("Usage: java -jar checker.jar adminUrl adminSecret imUrl commercialServer advanceVoip \n e.g. java -jar checker.jar http://192.168.1.80:18080 123456 http://192.168.1.80 false false");
|
||||
return;
|
||||
}
|
||||
System.out.println("Usage: java -jar checker.jar adminUrl adminSecret imUrl commercialServer advanceVoip \n e.g. java -jar checker.jar http://192.168.1.80:18080 123456 http://192.168.1.80 false false");
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
@@ -46,10 +50,10 @@ public class Main {
|
||||
|
||||
|
||||
//admin使用的是18080端口,超级管理接口,理论上不能对外开放端口,也不能让非内部服务知悉密钥。
|
||||
testAdmin();
|
||||
// testAdmin();
|
||||
|
||||
//Robot和Channel都是使用的80端口,第三方可以创建或者为第三方创建,第三方可以使用robot或者channel与IM系统进行对接。
|
||||
testRobot();
|
||||
// testRobot();
|
||||
testChannel();
|
||||
}
|
||||
|
||||
@@ -1439,6 +1443,14 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Boolean> booleanIMResult = channelServiceApi.isSubscriber("userId2");
|
||||
if(booleanIMResult != null && booleanIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && booleanIMResult.getResult()) {
|
||||
System.out.println("is subscriber success");
|
||||
} else {
|
||||
System.out.println("is subscriber failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
resultVoid = channelServiceApi.unsubscribe("userId2");
|
||||
if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("unsubscriber done");
|
||||
@@ -1704,5 +1716,31 @@ public class Main {
|
||||
System.out.println("list participants success");
|
||||
}
|
||||
}
|
||||
|
||||
IMResult<PojoConferenceRtpForwarders> listForwarderResult = ConferenceAdmin.listRtpForwarders("6366963312");
|
||||
if(listForwarderResult == null || listForwarderResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("list rtp forward failure");
|
||||
} else {
|
||||
System.out.println("list rtp forward success");
|
||||
listForwarderResult.getResult().forwarders.forEach(rtpForwarder -> rtpForwarder.streams.forEach(rtpStream -> {
|
||||
try {
|
||||
IMResult<Void> stopRtpForwardResult = ConferenceAdmin.stopRtpForward(listForwarderResult.getResult().roomId, rtpForwarder.publisherId, rtpStream.streamId);
|
||||
if(stopRtpForwardResult == null || stopRtpForwardResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("rtp forward stop failure");
|
||||
} else {
|
||||
System.out.println("rtp forward stop success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
IMResult<Void> rtpForwardResult = ConferenceAdmin.rtpForward("6366963312", "cygqmws2k", "192.168.1.81", 10000, 111, 0, 10005, 98, 0);
|
||||
if(rtpForwardResult == null || rtpForwardResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("rtp forward failure");
|
||||
} else {
|
||||
System.out.println("rtp forward success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class AdminHttpUtils extends JsonUtils {
|
||||
if (object != null) {
|
||||
jsonStr = gson.toJson(object);
|
||||
}
|
||||
LOG.info("http request content: {}", jsonStr);
|
||||
LOG.info("http request:{} content: {}", path, jsonStr);
|
||||
|
||||
StringEntity entity = new StringEntity(jsonStr, Charset.forName("UTF-8"));
|
||||
entity.setContentEncoding("UTF-8");
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ChannelHttpUtils extends JsonUtils {
|
||||
if (object != null) {
|
||||
jsonStr = gson.toJson(object);
|
||||
}
|
||||
LOG.info("http request content: {}", jsonStr);
|
||||
LOG.info("http request:{} content: {}", path, jsonStr);
|
||||
|
||||
StringEntity entity = new StringEntity(jsonStr, Charset.forName("UTF-8"));
|
||||
entity.setContentEncoding("UTF-8");
|
||||
|
||||
@@ -79,7 +79,7 @@ public class RobotHttpUtils extends JsonUtils {
|
||||
if (object != null) {
|
||||
jsonStr = gson.toJson(object);
|
||||
}
|
||||
LOG.info("http request content: {}", jsonStr);
|
||||
LOG.info("http request:{} content: {}", path, jsonStr);
|
||||
|
||||
if(!StringUtil.isNullOrEmpty(jsonStr)) {
|
||||
StringEntity entity = new StringEntity(jsonStr, Charset.forName("UTF-8"));
|
||||
|
||||
Reference in New Issue
Block a user