Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
f19303c1
Commit
f19303c1
authored
May 17, 2022
by
罗长华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加禁止发送图片的判断
parent
54743aa0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
26 deletions
+32
-26
config/src/main/resources/static/i18n/messages_zh_CN.properties
+2
-0
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
+26
-22
core/src/main/java/com/wecloud/im/param/ChatContentVo.java
+3
-3
framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java
+1
-1
No files found.
config/src/main/resources/static/i18n/messages_zh_CN.properties
View file @
f19303c1
...
@@ -79,3 +79,5 @@ api.response.code.REPETITION_CONVERSATION=已有会话,不能重复创建会话
...
@@ -79,3 +79,5 @@ api.response.code.REPETITION_CONVERSATION=已有会话,不能重复创建会话
api.response.code.CLIENT_NOT_FOUNT
=
成员不存在,不能创建会话
api.response.code.CLIENT_NOT_FOUNT
=
成员不存在,不能创建会话
api.response.code.IS_BE_BLACK
=
被对方拉黑
api.response.code.IS_BE_BLACK
=
被对方拉黑
api.response.code.IS_TO_BLACK
=
你把对方拉黑
api.response.code.IS_TO_BLACK
=
你把对方拉黑
api.response.code.IS_BE_FORBID_SEND_LINK
=
????????
api.response.code.IS_BE_FORBID_SEND_PIC
=
????????
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
View file @
f19303c1
...
@@ -144,7 +144,7 @@ public class NormalChatAction {
...
@@ -144,7 +144,7 @@ public class NormalChatAction {
return
;
return
;
}
}
// 消息内容校验
// 消息内容校验
if
(
checkMsg
(
conversation
,
reqId
,
data
,
request
.
getSenderChannel
()))
{
if
(
!
checkMsg
(
conversation
,
reqId
,
data
,
request
.
getSenderChannel
()))
{
return
;
return
;
}
}
...
@@ -415,30 +415,34 @@ public class NormalChatAction {
...
@@ -415,30 +415,34 @@ public class NormalChatAction {
return
false
;
return
false
;
}
}
}
}
// 判断是否开启禁止发送链接
if
(
MsgTypeEnum
.
MEDIA_TYPE_TEXT
.
getUriCode
()
==
data
.
getType
())
{
if
(
conversation
.
getForbidSendLink
())
{
// 判断是否开启禁止发送链接
String
regex
=
"((ht|f)tp(s?)\\:\\/\\/)?[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*."
+
if
(
conversation
.
getForbidSendLink
())
{
"(html|htm|shtml|jsp|asp|php|com|cn|net|com.cn|org|vip)+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,"
+
String
regex
=
"((ht|f)tp(s?)\\:\\/\\/)?[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*."
+
"\\'\\/\\\\&%\\+\\$#_=]*)?"
;
"(html|htm|shtml|jsp|asp|php|com|cn|net|com.cn|org|vip)+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,"
+
"\\'\\/\\\\&%\\+\\$#_=]*)?"
;
Pattern
pat
=
Pattern
.
compile
(
regex
);
Matcher
mat
=
pat
.
matcher
(
msgContent
.
trim
());
Pattern
pat
=
Pattern
.
compile
(
regex
);
result
=
mat
.
find
();
Matcher
mat
=
pat
.
matcher
(
msgContent
.
trim
());
}
result
=
mat
.
find
();
}
if
(
result
)
{
log
.
info
(
"群: {}, 已被禁止发送链接"
,
conversation
.
getName
());
// 响应发送方
WsResponse
<
HashMap
<
String
,
Long
>>
responseModel
=
new
WsResponse
<>();
ApiResult
<
Boolean
>
apiResult
=
ApiResult
.
result
(
ApiCode
.
IS_BE_FORBID_SEND_LINK
);
responseModel
.
setCmd
(
WsResponseCmdEnum
.
RES
.
getCmdCode
());
responseModel
.
setCode
(
apiResult
.
getCode
());
responseModel
.
setMsg
(
apiResult
.
getMessage
());
responseModel
.
setReqId
(
reqId
);
channelSender
.
sendMsgLocal
((
NioSocketChannel
)
channel
,
responseModel
);
return
false
;
}
if
(
result
)
{
log
.
info
(
"群: {}, 已被禁止发送链接"
,
conversation
.
getName
());
// 响应发送方
WsResponse
<
HashMap
<
String
,
Long
>>
responseModel
=
new
WsResponse
<>();
ApiResult
<
Boolean
>
apiResult
=
ApiResult
.
result
(
ApiCode
.
IS_BE_FORBID_SEND_LINK
);
responseModel
.
setCmd
(
WsResponseCmdEnum
.
RES
.
getCmdCode
());
responseModel
.
setCode
(
apiResult
.
getCode
());
responseModel
.
setMsg
(
apiResult
.
getMessage
());
responseModel
.
setReqId
(
reqId
);
channelSender
.
sendMsgLocal
((
NioSocketChannel
)
channel
,
responseModel
);
}
}
return
result
;
return
true
;
}
}
...
...
core/src/main/java/com/wecloud/im/param/ChatContentVo.java
View file @
f19303c1
package
com
.
wecloud
.
im
.
param
;
package
com
.
wecloud
.
im
.
param
;
import
javax.validation.constraints.NotNull
;
import
com.wecloud.dispatch.common.BaseRequest
;
import
com.wecloud.dispatch.common.BaseRequest
;
import
com.wecloud.im.ws.model.request.PushVO
;
import
com.wecloud.im.ws.model.request.PushVO
;
import
com.wecloud.utils.JsonUtils
;
import
com.wecloud.utils.JsonUtils
;
import
javax.validation.constraints.NotNull
;
/**
/**
* @Description 聊天内容
* @Description 聊天内容
* @Author lixiaozhong
* @Author lixiaozhong
...
@@ -70,7 +70,7 @@ public class ChatContentVo extends BaseRequest {
...
@@ -70,7 +70,7 @@ public class ChatContentVo extends BaseRequest {
}
}
public
String
getText
()
{
public
String
getText
()
{
return
this
.
get
(
"t
ype
"
)
+
""
;
return
this
.
get
(
"t
ext
"
)
+
""
;
}
}
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java
View file @
f19303c1
...
@@ -150,7 +150,7 @@ public enum ApiCode {
...
@@ -150,7 +150,7 @@ public enum ApiCode {
/**
/**
* 群已禁止发图片
* 群已禁止发图片
*/
*/
IS_BE_FORBID_SEND_PIC
(
6018
,
"api.response.code.IS_BE_FORBID_SEND_
LINK
"
),
IS_BE_FORBID_SEND_PIC
(
6018
,
"api.response.code.IS_BE_FORBID_SEND_
PIC
"
),
;
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment