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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
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
nanahira
srvpro
Commits
64647df3
Commit
64647df3
authored
Oct 27, 2021
by
nanahira
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve match permit
parent
fb77d7de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
36 deletions
+53
-36
ygopro-server.coffee
ygopro-server.coffee
+14
-5
ygopro-server.js
ygopro-server.js
+39
-31
No files found.
ygopro-server.coffee
View file @
64647df3
...
...
@@ -2139,7 +2139,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
checksum
+=
buf
.
readUInt8
(
i
)
(
checksum
&
0xFF
)
==
0
create_room_with_action
=
(
buffer
,
decrypted_buffer
,
match_permit
)
->
create_room_with_action
=
(
buffer
,
decrypted_buffer
)
->
if
client
.
closed
return
firstByte
=
buffer
.
readUInt8
(
1
)
...
...
@@ -2207,9 +2207,16 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
ygopro
.
stoc_die
(
client
,
'${invalid_password_not_found}'
)
return
when
4
if
match_permit
and
!
match_permit
.
permit
ygopro
.
stoc_die
(
client
,
'${invalid_password_unauthorized}'
)
return
if
settings
.
modules
.
arena_mode
.
check_permit
match_permit
=
null
try
match_permit
=
await
axios
.
get
settings
.
modules
.
arena_mode
.
check_permit
,
responseType
:
'json'
catch
e
log
.
warn
"match permit fail
#{
e
.
toString
()
}
"
if
match_permit
and
match_permit
.
permit
==
false
ygopro
.
stoc_die
(
client
,
'${invalid_password_unauthorized}'
)
return
room
=
await
ROOM_find_or_create_by_name
(
'M#'
+
info
.
pass
.
slice
(
8
))
if
room
for
player
in
room
.
get_playing_player
()
when
player
and
player
.
name
==
client
.
name
...
...
@@ -2239,6 +2246,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
return
_async
.
auto
({
###
match_permit: (done) ->
if client.closed
done()
...
...
@@ -2264,6 +2272,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
done(null, null)
return
return
###
get_user
:
(
done
)
->
if
client
.
closed
done
()
...
...
@@ -2322,7 +2331,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
return
create_room_with_action
(
data
.
get_user
.
original
,
data
.
get_user
.
decrypted
,
data
.
match_permit
)
create_room_with_action
(
data
.
get_user
.
original
,
data
.
get_user
.
decrypted
)
)
...
...
ygopro-server.js
View file @
64647df3
...
...
@@ -2832,8 +2832,8 @@
}
return
(
checksum
&
0xFF
)
===
0
;
};
create_room_with_action
=
async
function
(
buffer
,
decrypted_buffer
,
match_permit
)
{
var
action
,
firstByte
,
len2
,
m
,
name
,
opt0
,
opt1
,
opt2
,
opt3
,
options
,
player
,
ref
,
ref1
,
room
,
room_title
,
title
;
create_room_with_action
=
async
function
(
buffer
,
decrypted_buffer
)
{
var
action
,
e
,
firstByte
,
len2
,
m
,
match_permit
,
name
,
opt0
,
opt1
,
opt2
,
opt3
,
options
,
player
,
ref
,
ref1
,
room
,
room_title
,
title
;
if
(
client
.
closed
)
{
return
;
}
...
...
@@ -2913,9 +2913,20 @@
}
break
;
case
4
:
if
(
match_permit
&&
!
match_permit
.
permit
)
{
ygopro
.
stoc_die
(
client
,
'
${invalid_password_unauthorized}
'
);
return
;
if
(
settings
.
modules
.
arena_mode
.
check_permit
)
{
match_permit
=
null
;
try
{
match_permit
=
(
await
axios
.
get
(
settings
.
modules
.
arena_mode
.
check_permit
,
{
responseType
:
'
json
'
}));
}
catch
(
error1
)
{
e
=
error1
;
log
.
warn
(
`match permit fail
${
e
.
toString
()}
`
);
}
if
(
match_permit
&&
match_permit
.
permit
===
false
)
{
ygopro
.
stoc_die
(
client
,
'
${invalid_password_unauthorized}
'
);
return
;
}
}
room
=
(
await
ROOM_find_or_create_by_name
(
'
M#
'
+
info
.
pass
.
slice
(
8
)));
if
(
room
)
{
...
...
@@ -2957,36 +2968,33 @@
}
};
_async
.
auto
({
match_permit
:
function
(
done
)
{
if
(
client
.
closed
)
{
done
();
return
;
}
if
(
!
settings
.
modules
.
arena_mode
.
check_permit
)
{
done
(
null
,
null
);
return
;
}
request
({
/*
match_permit: (done) ->
if client.closed
done()
return
if(!settings.modules.arena_mode.check_permit)
done(null, null)
return
request
url: settings.modules.arena_mode.check_permit,
json: true,
qs
:
{
qs:
username: client.name,
password: info.pass,
arena: settings.modules.arena_mode.mode
}
},
function
(
error
,
response
,
body
)
{
if
(
client
.
closed
)
{
done
(
null
,
null
);
return
;
}
if
(
!
error
&&
body
)
{
done
(
null
,
body
);
}
else
{
log
.
warn
(
"
Match permit request error
"
,
error
);
done
(
null
,
null
);
}
});
},
, (error, response, body)->
if client.closed
done(null, null)
return
if !error and body
done(null, body)
else
log.warn("Match permit request error", error)
done(null, null)
return
return
*/
get_user
:
function
(
done
)
{
var
decrypted_buffer
,
i
,
id
,
len2
,
m
,
ref
,
secret
;
if
(
client
.
closed
)
{
...
...
@@ -3056,7 +3064,7 @@
ygopro
.
stoc_die
(
client
,
err
);
return
;
}
return
create_room_with_action
(
data
.
get_user
.
original
,
data
.
get_user
.
decrypted
,
data
.
match_permit
);
return
create_room_with_action
(
data
.
get_user
.
original
,
data
.
get_user
.
decrypted
);
});
}
else
if
(
settings
.
modules
.
challonge
.
enabled
)
{
if
(
info
.
version
!==
settings
.
version
&&
settings
.
alternative_versions
.
includes
(
info
.
version
))
{
...
...
nanahira
@nanahira
mentioned in commit
364afb30
·
Oct 27, 2021
mentioned in commit
364afb30
mentioned in commit 364afb30d62c01f46c4dd7637d8ce2a257b4c36f
Toggle commit list
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