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)->
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
clients
=
new
Set
()
init
=
(
http_server
,
ROOM_all
)
->
server
=
new
WebSocketServer
server
:
http_server
...
...
@@ -21,6 +23,8 @@ init = (http_server, ROOM_all)->
connection
.
send
JSON
.
stringify
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'
))
clients
.
add
connection
connection
.
on
(
'close'
,
()
->
clients
.
delete
connection
if
clients
.
has
connection
)
create
=
(
room
)
->
broadcast
(
'create'
,
room_data
(
room
),
'waiting'
)
if
!
room
.
private
...
...
@@ -43,7 +47,7 @@ broadcast = (event, data, filter)->
message
=
JSON
.
stringify
event
:
event
data
:
data
for
connection
in
server
.
clients
when
connection
.
filter
==
filter
for
connection
in
Array
.
from
(
clients
.
values
())
when
connection
.
filter
==
filter
try
connection
.
send
message
...
...
roomlist.js
View file @
829ee179
// Generated by CoffeeScript 2.6.1
(
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
;
...
...
@@ -36,6 +36,8 @@
};
};
clients
=
new
Set
();
init
=
function
(
http_server
,
ROOM_all
)
{
server
=
new
WebSocketServer
({
server
:
http_server
...
...
@@ -43,7 +45,7 @@
return
server
.
on
(
'
connection
'
,
function
(
connection
,
upgradeReq
)
{
var
room
;
connection
.
filter
=
url
.
parse
(
upgradeReq
.
url
,
true
).
query
.
filter
||
'
waiting
'
;
return
connection
.
send
(
JSON
.
stringify
({
connection
.
send
(
JSON
.
stringify
({
event
:
'
init
'
,
data
:
(
function
()
{
var
i
,
len
,
results
;
...
...
@@ -57,6 +59,12 @@
return
results
;
})()
}));
clients
.
add
(
connection
);
return
connection
.
on
(
'
close
'
,
function
()
{
if
(
clients
.
has
(
connection
))
{
return
clients
.
delete
(
connection
);
}
});
});
};
...
...
@@ -98,7 +106,7 @@
event
:
event
,
data
:
data
});
ref
=
server
.
clients
;
ref
=
Array
.
from
(
clients
.
values
())
;
results
=
[];
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
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