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
2a639db2
Commit
2a639db2
authored
Feb 14, 2026
by
水濑真白
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build: update ygopro-tournament.js
parent
3b813a9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
ygopro-tournament.js
ygopro-tournament.js
+20
-16
No files found.
ygopro-tournament.js
View file @
2a639db2
...
...
@@ -189,29 +189,33 @@ const UploadToChallonge = async function () {
};
const
receiveDecks
=
async
function
(
files
,
callback
)
{
try
{
// formidable parse() 返回的 files 通常是对象:{ fieldName: File | File[] }
// 老代码按数组 for..of 会直接抛:TypeError: files is not iterable
const
fileList
=
Array
.
isArray
(
files
)
?
files
:
files
&&
typeof
files
===
"
object
"
?
Object
.
values
(
files
).
flatMap
((
v
)
=>
(
Array
.
isArray
(
v
)
?
v
:
[
v
]))
:
[];
const
result
=
[];
for
(
const
file
of
files
)
{
if
(
file
.
name
.
endsWith
(
"
.ydk
"
))
{
const
deck
=
await
readDeck
(
file
.
name
,
file
.
path
);
for
(
const
f
of
fileList
)
{
const
filename
=
(
f
?.
originalFilename
??
f
?.
name
??
""
);
const
filepath
=
(
f
?.
filepath
??
f
?.
path
??
""
);
if
(
!
filename
||
!
filepath
)
{
result
.
push
({
file
:
filename
||
"
(unknown)
"
,
status
:
"
上传文件信息缺失
"
});
continue
;
}
if
(
filename
.
endsWith
(
"
.ydk
"
))
{
const
deck
=
await
readDeck
(
filename
,
filepath
);
if
(
deck
.
main
.
length
>=
40
)
{
fs
.
createReadStream
(
file
.
path
).
pipe
(
fs
.
createWriteStream
(
config
.
deck_path
+
file
.
name
));
result
.
push
({
file
:
file
.
name
,
status
:
"
OK
"
,
});
fs
.
createReadStream
(
filepath
).
pipe
(
fs
.
createWriteStream
(
config
.
deck_path
+
filename
));
result
.
push
({
file
:
filename
,
status
:
"
OK
"
});
}
else
{
result
.
push
({
file
:
file
.
name
,
status
:
"
卡组不合格
"
,
});
result
.
push
({
file
:
filename
,
status
:
"
卡组不合格
"
});
}
}
else
{
result
.
push
({
file
:
file
.
name
,
status
:
"
不是卡组文件
"
,
});
result
.
push
({
file
:
filename
,
status
:
"
不是卡组文件
"
});
}
}
callback
(
null
,
result
);
...
...
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