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
829ee179
Commit
829ee179
authored
Nov 02, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix roomlist broadcast
parent
4ac3f97b
Pipeline
#17710
passed with stages
in 11 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
roomlist.coffee
roomlist.coffee
+5
-1
roomlist.js
roomlist.js
+11
-3
No files found.
roomlist.coffee
View file @
829ee179
...
@@ -12,6 +12,8 @@ room_data = (room)->
...
@@ -12,6 +12,8 @@ room_data = (room)->
options
:
room
.
get_roomlist_hostinfo
(),
# Should be updated when MyCard client updates
options
:
room
.
get_roomlist_hostinfo
(),
# Should be updated when MyCard client updates
arena
:
settings
.
modules
.
arena_mode
.
enabled
&&
room
.
arena
&&
settings
.
modules
.
arena_mode
.
mode
arena
:
settings
.
modules
.
arena_mode
.
enabled
&&
room
.
arena
&&
settings
.
modules
.
arena_mode
.
mode
clients
=
new
Set
()
init
=
(
http_server
,
ROOM_all
)
->
init
=
(
http_server
,
ROOM_all
)
->
server
=
new
WebSocketServer
server
=
new
WebSocketServer
server
:
http_server
server
:
http_server
...
@@ -21,6 +23,8 @@ init = (http_server, ROOM_all)->
...
@@ -21,6 +23,8 @@ init = (http_server, ROOM_all)->
connection
.
send
JSON
.
stringify
connection
.
send
JSON
.
stringify
event
:
'init'
event
:
'init'
data
:
room_data
(
room
)
for
room
in
ROOM_all
when
room
and
room
.
established
and
(
connection
.
filter
==
'started'
or
!
room
.
private
)
and
((
room
.
duel_stage
!=
0
)
==
(
connection
.
filter
==
'started'
))
data
:
room_data
(
room
)
for
room
in
ROOM_all
when
room
and
room
.
established
and
(
connection
.
filter
==
'started'
or
!
room
.
private
)
and
((
room
.
duel_stage
!=
0
)
==
(
connection
.
filter
==
'started'
))
clients
.
add
connection
connection
.
on
(
'close'
,
()
->
clients
.
delete
connection
if
clients
.
has
connection
)
create
=
(
room
)
->
create
=
(
room
)
->
broadcast
(
'create'
,
room_data
(
room
),
'waiting'
)
if
!
room
.
private
broadcast
(
'create'
,
room_data
(
room
),
'waiting'
)
if
!
room
.
private
...
@@ -43,7 +47,7 @@ broadcast = (event, data, filter)->
...
@@ -43,7 +47,7 @@ broadcast = (event, data, filter)->
message
=
JSON
.
stringify
message
=
JSON
.
stringify
event
:
event
event
:
event
data
:
data
data
:
data
for
connection
in
server
.
clients
when
connection
.
filter
==
filter
for
connection
in
Array
.
from
(
clients
.
values
())
when
connection
.
filter
==
filter
try
try
connection
.
send
message
connection
.
send
message
...
...
roomlist.js
View file @
829ee179
// Generated by CoffeeScript 2.6.1
// Generated by CoffeeScript 2.6.1
(
function
()
{
(
function
()
{
var
WebSocketServer
,
_delete
,
broadcast
,
create
,
init
,
room_data
,
server
,
settings
,
start
,
update
,
url
;
var
WebSocketServer
,
_delete
,
broadcast
,
c
lients
,
c
reate
,
init
,
room_data
,
server
,
settings
,
start
,
update
,
url
;
WebSocketServer
=
require
(
'
ws
'
).
Server
;
WebSocketServer
=
require
(
'
ws
'
).
Server
;
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
};
};
};
};
clients
=
new
Set
();
init
=
function
(
http_server
,
ROOM_all
)
{
init
=
function
(
http_server
,
ROOM_all
)
{
server
=
new
WebSocketServer
({
server
=
new
WebSocketServer
({
server
:
http_server
server
:
http_server
...
@@ -43,7 +45,7 @@
...
@@ -43,7 +45,7 @@
return
server
.
on
(
'
connection
'
,
function
(
connection
,
upgradeReq
)
{
return
server
.
on
(
'
connection
'
,
function
(
connection
,
upgradeReq
)
{
var
room
;
var
room
;
connection
.
filter
=
url
.
parse
(
upgradeReq
.
url
,
true
).
query
.
filter
||
'
waiting
'
;
connection
.
filter
=
url
.
parse
(
upgradeReq
.
url
,
true
).
query
.
filter
||
'
waiting
'
;
return
connection
.
send
(
JSON
.
stringify
({
connection
.
send
(
JSON
.
stringify
({
event
:
'
init
'
,
event
:
'
init
'
,
data
:
(
function
()
{
data
:
(
function
()
{
var
i
,
len
,
results
;
var
i
,
len
,
results
;
...
@@ -57,6 +59,12 @@
...
@@ -57,6 +59,12 @@
return
results
;
return
results
;
})()
})()
}));
}));
clients
.
add
(
connection
);
return
connection
.
on
(
'
close
'
,
function
()
{
if
(
clients
.
has
(
connection
))
{
return
clients
.
delete
(
connection
);
}
});
});
});
};
};
...
@@ -98,7 +106,7 @@
...
@@ -98,7 +106,7 @@
event
:
event
,
event
:
event
,
data
:
data
data
:
data
});
});
ref
=
server
.
clients
;
ref
=
Array
.
from
(
clients
.
values
())
;
results
=
[];
results
=
[];
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
connection
=
ref
[
i
];
connection
=
ref
[
i
];
...
...
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