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
caabc5aa
Commit
caabc5aa
authored
May 31, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check chat messages for post watcher
parent
cce4b17f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
13 deletions
+49
-13
YGOProMessages.js
YGOProMessages.js
+1
-1
ygopro-server.coffee
ygopro-server.coffee
+16
-1
ygopro-server.js
ygopro-server.js
+32
-11
No files found.
YGOProMessages.js
View file @
caabc5aa
...
...
@@ -180,7 +180,7 @@ class YGOProMessagesHelper {
const
proto
=
this
.
constants
[
direction
][
bufferProto
];
let
cancel
=
proto
&&
protoFilter
&&
_
.
indexOf
(
protoFilter
,
proto
)
===
-
1
;
let
buffer
=
messageBuffer
.
slice
(
3
,
2
+
messageLength
);
console
.
log
(
l
,
direction
,
proto
,
cancel
);
//
console.log(l, direction, proto, cancel);
for
(
let
priority
=
0
;
priority
<
4
;
++
priority
)
{
if
(
cancel
)
{
break
;
...
...
ygopro-server.coffee
View file @
caabc5aa
...
...
@@ -1732,7 +1732,22 @@ net.createServer (client) ->
client
.
on
'data'
,
(
ctos_buffer
)
->
if
client
.
is_post_watcher
room
=
ROOM_all
[
client
.
rid
]
room
.
watcher
.
write
ctos_buffer
if
room
and
!
CLIENT_is_banned_by_mc
(
client
)
if
room
handle_data
=
await
ygopro
.
helper
.
handleBuffer
(
ctos_buffer
,
"CTOS"
,
[
"CHAT"
],
{
client
:
client
,
server
:
client
.
server
})
if
handle_data
.
feedback
log
.
warn
(
handle_data
.
feedback
.
message
,
client
.
name
,
client
.
ip
)
if
handle_data
.
feedback
.
type
==
"OVERSIZE"
or
ROOM_bad_ip
[
client
.
ip
]
>
5
bad_ip_count
=
ROOM_bad_ip
[
client
.
ip
]
if
bad_ip_count
ROOM_bad_ip
[
client
.
ip
]
=
bad_ip_count
+
1
else
ROOM_bad_ip
[
client
.
ip
]
=
1
CLIENT_kick
(
client
)
return
room
.
watcher
.
write
(
buffer
)
for
buffer
in
handle_data
.
datas
else
ctos_filter
=
if
settings
.
modules
.
reconnect
.
enabled
and
client
.
pre_reconnecting
then
[
"UPDATE_DECK"
]
else
null
handle_data
=
await
ygopro
.
helper
.
handleBuffer
(
ctos_buffer
,
"CTOS"
,
ctos_filter
,
{
...
...
ygopro-server.js
View file @
caabc5aa
...
...
@@ -2326,11 +2326,32 @@
// 客户端到服务端(ctos)协议分析
client
.
pre_establish_buffers
=
new
Array
();
client
.
on
(
'
data
'
,
async
function
(
ctos_buffer
)
{
var
bad_ip_count
,
buffer
,
ctos_filter
,
handle_data
,
len3
,
len4
,
n
,
o
,
ref3
,
ref4
,
room
;
var
bad_ip_count
,
buffer
,
ctos_filter
,
handle_data
,
len3
,
len4
,
len5
,
n
,
o
,
p
,
ref3
,
ref4
,
ref5
,
room
;
if
(
client
.
is_post_watcher
)
{
room
=
ROOM_all
[
client
.
rid
];
if
(
room
&&
!
CLIENT_is_banned_by_mc
(
client
))
{
room
.
watcher
.
write
(
ctos_buffer
);
if
(
room
)
{
handle_data
=
(
await
ygopro
.
helper
.
handleBuffer
(
ctos_buffer
,
"
CTOS
"
,
[
"
CHAT
"
],
{
client
:
client
,
server
:
client
.
server
}));
if
(
handle_data
.
feedback
)
{
log
.
warn
(
handle_data
.
feedback
.
message
,
client
.
name
,
client
.
ip
);
if
(
handle_data
.
feedback
.
type
===
"
OVERSIZE
"
||
ROOM_bad_ip
[
client
.
ip
]
>
5
)
{
bad_ip_count
=
ROOM_bad_ip
[
client
.
ip
];
if
(
bad_ip_count
)
{
ROOM_bad_ip
[
client
.
ip
]
=
bad_ip_count
+
1
;
}
else
{
ROOM_bad_ip
[
client
.
ip
]
=
1
;
}
CLIENT_kick
(
client
);
return
;
}
}
ref3
=
handle_data
.
datas
;
for
(
n
=
0
,
len3
=
ref3
.
length
;
n
<
len3
;
n
++
)
{
buffer
=
ref3
[
n
];
room
.
watcher
.
write
(
buffer
);
}
}
}
else
{
ctos_filter
=
settings
.
modules
.
reconnect
.
enabled
&&
client
.
pre_reconnecting
?
[
"
UPDATE_DECK
"
]
:
null
;
...
...
@@ -2339,7 +2360,7 @@
server
:
client
.
server
}));
if
(
handle_data
.
feedback
)
{
log
.
warn
(
handle_data
.
feedback
,
client
.
name
,
client
.
ip
);
log
.
warn
(
handle_data
.
feedback
.
message
,
client
.
name
,
client
.
ip
);
if
(
handle_data
.
feedback
.
type
===
"
OVERSIZE
"
||
ROOM_bad_ip
[
client
.
ip
]
>
5
)
{
bad_ip_count
=
ROOM_bad_ip
[
client
.
ip
];
if
(
bad_ip_count
)
{
...
...
@@ -2355,15 +2376,15 @@
return
;
}
if
(
client
.
established
)
{
ref3
=
handle_data
.
datas
;
for
(
n
=
0
,
len3
=
ref3
.
length
;
n
<
len3
;
n
++
)
{
buffer
=
ref3
[
n
];
client
.
server
.
write
(
buffer
);
}
}
else
{
ref4
=
handle_data
.
datas
;
for
(
o
=
0
,
len4
=
ref4
.
length
;
o
<
len4
;
o
++
)
{
buffer
=
ref4
[
o
];
client
.
server
.
write
(
buffer
);
}
}
else
{
ref5
=
handle_data
.
datas
;
for
(
p
=
0
,
len5
=
ref5
.
length
;
p
<
len5
;
p
++
)
{
buffer
=
ref5
[
p
];
client
.
pre_establish_buffers
.
push
(
buffer
);
}
}
...
...
@@ -2377,7 +2398,7 @@
server
:
server
}));
if
(
handle_data
.
feedback
)
{
log
.
warn
(
handle_data
.
feedback
,
server
.
client
.
name
,
server
.
client
.
ip
);
log
.
warn
(
handle_data
.
feedback
.
message
,
server
.
client
.
name
,
server
.
client
.
ip
);
if
(
handle_data
.
feedback
.
type
===
"
OVERSIZE
"
)
{
server
.
destroy
();
return
;
...
...
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