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
4ed935df
Commit
4ed935df
authored
Apr 05, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
async for room list
parent
580377da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
63 deletions
+72
-63
ygopro-server.coffee
ygopro-server.coffee
+29
-20
ygopro-server.js
ygopro-server.js
+43
-43
No files found.
ygopro-server.coffee
View file @
4ed935df
...
...
@@ -3586,8 +3586,12 @@ if settings.modules.http
response
.
writeHead
(
200
)
response
.
end
(
addCallback
(
u
.
query
.
callback
,
'{"rooms":[{"roomid":"0","roomname":"密码错误","needpass":"true"}]}'
))
else
response
.
writeHead
(
200
)
roomsjson
=
JSON
.
stringify
rooms
:
(
for
room
in
ROOM_all
when
room
and
room
.
established
roomsjson
=
[];
_async
.
each
(
ROOM_all
,
(
room
,
done
)
->
if
!
(
room
and
room
.
established
)
done
()
return
roomsjson
.
push
({
roomid
:
room
.
process_pid
.
toString
(),
roomname
:
if
pass_validated
then
room
.
name
else
room
.
name
.
split
(
'$'
,
2
)[
0
],
roommode
:
room
.
hostinfo
.
mode
,
...
...
@@ -3604,8 +3608,13 @@ if settings.modules.http
pos
:
player
.
pos
),
"pos"
),
istart
:
if
room
.
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
then
(
if
settings
.
modules
.
http
.
show_info
then
(
"Duel:"
+
room
.
duel_count
+
" "
+
(
if
room
.
duel_stage
==
ygopro
.
constants
.
DUEL_STAGE
.
SIDING
then
"Siding"
else
"Turn:"
+
(
if
room
.
turn
?
then
room
.
turn
else
0
)
+
(
if
room
.
death
then
"/"
+
(
if
room
.
death
>
0
then
room
.
death
-
1
else
"Death"
)
else
""
)))
else
'start'
)
else
'wait'
),
null
,
2
response
.
end
(
addCallback
(
u
.
query
.
callback
,
roomsjson
))
})
done
()
,
()
->
response
.
writeHead
(
200
)
response
.
end
(
addCallback
(
u
.
query
.
callback
,
JSON
.
stringify
({
rooms
:
roomsjson
})))
)
else
if
u
.
pathname
==
'/api/duellog'
and
settings
.
modules
.
tournament_mode
.
enabled
if
!
auth
.
auth
(
u
.
query
.
username
,
u
.
query
.
pass
,
"duel_log"
,
"duel_log"
)
...
...
ygopro-server.js
View file @
4ed935df
...
...
@@ -4575,7 +4575,7 @@
return
callback
+
"
(
"
+
text
+
"
);
"
;
};
requestListener
=
function
(
request
,
response
)
{
var
archive_args
,
archive_name
,
archive_process
,
check
,
death_room_found
,
duellog
,
error
,
filename
,
getpath
,
len2
,
len3
,
m
,
n
,
parseQueryString
,
pass_validated
,
player
,
ref2
,
replay
,
room
,
rooms
,
roomsjson
,
u
;
var
archive_args
,
archive_name
,
archive_process
,
check
,
death_room_found
,
duellog
,
error
,
filename
,
getpath
,
len2
,
len3
,
m
,
n
,
parseQueryString
,
pass_validated
,
ref2
,
replay
,
room
,
rooms
,
roomsjson
,
u
;
parseQueryString
=
true
;
u
=
url
.
parse
(
request
.
url
,
parseQueryString
);
if
(
u
.
pathname
===
'
/api/getrooms
'
)
{
...
...
@@ -4584,27 +4584,26 @@
response
.
writeHead
(
200
);
response
.
end
(
addCallback
(
u
.
query
.
callback
,
'
{"rooms":[{"roomid":"0","roomname":"密码错误","needpass":"true"}]}
'
));
}
else
{
response
.
writeHead
(
200
);
roomsjson
=
JSON
.
stringify
({
rooms
:
(
function
()
{
var
len2
,
m
,
results
;
results
=
[];
for
(
m
=
0
,
len2
=
ROOM_all
.
length
;
m
<
len2
;
m
++
)
{
room
=
ROOM_all
[
m
];
if
(
room
&&
room
.
established
)
{
results
.
push
({
roomsjson
=
[];
_async
.
each
(
ROOM_all
,
function
(
room
,
done
)
{
var
player
;
if
(
!
(
room
&&
room
.
established
))
{
done
();
return
;
}
roomsjson
.
push
({
roomid
:
room
.
process_pid
.
toString
(),
roomname
:
pass_validated
?
room
.
name
:
room
.
name
.
split
(
'
$
'
,
2
)[
0
],
roommode
:
room
.
hostinfo
.
mode
,
needpass
:
(
room
.
name
.
indexOf
(
'
$
'
)
!==
-
1
).
toString
(),
users
:
_
.
sortBy
((
function
()
{
var
len3
,
n
,
ref2
,
results1
;
var
len2
,
m
,
ref2
,
results
;
ref2
=
room
.
players
;
results1
=
[];
for
(
n
=
0
,
len3
=
ref2
.
length
;
n
<
len3
;
n
++
)
{
player
=
ref2
[
n
];
results
=
[];
for
(
m
=
0
,
len2
=
ref2
.
length
;
m
<
len2
;
m
++
)
{
player
=
ref2
[
m
];
if
(
player
.
pos
!=
null
)
{
results1
.
push
({
results
.
push
({
id
:
(
-
1
).
toString
(),
name
:
player
.
name
,
ip
:
settings
.
modules
.
http
.
show_ip
&&
pass_validated
&&
!
player
.
is_local
?
player
.
ip
.
slice
(
7
)
:
null
,
...
...
@@ -4617,16 +4616,17 @@
});
}
}
return
results1
;
return
results
;
})(),
"
pos
"
),
istart
:
room
.
duel_stage
!==
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
?
(
settings
.
modules
.
http
.
show_info
?
"
Duel:
"
+
room
.
duel_count
+
"
"
+
(
room
.
duel_stage
===
ygopro
.
constants
.
DUEL_STAGE
.
SIDING
?
"
Siding
"
:
"
Turn:
"
+
(
room
.
turn
!=
null
?
room
.
turn
:
0
)
+
(
room
.
death
?
"
/
"
+
(
room
.
death
>
0
?
room
.
death
-
1
:
"
Death
"
)
:
""
))
:
'
start
'
)
:
'
wait
'
});
}
}
return
results
;
})()
},
null
,
2
);
response
.
end
(
addCallback
(
u
.
query
.
callback
,
roomsjson
));
return
done
();
},
function
()
{
response
.
writeHead
(
200
);
return
response
.
end
(
addCallback
(
u
.
query
.
callback
,
JSON
.
stringify
({
rooms
:
roomsjson
})));
});
}
}
else
if
(
u
.
pathname
===
'
/api/duellog
'
&&
settings
.
modules
.
tournament_mode
.
enabled
)
{
if
(
!
auth
.
auth
(
u
.
query
.
username
,
u
.
query
.
pass
,
"
duel_log
"
,
"
duel_log
"
))
{
...
...
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