Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
srvpro
Commits
3a6ea03a
Commit
3a6ea03a
authored
Jul 14, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add reject bad name
parent
b63e9aa6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
10 deletions
+52
-10
ygopro-server.coffee
ygopro-server.coffee
+26
-5
ygopro-server.js
ygopro-server.js
+26
-5
No files found.
ygopro-server.coffee
View file @
3a6ea03a
...
...
@@ -941,13 +941,34 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else
if
_
.
indexOf
(
settings
.
ban
.
banned_user
,
client
.
name
)
>
-
1
#账号被封
settings
.
ban
.
banned_ip
.
push
(
client
.
remoteAddress
)
log
.
info
(
"BANNED USER LOGIN"
,
client
.
name
,
client
.
remoteAddress
)
log
.
warn
(
"BANNED USER LOGIN"
,
client
.
name
,
client
.
remoteAddress
)
ygopro
.
stoc_die
(
client
,
"您的账号已被封禁"
)
else
if
_
.
indexOf
(
settings
.
ban
.
banned_ip
,
client
.
remoteAddress
)
>
-
1
#IP被封
log
.
info
(
"BANNED IP LOGIN"
,
client
.
name
,
client
.
remoteAddress
)
log
.
warn
(
"BANNED IP LOGIN"
,
client
.
name
,
client
.
remoteAddress
)
ygopro
.
stoc_die
(
client
,
"您的账号已被封禁"
)
else
if
_
.
any
(
settings
.
ban
.
badword_level3
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
)
return
name
.
match
(
regexp
)
,
name
=
client
.
name
)
log
.
warn
(
"BAD NAME LEVEL 3"
,
client
.
name
,
client
.
remoteAddress
)
ygopro
.
stoc_die
(
client
,
"您的用户名存在不适当的内容"
)
else
if
_
.
any
(
settings
.
ban
.
badword_level2
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
)
return
name
.
match
(
regexp
)
,
name
=
client
.
name
)
log
.
warn
(
"BAD NAME LEVEL 2"
,
client
.
name
,
client
.
remoteAddress
)
ygopro
.
stoc_die
(
client
,
"您的用户名存在不适当的内容"
)
else
if
_
.
any
(
settings
.
ban
.
badword_level1
,
(
badword
)
->
regexp
=
new
RegExp
(
badword
)
return
name
.
match
(
regexp
)
,
name
=
client
.
name
)
log
.
warn
(
"BAD NAME LEVEL 1"
,
client
.
name
,
client
.
remoteAddress
)
ygopro
.
stoc_die
(
client
,
"您的用户名存在不适当的内容,请注意更改"
)
else
if
info
.
version
==
4921
#YGOMobile不更新,强行兼容
info
.
version
=
settings
.
version
...
...
@@ -1262,7 +1283,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
regexp
=
new
RegExp
(
badword
)
return
msg
.
match
(
regexp
)
,
msg
))
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
oldmsg
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,禁止您使用随机对战功能!"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
,
3
)
...
...
@@ -1272,7 +1293,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
regexp
=
new
RegExp
(
badword
)
return
msg
.
match
(
regexp
)
,
msg
))
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
oldmsg
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"您的发言存在不适当的内容,已被屏蔽,并记录一次违规!"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"发言违规"
)
cancel
=
true
...
...
@@ -1284,7 +1305,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
return
,
msg
)
if
oldmsg
!=
msg
log
.
warn
"BAD WORD LEVEL 1"
,
client
.
name
,
oldmsg
log
.
warn
"BAD WORD LEVEL 1"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
ygopro
.
stoc_send_chat
(
client
,
"请使用文明用语"
)
struct
=
ygopro
.
structs
[
"chat"
]
struct
.
_setBuff
(
buffer
)
...
...
ygopro-server.js
View file @
3a6ea03a
...
...
@@ -1156,11 +1156,32 @@
ygopro
.
stoc_die
(
client
,
"
房间密码不正确
"
);
}
else
if
(
_
.
indexOf
(
settings
.
ban
.
banned_user
,
client
.
name
)
>
-
1
)
{
settings
.
ban
.
banned_ip
.
push
(
client
.
remoteAddress
);
log
.
info
(
"
BANNED USER LOGIN
"
,
client
.
name
,
client
.
remoteAddress
);
log
.
warn
(
"
BANNED USER LOGIN
"
,
client
.
name
,
client
.
remoteAddress
);
ygopro
.
stoc_die
(
client
,
"
您的账号已被封禁
"
);
}
else
if
(
_
.
indexOf
(
settings
.
ban
.
banned_ip
,
client
.
remoteAddress
)
>
-
1
)
{
log
.
info
(
"
BANNED IP LOGIN
"
,
client
.
name
,
client
.
remoteAddress
);
log
.
warn
(
"
BANNED IP LOGIN
"
,
client
.
name
,
client
.
remoteAddress
);
ygopro
.
stoc_die
(
client
,
"
您的账号已被封禁
"
);
}
else
if
(
_
.
any
(
settings
.
ban
.
badword_level3
,
function
(
badword
)
{
var
regexp
;
regexp
=
new
RegExp
(
badword
);
return
name
.
match
(
regexp
);
},
name
=
client
.
name
))
{
log
.
warn
(
"
BAD NAME LEVEL 3
"
,
client
.
name
,
client
.
remoteAddress
);
ygopro
.
stoc_die
(
client
,
"
您的用户名存在不适当的内容
"
);
}
else
if
(
_
.
any
(
settings
.
ban
.
badword_level2
,
function
(
badword
)
{
var
regexp
;
regexp
=
new
RegExp
(
badword
);
return
name
.
match
(
regexp
);
},
name
=
client
.
name
))
{
log
.
warn
(
"
BAD NAME LEVEL 2
"
,
client
.
name
,
client
.
remoteAddress
);
ygopro
.
stoc_die
(
client
,
"
您的用户名存在不适当的内容
"
);
}
else
if
(
_
.
any
(
settings
.
ban
.
badword_level1
,
function
(
badword
)
{
var
regexp
;
regexp
=
new
RegExp
(
badword
);
return
name
.
match
(
regexp
);
},
name
=
client
.
name
))
{
log
.
warn
(
"
BAD NAME LEVEL 1
"
,
client
.
name
,
client
.
remoteAddress
);
ygopro
.
stoc_die
(
client
,
"
您的用户名存在不适当的内容,请注意更改
"
);
}
else
{
if
(
info
.
version
===
4921
)
{
info
.
version
=
settings
.
version
;
...
...
@@ -1574,7 +1595,7 @@
regexp
=
new
RegExp
(
badword
);
return
msg
.
match
(
regexp
);
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,禁止您使用随机对战功能!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
,
3
);
...
...
@@ -1585,7 +1606,7 @@
regexp
=
new
RegExp
(
badword
);
return
msg
.
match
(
regexp
);
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
您的发言存在不适当的内容,已被屏蔽,并记录一次违规!
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
发言违规
"
);
cancel
=
true
;
...
...
@@ -1596,7 +1617,7 @@
msg
=
msg
.
replace
(
regexp
,
"
**
"
);
},
msg
);
if
(
oldmsg
!==
msg
)
{
log
.
warn
(
"
BAD WORD LEVEL 1
"
,
client
.
name
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 1
"
,
client
.
name
,
client
.
remoteAddress
,
oldmsg
);
ygopro
.
stoc_send_chat
(
client
,
"
请使用文明用语
"
);
}
struct
=
ygopro
.
structs
[
"
chat
"
];
...
...
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