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
4e22671d
Commit
4e22671d
authored
Aug 14, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
big brother is watching you
parent
7d1b4543
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
10 deletions
+70
-10
config.json
config.json
+5
-0
i18n.json
i18n.json
+1
-1
ygopro-server.coffee
ygopro-server.coffee
+29
-4
ygopro-server.js
ygopro-server.js
+35
-5
No files found.
config.json
View file @
4e22671d
...
@@ -66,6 +66,11 @@
...
@@ -66,6 +66,11 @@
"post"
:
"https://api.mycard.moe/ygopro/analytics/deck/text"
,
"post"
:
"https://api.mycard.moe/ygopro/analytics/deck/text"
,
"arena"
:
"233"
"arena"
:
"233"
},
},
"big_brother"
:
{
"enabled"
:
false
,
"accesskey"
:
"233"
,
"post"
:
"https://api.mycard.moe/ygopro/big-brother"
},
"arena_mode"
:
{
"arena_mode"
:
{
"enabled"
:
false
,
"enabled"
:
false
,
"mode"
:
"entertain"
,
"mode"
:
"entertain"
,
...
...
i18n.json
View file @
4e22671d
...
@@ -160,7 +160,7 @@
...
@@ -160,7 +160,7 @@
"room_name"
:
"您当前的房间名是"
,
"room_name"
:
"您当前的房间名是"
,
"banned_chat_tip"
:
"您已被禁言!"
,
"banned_chat_tip"
:
"您已被禁言!"
,
"banned_duel_tip"
:
"您的发言存在严重不适当的内容,禁止您使用随机对战功能!"
,
"banned_duel_tip"
:
"您的发言存在严重不适当的内容,禁止您使用随机对战功能!"
,
"chat_warn_level0"
:
"请不要发送垃圾信息!"
,
"chat_warn_level0"
:
"请不要发送
过长的消息或
垃圾信息!"
,
"chat_warn_level2"
:
"您的发言存在不适当的内容,发送失败!"
,
"chat_warn_level2"
:
"您的发言存在不适当的内容,发送失败!"
,
"chat_warn_level1"
:
"请使用文明用语!"
,
"chat_warn_level1"
:
"请使用文明用语!"
,
"chat_banned"
:
"已被禁言!"
,
"chat_banned"
:
"已被禁言!"
,
...
...
ygopro-server.coffee
View file @
4e22671d
...
@@ -1449,6 +1449,27 @@ ygopro.ctos_follow 'SURRENDER', true, (buffer, info, client, server)->
...
@@ -1449,6 +1449,27 @@ ygopro.ctos_follow 'SURRENDER', true, (buffer, info, client, server)->
return
true
return
true
return
false
return
false
report_to_big_brother
=
(
roomname
,
sender
,
ip
,
level
,
content
,
match
)
->
return
unless
settings
.
modules
.
big_brother
.
enabled
request
.
post
{
url
:
settings
.
modules
.
big_brother
.
post
,
form
:
{
accesskey
:
settings
.
modules
.
big_brother
.
accesskey
,
roomname
:
roomname
,
sender
:
sender
,
ip
:
ip
,
level
:
level
,
content
:
content
,
match
:
match
}},
(
error
,
response
,
body
)
->
if
error
log
.
warn
'BIG BROTHER ERROR'
,
error
else
if
response
.
statusCode
!=
200
log
.
warn
'BIG BROTHER FAIL'
,
response
.
statusCode
,
roomname
,
body
#else
#log.info 'BIG BROTHER OK', response.statusCode, roomname, body
return
return
ygopro
.
ctos_follow
'CHAT'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
ygopro
.
ctos_follow
'CHAT'
,
true
,
(
buffer
,
info
,
client
,
server
)
->
room
=
ROOM_all
[
client
.
rid
]
room
=
ROOM_all
[
client
.
rid
]
return
unless
room
return
unless
room
...
@@ -1512,7 +1533,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1512,7 +1533,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
regexp
=
new
RegExp
(
badword
,
'i'
)
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
return
msg
.
match
(
regexp
)
,
msg
))
,
msg
))
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
client
.
ip
,
oldmsg
log
.
warn
"BAD WORD LEVEL 3"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
report_to_big_brother
room
.
name
,
client
.
name
,
client
.
ip
,
3
,
oldmsg
,
RegExp
.
$1
cancel
=
true
cancel
=
true
if
client
.
abuse_count
>
0
if
client
.
abuse_count
>
0
ygopro
.
stoc_send_chat
(
client
,
"${banned_duel_tip}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${banned_duel_tip}"
,
ygopro
.
constants
.
COLORS
.
RED
)
...
@@ -1539,7 +1561,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1539,7 +1561,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
regexp
=
new
RegExp
(
badword
,
'i'
)
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
return
msg
.
match
(
regexp
)
,
msg
))
,
msg
))
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
client
.
ip
,
oldmsg
log
.
warn
"BAD WORD LEVEL 2"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
report_to_big_brother
room
.
name
,
client
.
name
,
client
.
ip
,
2
,
oldmsg
,
RegExp
.
$1
client
.
abuse_count
=
client
.
abuse_count
+
3
client
.
abuse_count
=
client
.
abuse_count
+
3
ygopro
.
stoc_send_chat
(
client
,
"${chat_warn_level2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat
(
client
,
"${chat_warn_level2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
cancel
=
true
cancel
=
true
...
@@ -1551,7 +1574,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1551,7 +1574,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
return
return
,
msg
)
,
msg
)
if
oldmsg
!=
msg
if
oldmsg
!=
msg
log
.
warn
"BAD WORD LEVEL 1"
,
client
.
name
,
client
.
ip
,
oldmsg
log
.
warn
"BAD WORD LEVEL 1"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
report_to_big_brother
room
.
name
,
client
.
name
,
client
.
ip
,
1
,
oldmsg
,
RegExp
.
$1
client
.
abuse_count
=
client
.
abuse_count
+
1
client
.
abuse_count
=
client
.
abuse_count
+
1
ygopro
.
stoc_send_chat
(
client
,
"${chat_warn_level1}"
)
ygopro
.
stoc_send_chat
(
client
,
"${chat_warn_level1}"
)
struct
=
ygopro
.
structs
[
"chat"
]
struct
=
ygopro
.
structs
[
"chat"
]
...
@@ -1562,7 +1586,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
...
@@ -1562,7 +1586,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
regexp
=
new
RegExp
(
badword
,
'i'
)
regexp
=
new
RegExp
(
badword
,
'i'
)
return
msg
.
match
(
regexp
)
return
msg
.
match
(
regexp
)
,
msg
))
,
msg
))
log
.
info
"BAD WORD LEVEL 0"
,
client
.
name
,
client
.
ip
,
oldmsg
log
.
info
"BAD WORD LEVEL 0"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
report_to_big_brother
room
.
name
,
client
.
name
,
client
.
ip
,
0
,
oldmsg
,
RegExp
.
$1
if
client
.
abuse_count
>=
2
if
client
.
abuse_count
>=
2
ROOM_unwelcome
(
room
,
client
,
"${random_ban_reason_abuse}"
)
ROOM_unwelcome
(
room
,
client
,
"${random_ban_reason_abuse}"
)
if
client
.
abuse_count
>=
5
if
client
.
abuse_count
>=
5
...
...
ygopro-server.js
View file @
4e22671d
// Generated by CoffeeScript 1.12.2
// Generated by CoffeeScript 1.12.2
(
function
()
{
(
function
()
{
var
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
_
,
addCallback
,
ban_user
,
bunyan
,
cppversion
,
crypto
,
date
,
defaultconfig
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
list
,
load_dialogues
,
load_tips
,
log
,
moment
,
nconf
,
net
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
request
,
requestListener
,
roomlist
,
settings
,
spawn
,
spawnSync
,
url
,
users_cache
,
wait_room_start
,
windbot_process
,
ygopro
,
zlib
;
var
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
_
,
addCallback
,
ban_user
,
bunyan
,
cppversion
,
crypto
,
date
,
defaultconfig
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
list
,
load_dialogues
,
load_tips
,
log
,
moment
,
nconf
,
net
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
re
port_to_big_brother
,
re
quest
,
requestListener
,
roomlist
,
settings
,
spawn
,
spawnSync
,
url
,
users_cache
,
wait_room_start
,
windbot_process
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
net
=
require
(
'
net
'
);
...
@@ -1780,6 +1780,32 @@
...
@@ -1780,6 +1780,32 @@
return
false
;
return
false
;
});
});
report_to_big_brother
=
function
(
roomname
,
sender
,
ip
,
level
,
content
,
match
)
{
if
(
!
settings
.
modules
.
big_brother
.
enabled
)
{
return
;
}
request
.
post
({
url
:
settings
.
modules
.
big_brother
.
post
,
form
:
{
accesskey
:
settings
.
modules
.
big_brother
.
accesskey
,
roomname
:
roomname
,
sender
:
sender
,
ip
:
ip
,
level
:
level
,
content
:
content
,
match
:
match
}
},
function
(
error
,
response
,
body
)
{
if
(
error
)
{
log
.
warn
(
'
BIG BROTHER ERROR
'
,
error
);
}
else
{
if
(
response
.
statusCode
!==
200
)
{
log
.
warn
(
'
BIG BROTHER FAIL
'
,
response
.
statusCode
,
roomname
,
body
);
}
}
});
};
ygopro
.
ctos_follow
(
'
CHAT
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
ygopro
.
ctos_follow
(
'
CHAT
'
,
true
,
function
(
buffer
,
info
,
client
,
server
)
{
var
cancel
,
cmd
,
msg
,
name
,
oldmsg
,
room
,
struct
,
windbot
;
var
cancel
,
cmd
,
msg
,
name
,
oldmsg
,
room
,
struct
,
windbot
;
room
=
ROOM_all
[
client
.
rid
];
room
=
ROOM_all
[
client
.
rid
];
...
@@ -1870,7 +1896,8 @@
...
@@ -1870,7 +1896,8 @@
regexp
=
new
RegExp
(
badword
,
'
i
'
);
regexp
=
new
RegExp
(
badword
,
'
i
'
);
return
msg
.
match
(
regexp
);
return
msg
.
match
(
regexp
);
},
msg
))
{
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
client
.
ip
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 3
"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
);
report_to_big_brother
(
room
.
name
,
client
.
name
,
client
.
ip
,
3
,
oldmsg
,
RegExp
.
$1
);
cancel
=
true
;
cancel
=
true
;
if
(
client
.
abuse_count
>
0
)
{
if
(
client
.
abuse_count
>
0
)
{
ygopro
.
stoc_send_chat
(
client
,
"
${banned_duel_tip}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat
(
client
,
"
${banned_duel_tip}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
...
@@ -1898,7 +1925,8 @@
...
@@ -1898,7 +1925,8 @@
regexp
=
new
RegExp
(
badword
,
'
i
'
);
regexp
=
new
RegExp
(
badword
,
'
i
'
);
return
msg
.
match
(
regexp
);
return
msg
.
match
(
regexp
);
},
msg
))
{
},
msg
))
{
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
client
.
ip
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 2
"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
);
report_to_big_brother
(
room
.
name
,
client
.
name
,
client
.
ip
,
2
,
oldmsg
,
RegExp
.
$1
);
client
.
abuse_count
=
client
.
abuse_count
+
3
;
client
.
abuse_count
=
client
.
abuse_count
+
3
;
ygopro
.
stoc_send_chat
(
client
,
"
${chat_warn_level2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat
(
client
,
"
${chat_warn_level2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
cancel
=
true
;
cancel
=
true
;
...
@@ -1909,7 +1937,8 @@
...
@@ -1909,7 +1937,8 @@
msg
=
msg
.
replace
(
regexp
,
"
**
"
);
msg
=
msg
.
replace
(
regexp
,
"
**
"
);
},
msg
);
},
msg
);
if
(
oldmsg
!==
msg
)
{
if
(
oldmsg
!==
msg
)
{
log
.
warn
(
"
BAD WORD LEVEL 1
"
,
client
.
name
,
client
.
ip
,
oldmsg
);
log
.
warn
(
"
BAD WORD LEVEL 1
"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
);
report_to_big_brother
(
room
.
name
,
client
.
name
,
client
.
ip
,
1
,
oldmsg
,
RegExp
.
$1
);
client
.
abuse_count
=
client
.
abuse_count
+
1
;
client
.
abuse_count
=
client
.
abuse_count
+
1
;
ygopro
.
stoc_send_chat
(
client
,
"
${chat_warn_level1}
"
);
ygopro
.
stoc_send_chat
(
client
,
"
${chat_warn_level1}
"
);
struct
=
ygopro
.
structs
[
"
chat
"
];
struct
=
ygopro
.
structs
[
"
chat
"
];
...
@@ -1921,7 +1950,8 @@
...
@@ -1921,7 +1950,8 @@
regexp
=
new
RegExp
(
badword
,
'
i
'
);
regexp
=
new
RegExp
(
badword
,
'
i
'
);
return
msg
.
match
(
regexp
);
return
msg
.
match
(
regexp
);
},
msg
))
{
},
msg
))
{
log
.
info
(
"
BAD WORD LEVEL 0
"
,
client
.
name
,
client
.
ip
,
oldmsg
);
log
.
info
(
"
BAD WORD LEVEL 0
"
,
client
.
name
,
client
.
ip
,
oldmsg
,
RegExp
.
$1
);
report_to_big_brother
(
room
.
name
,
client
.
name
,
client
.
ip
,
0
,
oldmsg
,
RegExp
.
$1
);
}
}
}
}
if
(
client
.
abuse_count
>=
2
)
{
if
(
client
.
abuse_count
>=
2
)
{
...
...
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