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
7c916fd6
Commit
7c916fd6
authored
Nov 22, 2019
by
Yuzurisa
Committed by
nanahira
Nov 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update deck name verify (#23)
parent
64376c39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
ygopro-server.coffee
ygopro-server.coffee
+8
-4
ygopro-server.js
ygopro-server.js
+12
-6
No files found.
ygopro-server.coffee
View file @
7c916fd6
...
...
@@ -1758,6 +1758,12 @@ net.createServer (client) ->
if
settings
.
modules
.
stop
log
.
info
"NOTE: server not open due to config, "
,
settings
.
modules
.
stop
deck_name_match
=
global
.
deck_name_match
=
(
deck_name
,
player_name
)
->
if
deck_name
==
player_name
or
deck_name
==
player_name
+
".ydk"
or
deck_name
==
player_name
+
".ydk.ydk"
return
true
parsed_deck_name
=
deck_name
.
match
(
/^([^\+]+)[\+ ](.+?)(\.ydk){0,2}$/
)
return
parsed_deck_name
and
(
player_name
==
parsed_deck_name
[
1
]
or
player_name
==
parsed_deck_name
[
2
])
# 功能模块
# return true to cancel a synchronous message
...
...
@@ -2092,7 +2098,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
return
found
=
false
for
k
,
user
of
data
if
user
.
participant
and
user
.
participant
.
name
and
_
.
endsWit
h
(
user
.
participant
.
name
,
client
.
name
)
if
user
.
participant
and
user
.
participant
.
name
and
deck_name_matc
h
(
user
.
participant
.
name
,
client
.
name
)
found
=
user
.
participant
break
if
!
found
...
...
@@ -3106,9 +3112,7 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server, datas)->
found_deck
=
false
decks
=
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
)
for
deck
in
decks
if
_
.
endsWith
(
deck
,
client
.
name
+
".ydk"
)
found_deck
=
deck
if
_
.
endsWith
(
deck
,
client
.
name
+
".ydk.ydk"
)
if
deck_name_match
(
deck
,
client
.
name
)
found_deck
=
deck
if
found_deck
deck_text
=
fs
.
readFileSync
(
settings
.
modules
.
tournament_mode
.
deck_path
+
found_deck
,{
encoding
:
"ASCII"
})
...
...
ygopro-server.js
View file @
7c916fd6
// Generated by CoffeeScript 1.12.7
(
function
()
{
var
CLIENT_get_authorize_key
,
CLIENT_get_kick_reconnect_target
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_kick_reconnect
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_banned_by_mc
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_kick_reconnect
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_replays
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_pid
,
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_player_flee
,
ROOM_player_get_score
,
ROOM_player_lose
,
ROOM_player_win
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_players_scores
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
SERVER_clear_disconnect
,
SOCKET_flush_data
,
_
,
addCallback
,
auth
,
badwords
,
ban_user
,
bunyan
,
challonge
,
challonge_cache
,
challonge_module_name
,
challonge_queue_callbacks
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
dns
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_callback
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
import_datas
,
imported
,
is_requesting
,
j
,
l
,
len
,
len1
,
len2
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
m
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
plugin_filename
,
plugin_list
,
plugin_path
,
real_windbot_server_ip
,
rebooted
,
redis
,
redisdb
,
ref
,
ref1
,
refresh_challonge_cache
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
spawn_windbot
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_looplimit
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
var
CLIENT_get_authorize_key
,
CLIENT_get_kick_reconnect_target
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_kick_reconnect
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_banned_by_mc
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_kick_reconnect
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_replays
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_pid
,
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_player_flee
,
ROOM_player_get_score
,
ROOM_player_lose
,
ROOM_player_win
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_players_scores
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
SERVER_clear_disconnect
,
SOCKET_flush_data
,
_
,
addCallback
,
auth
,
badwords
,
ban_user
,
bunyan
,
challonge
,
challonge_cache
,
challonge_module_name
,
challonge_queue_callbacks
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
de
ck_name_match
,
de
fault_config
,
default_data
,
dialogues
,
disconnect_list
,
dns
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_callback
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
import_datas
,
imported
,
is_requesting
,
j
,
l
,
len
,
len1
,
len2
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
m
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
plugin_filename
,
plugin_list
,
plugin_path
,
real_windbot_server_ip
,
rebooted
,
redis
,
redisdb
,
ref
,
ref1
,
refresh_challonge_cache
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
spawn_windbot
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_looplimit
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
...
...
@@ -2263,6 +2263,15 @@
log
.
info
(
"
NOTE: server not open due to config,
"
,
settings
.
modules
.
stop
);
}
deck_name_match
=
global
.
deck_name_match
=
function
(
deck_name
,
player_name
)
{
var
parsed_deck_name
;
if
(
deck_name
===
player_name
||
deck_name
===
player_name
+
"
.ydk
"
||
deck_name
===
player_name
+
"
.ydk.ydk
"
)
{
return
true
;
}
parsed_deck_name
=
deck_name
.
match
(
/^
([^\+]
+
)[\+
](
.+
?)(\.
ydk
){0,2}
$/
);
return
parsed_deck_name
&&
(
player_name
===
parsed_deck_name
[
1
]
||
player_name
===
parsed_deck_name
[
2
]);
};
ygopro
.
ctos_follow
(
'
PLAYER_INFO
'
,
true
,
function
(
buffer
,
info
,
client
,
server
,
datas
)
{
var
geo
,
lang
,
name
,
name_full
,
struct
,
vpass
;
name_full
=
info
.
name
.
split
(
"
$
"
);
...
...
@@ -2633,7 +2642,7 @@
found
=
false
;
for
(
k
in
data
)
{
user
=
data
[
k
];
if
(
user
.
participant
&&
user
.
participant
.
name
&&
_
.
endsWit
h
(
user
.
participant
.
name
,
client
.
name
))
{
if
(
user
.
participant
&&
user
.
participant
.
name
&&
deck_name_matc
h
(
user
.
participant
.
name
,
client
.
name
))
{
found
=
user
.
participant
;
break
;
}
...
...
@@ -3967,10 +3976,7 @@
decks
=
fs
.
readdirSync
(
settings
.
modules
.
tournament_mode
.
deck_path
);
for
(
m
=
0
,
len2
=
decks
.
length
;
m
<
len2
;
m
++
)
{
deck
=
decks
[
m
];
if
(
_
.
endsWith
(
deck
,
client
.
name
+
"
.ydk
"
))
{
found_deck
=
deck
;
}
if
(
_
.
endsWith
(
deck
,
client
.
name
+
"
.ydk.ydk
"
))
{
if
(
deck_name_match
(
deck
,
client
.
name
))
{
found_deck
=
deck
;
}
}
...
...
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