Skip to content

Commit ec8763b

Browse files
authored
Merge pull request workadventure#2975 from thecodingmachine/hotfix_jitsiroomadmintag
Fixing jitsiRoomAdminTag
2 parents 08bcfed + dfd4377 commit ec8763b

File tree

3 files changed

+151
-1
lines changed

3 files changed

+151
-1
lines changed

back/src/Services/SocketManager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,11 @@ export class SocketManager {
680680
if (user.tags.includes("admin")) {
681681
isAdmin = true;
682682
} else {
683-
const moderatorTag = await gameRoom.getModeratorTagForJitsiRoom(jitsiRoom);
683+
// Let's remove the prefix added by the front to make the Jitsi room unique:
684+
// Note: this is not 100% perfect as this will fail on Jitsi rooms with "NoPrefix" option set and containing a "-" in the room name.
685+
const jitsiRoomSuffix = jitsiRoom.match(/\w*-(.+)/);
686+
const finalRoomName = jitsiRoomSuffix && jitsiRoomSuffix[1] ? jitsiRoomSuffix[1] : jitsiRoom;
687+
const moderatorTag = await gameRoom.getModeratorTagForJitsiRoom(finalRoomName);
684688
if (moderatorTag && user.tags.includes(moderatorTag)) {
685689
isAdmin = true;
686690
}

maps/tests/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,14 @@ <h2>CoWebsite</h2>
478478
<a href="#" class="testLink" data-testmap="CoWebsite/cowebsite_jitsiroom.json" target="_blank">Open co-websites and Jitsi room by layer properties</a>
479479
</td>
480480
</tr>
481+
<tr>
482+
<td>
483+
<input type="radio" name="test-jitsi_room_admin_tag"> Success <input type="radio" name="test-jitsi_room_admin_tag"> Failure <input type="radio" name="test-jitsi_room_admin_tag" checked> Pending
484+
</td>
485+
<td>
486+
<a href="#" class="testLink" data-testmap="jitsi_room_admin_tag.json" target="_blank">Test moderation of Jitsi rooms <i>Requires an admin and a non local environment</i></a>
487+
</td>
488+
</tr>
481489
</table>
482490
<h2>Pathfinding</h2>
483491
<table class="table">
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
{ "compressionlevel":-1,
2+
"height":10,
3+
"infinite":false,
4+
"layers":[
5+
{
6+
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
8+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
9+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
10+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
12+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
13+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
14+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
15+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
16+
"height":10,
17+
"id":1,
18+
"name":"floor",
19+
"opacity":1,
20+
"type":"tilelayer",
21+
"visible":true,
22+
"width":10,
23+
"x":0,
24+
"y":0
25+
},
26+
{
27+
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
28+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
30+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
31+
12, 0, 0, 0, 0, 0, 0, 0, 0, 0,
32+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
33+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
34+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
37+
"height":10,
38+
"id":2,
39+
"name":"start",
40+
"opacity":1,
41+
"type":"tilelayer",
42+
"visible":true,
43+
"width":10,
44+
"x":0,
45+
"y":0
46+
},
47+
{
48+
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50+
0, 0, 0, 0, 0, 34, 34, 34, 34, 34,
51+
0, 0, 0, 0, 0, 34, 34, 34, 34, 34,
52+
0, 0, 0, 0, 0, 34, 34, 34, 34, 34,
53+
0, 0, 0, 0, 0, 34, 34, 34, 34, 34,
54+
0, 0, 0, 0, 0, 34, 34, 34, 34, 34,
55+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
58+
"height":10,
59+
"id":5,
60+
"name":"jitsiConf",
61+
"opacity":1,
62+
"properties":[
63+
{
64+
"name":"jitsiRoom",
65+
"type":"string",
66+
"value":"myRoom"
67+
},
68+
{
69+
"name":"jitsiRoomAdminTag",
70+
"type":"string",
71+
"value":"speaker"
72+
}],
73+
"type":"tilelayer",
74+
"visible":true,
75+
"width":10,
76+
"x":0,
77+
"y":0
78+
},
79+
{
80+
"draworder":"topdown",
81+
"id":3,
82+
"name":"floorLayer",
83+
"objects":[
84+
{
85+
"class":"",
86+
"height":163.652982988579,
87+
"id":1,
88+
"name":"",
89+
"properties":[
90+
{
91+
"name":"font-family",
92+
"type":"string",
93+
"value":"\"Press Start 2P\""
94+
}],
95+
"rotation":0,
96+
"text":
97+
{
98+
"fontfamily":"Sans Serif",
99+
"pixelsize":8,
100+
"text":"Test:\nTo be done with the admin: create a room in the admin referencing this map. Create a member with the \"speaker\" tag.\nGo to that room.\n\nNote: you cannot perform this test if the room is hosted locally.\n\nResult:\nJitsi opens in moderator mode.",
101+
"wrap":true
102+
},
103+
"visible":true,
104+
"width":317.361946929159,
105+
"x":2.32853056864467,
106+
"y":2.25624950083909
107+
}],
108+
"opacity":1,
109+
"type":"objectgroup",
110+
"visible":true,
111+
"x":0,
112+
"y":0
113+
}],
114+
"nextlayerid":6,
115+
"nextobjectid":2,
116+
"orientation":"orthogonal",
117+
"renderorder":"right-down",
118+
"tiledversion":"1.9.2",
119+
"tileheight":32,
120+
"tilesets":[
121+
{
122+
"columns":11,
123+
"firstgid":1,
124+
"image":"tileset1.png",
125+
"imageheight":352,
126+
"imagewidth":352,
127+
"margin":0,
128+
"name":"tileset1",
129+
"spacing":0,
130+
"tilecount":121,
131+
"tileheight":32,
132+
"tilewidth":32
133+
}],
134+
"tilewidth":32,
135+
"type":"map",
136+
"version":"1.9",
137+
"width":10
138+
}

0 commit comments

Comments
 (0)