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
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
8ce9e25d
Commit
8ce9e25d
authored
Dec 30, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
duel start add another api
parent
35caa0d4
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
51 deletions
+115
-51
data/default_config.json
data/default_config.json
+2
-2
ygopro-server.coffee
ygopro-server.coffee
+47
-19
ygopro-server.js
ygopro-server.js
+66
-30
No files found.
data/default_config.json
View file @
8ce9e25d
...
@@ -174,9 +174,9 @@
...
@@ -174,9 +174,9 @@
"post_score"
:
false
,
"post_score"
:
false
,
"get_score"
:
false
,
"get_score"
:
false
,
"punish_quit_before_match"
:
false
,
"punish_quit_before_match"
:
false
,
"
init_post
"
:
{
"
match_api
"
:
{
"enabled"
:
false
,
"enabled"
:
false
,
"url"
:
"https://sapi.moecube.com:444/ygopro/match
/clear
"
,
"url"
:
"https://sapi.moecube.com:444/ygopro/match"
,
"accesskey"
:
"momobako"
"accesskey"
:
"momobako"
}
}
},
},
...
...
ygopro-server.coffee
View file @
8ce9e25d
...
@@ -246,6 +246,26 @@ loadLFList = (path) ->
...
@@ -246,6 +246,26 @@ loadLFList = (path) ->
lflists
.
push
({
date
:
moment
(
list
.
match
(
/!([\d\.]+)/
)[
1
],
'YYYY.MM.DD'
).
utcOffset
(
"-08:00"
),
tcg
:
list
.
indexOf
(
'TCG'
)
!=
-
1
})
lflists
.
push
({
date
:
moment
(
list
.
match
(
/!([\d\.]+)/
)[
1
],
'YYYY.MM.DD'
).
utcOffset
(
"-08:00"
),
tcg
:
list
.
indexOf
(
'TCG'
)
!=
-
1
})
catch
catch
call_match_api
=
(
method
,
path
,
params
)
->
if
not
settings
.
modules
.
arena_mode
.
match_api
.
enabled
return
null
match_api_url
=
new
URL
(
settings
.
modules
.
arena_mode
.
match_api
.
url
+
"/"
+
path
)
match_api_url
.
searchParams
.
append
(
'ak'
,
settings
.
modules
.
arena_mode
.
match_api
.
accesskey
)
for
entry
of
Object
.
entries
(
params
)
key
=
entry
[
0
]
val
=
entry
[
1
]
match_api_url
.
searchParams
.
append
(
key
,
val
)
try
res
=
await
axios
({
method
:
method
url
:
match_api_url
.
toString
()
timeout
:
30000
})
return
res
.
data
catch
e
log
.
warn
'MATCH API CALL ERROR'
,
method
,
path
,
JSON
.
stringify
(
params
),
e
.
toString
()
return
null
init
=
()
->
init
=
()
->
log
.
info
(
'Reading config.'
)
log
.
info
(
'Reading config.'
)
await
createDirectoryIfNotExists
(
"./config"
)
await
createDirectoryIfNotExists
(
"./config"
)
...
@@ -337,6 +357,13 @@ init = () ->
...
@@ -337,6 +357,13 @@ init = () ->
settings
.
modules
.
trusted_proxies
=
settings
.
modules
.
neos
.
trusted_proxies
settings
.
modules
.
trusted_proxies
=
settings
.
modules
.
neos
.
trusted_proxies
delete
settings
.
modules
.
neos
.
trusted_proxies
delete
settings
.
modules
.
neos
.
trusted_proxies
imported
=
true
imported
=
true
# migrate arena_mode.init_post to match_api
if
settings
.
modules
.
arena_mode
.
init_post
settings
.
modules
.
arena_mode
.
match_api
=
settings
.
modules
.
arena_mode
.
init_post
if
settings
.
modules
.
arena_mode
.
match_api
.
url
.
endsWith
(
'/clear'
)
settings
.
modules
.
arena_mode
.
match_api
.
url
=
settings
.
modules
.
arena_mode
.
match_api
.
url
.
slice
(
0
,
-
6
)
delete
settings
.
modules
.
arena_mode
.
init_post
imported
=
true
#finish
#finish
keysFromEnv
=
Object
.
keys
(
process
.
env
).
filter
((
key
)
=>
key
.
startsWith
(
'SRVPRO_'
))
keysFromEnv
=
Object
.
keys
(
process
.
env
).
filter
((
key
)
=>
key
.
startsWith
(
'SRVPRO_'
))
if
keysFromEnv
.
length
>
0
if
keysFromEnv
.
length
>
0
...
@@ -490,16 +517,8 @@ init = () ->
...
@@ -490,16 +517,8 @@ init = () ->
# pg_client.on 'drain', pg_client.end.bind(pg_client)
# pg_client.on 'drain', pg_client.end.bind(pg_client)
# log.info "loading mycard user..."
# log.info "loading mycard user..."
# pg_client.connect()
# pg_client.connect()
if
settings
.
modules
.
arena_mode
.
enabled
and
settings
.
modules
.
arena_mode
.
init_post
.
enabled
if
settings
.
modules
.
arena_mode
.
enabled
postData
=
qs
.
stringify
({
await
call_match_api
(
'POST'
,
'clear'
,
{
arena
:
settings
.
modules
.
arena_mode
.
mode
})
ak
:
settings
.
modules
.
arena_mode
.
init_post
.
accesskey
,
arena
:
settings
.
modules
.
arena_mode
.
mode
})
try
log
.
info
(
"Sending arena init post."
)
await
axios
.
post
(
settings
.
modules
.
arena_mode
.
init_post
.
url
+
"?"
+
postData
)
catch
e
log
.
warn
'ARENA INIT POST ERROR'
,
e
if
settings
.
modules
.
challonge
.
enabled
if
settings
.
modules
.
challonge
.
enabled
Challonge
=
require
(
'./challonge'
).
Challonge
Challonge
=
require
(
'./challonge'
).
Challonge
...
@@ -2469,7 +2488,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
...
@@ -2469,7 +2488,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
if
decrypted_buffer
if
decrypted_buffer
break
break
if
!
decrypted_buffer
if
!
decrypted_buffer
ygopro
.
stoc_die
(
client
,
'${invalid_password_
checksum
}'
)
ygopro
.
stoc_die
(
client
,
'${invalid_password_
unauthorized
}'
)
return
return
return
create_room_with_action
(
decrypted_buffer
)
return
create_room_with_action
(
decrypted_buffer
)
...
@@ -3135,7 +3154,8 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)->
...
@@ -3135,7 +3154,8 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)->
roomlist
.
start
room
if
!
room
.
windbot
and
settings
.
modules
.
http
.
websocket_roomlist
roomlist
.
start
room
if
!
room
.
windbot
and
settings
.
modules
.
http
.
websocket_roomlist
#room.duels = []
#room.duels = []
room
.
dueling_players
=
[]
room
.
dueling_players
=
[]
for
player
in
room
.
get_playing_player
()
playing_players
=
room
.
get_playing_player
()
for
player
in
playing_players
room
.
dueling_players
[
player
.
pos
]
=
player
room
.
dueling_players
[
player
.
pos
]
=
player
room
.
scores
[
player
.
name_vpass
]
=
0
room
.
scores
[
player
.
name_vpass
]
=
0
room
.
player_datas
.
push
key
:
CLIENT_get_authorize_key
(
player
),
name
:
player
.
name
,
pos
:
player
.
pos
room
.
player_datas
.
push
key
:
CLIENT_get_authorize_key
(
player
),
name
:
player
.
name
,
pos
:
player
.
pos
...
@@ -3144,19 +3164,27 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)->
...
@@ -3144,19 +3164,27 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)->
ROOM_players_oppentlist
[
player
.
ip
]
=
null
ROOM_players_oppentlist
[
player
.
ip
]
=
null
if
room
.
hostinfo
.
auto_death
if
room
.
hostinfo
.
auto_death
ygopro
.
stoc_send_chat_to_room
(
room
,
"${auto_death_part1}
#{
room
.
hostinfo
.
auto_death
}
${auto_death_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${auto_death_part1}
#{
room
.
hostinfo
.
auto_death
}
${auto_death_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
else
if
room
.
duel_stage
==
ygopro
.
constants
.
DUEL_STAGE
.
SIDING
and
client
.
pos
<
4
# side deck verified
if
settings
.
modules
.
hide_name
==
"start"
client
.
selected_preduel
=
true
if
client
.
side_tcount
clearInterval
client
.
side_interval
client
.
side_interval
=
null
client
.
side_tcount
=
null
if
settings
.
modules
.
hide_name
==
"start"
and
room
.
duel_count
==
0
for
player
in
room
.
get_playing_player
()
when
player
!=
client
for
player
in
room
.
get_playing_player
()
when
player
!=
client
ygopro
.
stoc_send
(
client
,
'HS_PLAYER_ENTER'
,
{
ygopro
.
stoc_send
(
client
,
'HS_PLAYER_ENTER'
,
{
name
:
player
.
name
,
name
:
player
.
name
,
pos
:
player
.
pos
pos
:
player
.
pos
padding
:
0
,
padding
:
0
,
})
})
if
room
.
arena
await
call_match_api
(
'POST'
,
'room-start'
,
{
usernameA
:
playing_players
[
0
].
name
,
usernameB
:
playing_players
[
1
].
name
,
roomname
:
room
.
name
,
starttime
:
room
.
start_time
,
arena
:
room
.
arena
})
else
if
room
.
duel_stage
==
ygopro
.
constants
.
DUEL_STAGE
.
SIDING
and
client
.
pos
<
4
# side deck verified
client
.
selected_preduel
=
true
if
client
.
side_tcount
clearInterval
client
.
side_interval
client
.
side_interval
=
null
client
.
side_tcount
=
null
if
settings
.
modules
.
tips
.
enabled
if
settings
.
modules
.
tips
.
enabled
ygopro
.
stoc_send_random_tip
(
client
)
ygopro
.
stoc_send_random_tip
(
client
)
deck_text
=
null
deck_text
=
null
...
...
ygopro-server.js
View file @
8ce9e25d
This diff is collapsed.
Click to expand it.
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