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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
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
332d7b01
Commit
332d7b01
authored
Aug 09, 2015
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add jsonp room list for test
parent
6b4d745d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
7 deletions
+53
-7
ygopro-server.coffee
ygopro-server.coffee
+14
-3
ygopro-server.js
ygopro-server.js
+39
-4
No files found.
ygopro-server.coffee
View file @
332d7b01
...
@@ -569,9 +569,20 @@ if settings.modules.http
...
@@ -569,9 +569,20 @@ if settings.modules.http
index
=
waiting
[
level
].
indexOf
(
response
)
index
=
waiting
[
level
].
indexOf
(
response
)
waiting
[
level
].
splice
(
index
,
1
)
unless
index
==
-
1
waiting
[
level
].
splice
(
index
,
1
)
unless
index
==
-
1
else
if
u
.
pathname
==
'/rooms.json'
else
if
u
.
pathname
==
'/rooms.js'
response
.
writeHead
(
404
);
response
.
writeHead
(
200
);
response
.
end
();
roomsjson
=
JSON
.
stringify
rooms
:
(
for
room
in
Room
.
all
when
room
.
established
roomid
:
room
.
port
.
toString
(),
roomname
:
room
.
name
.
split
(
'$'
,
2
)[
0
],
needpass
:
(
room
.
name
.
indexOf
(
'$'
)
!=
-
1
).
toString
(),
users
:
(
for
player
in
room
.
players
when
player
.
pos
?
id
:
(
-
1
).
toString
(),
name
:
player
.
name
,
pos
:
player
.
pos
),
istart
:
if
room
.
started
then
'start'
else
'wait'
)
response
.
end
(
"loadroom( { "
+
roomsjson
+
" } );"
);
else
if
u
.
query
==
'operation=getroomjson'
else
if
u
.
query
==
'operation=getroomjson'
response
.
writeHead
(
200
);
response
.
writeHead
(
200
);
response
.
end
JSON
.
stringify
rooms
:
(
for
room
in
Room
.
all
when
room
.
established
response
.
end
JSON
.
stringify
rooms
:
(
for
room
in
Room
.
all
when
room
.
established
...
...
ygopro-server.js
View file @
332d7b01
...
@@ -695,7 +695,7 @@
...
@@ -695,7 +695,7 @@
}
}
log
.
info
(
'
level_points loaded
'
,
level_points
);
log
.
info
(
'
level_points loaded
'
,
level_points
);
http_server
=
http
.
createServer
(
function
(
request
,
response
)
{
http_server
=
http
.
createServer
(
function
(
request
,
response
)
{
var
level
,
name
,
password
,
player
,
ref
,
ref1
,
room
,
u
;
var
level
,
name
,
password
,
player
,
ref
,
ref1
,
room
,
roomsjson
,
u
;
u
=
url
.
parse
(
request
.
url
);
u
=
url
.
parse
(
request
.
url
);
if
(
u
.
pathname
===
'
/count.json
'
)
{
if
(
u
.
pathname
===
'
/count.json
'
)
{
response
.
writeHead
(
200
);
response
.
writeHead
(
200
);
...
@@ -744,9 +744,44 @@
...
@@ -744,9 +744,44 @@
}
}
});
});
}
}
}
else
if
(
u
.
pathname
===
'
/rooms.json
'
)
{
}
else
if
(
u
.
pathname
===
'
/rooms.js
'
)
{
response
.
writeHead
(
404
);
response
.
writeHead
(
200
);
return
response
.
end
();
roomsjson
=
JSON
.
stringify
({
rooms
:
(
function
()
{
var
j
,
len
,
ref2
,
results
;
ref2
=
Room
.
all
;
results
=
[];
for
(
j
=
0
,
len
=
ref2
.
length
;
j
<
len
;
j
++
)
{
room
=
ref2
[
j
];
if
(
room
.
established
)
{
results
.
push
({
roomid
:
room
.
port
.
toString
(),
roomname
:
room
.
name
.
split
(
'
$
'
,
2
)[
0
],
needpass
:
(
room
.
name
.
indexOf
(
'
$
'
)
!==
-
1
).
toString
(),
users
:
(
function
()
{
var
k
,
len1
,
ref3
,
results1
;
ref3
=
room
.
players
;
results1
=
[];
for
(
k
=
0
,
len1
=
ref3
.
length
;
k
<
len1
;
k
++
)
{
player
=
ref3
[
k
];
if
(
player
.
pos
!=
null
)
{
results1
.
push
({
id
:
(
-
1
).
toString
(),
name
:
player
.
name
,
pos
:
player
.
pos
});
}
}
return
results1
;
})(),
istart
:
room
.
started
?
'
start
'
:
'
wait
'
});
}
}
return
results
;
})()
});
return
response
.
end
(
"
loadroom( {
"
+
roomsjson
+
"
} );
"
);
}
else
if
(
u
.
query
===
'
operation=getroomjson
'
)
{
}
else
if
(
u
.
query
===
'
operation=getroomjson
'
)
{
response
.
writeHead
(
200
);
response
.
writeHead
(
200
);
return
response
.
end
(
JSON
.
stringify
({
return
response
.
end
(
JSON
.
stringify
({
...
...
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