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
02528579
Commit
02528579
authored
Jan 23, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add deckbuf to uploadParticipants
parent
9959889e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
27 deletions
+16
-27
challonge.ts
challonge.ts
+3
-3
ygopro-tournament.js
ygopro-tournament.js
+13
-24
No files found.
challonge.ts
View file @
02528579
...
...
@@ -134,12 +134,12 @@ export class Challonge {
}
}
// POST /v1/tournaments/${tournament_id}/participants/bulk_add.json { api_key: string, participants: { name: string }[] } returns ANY
async
uploadParticipants
(
participant
Names
:
string
[])
{
// POST /v1/tournaments/${tournament_id}/participants/bulk_add.json { api_key: string, participants: { name: string
, deckbuf?: string
}[] } returns ANY
async
uploadParticipants
(
participant
s
:
{
name
:
string
,
deckbuf
?:
string
}
[])
{
try
{
await
axios
.
post
(
`
${
this
.
config
.
challonge_url
}
/v1/tournaments/
${
this
.
config
.
tournament_id
}
/participants/bulk_add.json`
,
{
api_key
:
this
.
config
.
api_key
,
participants
:
participantNames
.
map
(
name
=>
({
name
}))
,
participants
,
});
return
true
;
}
catch
(
e
)
{
...
...
ygopro-tournament.js
View file @
02528579
...
...
@@ -16,7 +16,6 @@ const _ = require('underscore');
_
.
str
=
require
(
'
underscore.string
'
);
_
.
mixin
(
_
.
str
.
exports
());
const
loadJSON
=
require
(
'
load-json-file
'
).
sync
;
const
axios
=
require
(
'
axios
'
);
const
auth
=
require
(
'
./ygopro-auth.js
'
);
...
...
@@ -28,8 +27,7 @@ const challonge = new Challonge(challonge_config);
ssl_config
=
settings
.
modules
.
http
.
ssl
;
const
_async
=
require
(
"
async
"
);
const
os
=
require
(
"
os
"
);
const
PROCESS_COUNT
=
os
.
cpus
().
length
;
const
YGOProDeckEncode
=
require
(
'
ygopro-deck-encode
'
).
default
;
//http长连接
let
responder
;
...
...
@@ -75,25 +73,7 @@ const readDeck = async function(deck_name, deck_full_path) {
const
deck
=
{};
deck
.
name
=
deck_name
;
deck_text
=
await
fs
.
promises
.
readFile
(
deck_full_path
,
{
encoding
:
"
ASCII
"
});
deck_array
=
deck_text
.
split
(
/
\r?\n
/
);
deck
.
main
=
[];
deck
.
extra
=
[];
deck
.
side
=
[];
current_deck
=
deck
.
main
;
for
(
l
in
deck_array
)
{
line
=
deck_array
[
l
];
if
(
line
.
indexOf
(
"
#extra
"
)
>=
0
)
{
current_deck
=
deck
.
extra
;
}
if
(
line
.
indexOf
(
"
!side
"
)
>=
0
)
{
current_deck
=
deck
.
side
;
}
card
=
parseInt
(
line
);
if
(
!
isNaN
(
card
)
&&
!
line
.
endsWith
(
"
#
"
))
{
current_deck
.
push
(
card
);
}
}
return
deck
;
return
YGOProDeckEncode
.
fromYdkString
(
deck_text
);
}
//读取指定文件夹中所有卡组
...
...
@@ -148,7 +128,16 @@ const UploadToChallonge = async function () {
for
(
const
k
in
decks_list
)
{
const
deck_name
=
decks_list
[
k
];
if
(
_
.
endsWith
(
deck_name
,
"
.ydk
"
))
{
player_list
.
push
(
deck_name
.
slice
(
0
,
deck_name
.
length
-
4
));
player_list
.
push
({
name
:
deck_name
.
slice
(
0
,
deck_name
.
length
-
4
),
deckbuf
:
Buffer
.
from
(
YGOProDeckEncode
.
fromYdkString
(
await
fs
.
promises
.
readFile
(
config
.
deck_path
+
deck_name
,
{
encoding
:
"
ASCII
"
})
)
.
toUpdateDeckPayload
()
)
.
toString
(
'
base64
'
)
});
}
}
if
(
!
player_list
.
length
)
{
...
...
@@ -161,7 +150,7 @@ const UploadToChallonge = async function () {
await
challonge
.
clearParticipants
();
sendResponse
(
"
开始上传玩家列表至 Challonge。
"
);
for
(
const
chunk
of
_
.
chunk
(
player_list
,
10
))
{
sendResponse
(
`开始上传玩家
${
chunk
.
join
(
'
,
'
)}
至 Challonge。`
);
sendResponse
(
`开始上传玩家
${
chunk
.
map
(
c
=>
c
.
name
).
join
(
'
,
'
)}
至 Challonge。`
);
await
challonge
.
uploadParticipants
(
chunk
);
}
sendResponse
(
"
玩家列表上传完成。
"
);
...
...
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