Use set in lua

This commit is contained in:
qvalentin 2023-02-05 17:10:16 +01:00
parent 76d6dfc263
commit 7c8394f0fd
4 changed files with 23 additions and 12 deletions

View File

@ -165,6 +165,8 @@ services:
# custom
ports:
- 5280:5280
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ${CONFIG}/prosody/config:/config:Z
- ${CONFIG}/prosody/prosody-plugins-custom:/prosody-plugins-custom:Z

View File

@ -0,0 +1 @@
sudo chmod 666 jitsi-meet-cfg/prosody/prosody-plugins-custom/mod_jitsi_rooms.lua

View File

@ -30,7 +30,7 @@ function get_participants_for_room(room_name)
occupants_json:push({
jid = tostring(occupant.nick),
email = tostring(email),
display_name = tostring(nick),
displayName = tostring(nick),
avatarURL = tostring(avatarURL)
});
end
@ -55,12 +55,16 @@ function get_all_rooms_with_participants()
local roomNames = {}
for _, v in pairs(actual_rooms) do
table.insert(roomNames, v["jitsi_web_query_room"])
local roomName = v["jitsi_web_query_room"]
if (roomName ~= nil) then
roomNames[roomName] = true;
end
end
local rooms_with_participants = {}
for _, room_name in pairs(roomNames) do
rooms_with_participants[room_name] = get_participants_for_room(room_name)
local rooms_with_participants = array();
for room_name, _ in pairs(roomNames) do
local room = { roomName = room_name, participants = get_participants_for_room(room_name) }
rooms_with_participants:push(room)
end
return json.encode(rooms_with_participants)
end
@ -143,7 +147,7 @@ function handle_room_event(event)
return;
end
async_http_request("https://www.toptal.com/developers/postbin/1673793686086-1283829133026",
async_http_request("http://192.168.2.116:8081/roomdata",
{
method = "POST",
body = get_all_rooms_with_participants()

View File

@ -30,7 +30,7 @@ function get_participants_for_room(room_name)
occupants_json:push({
jid = tostring(occupant.nick),
email = tostring(email),
display_name = tostring(nick),
displayName = tostring(nick),
avatarURL = tostring(avatarURL)
});
end
@ -55,12 +55,16 @@ function get_all_rooms_with_participants()
local roomNames = {}
for _, v in pairs(actual_rooms) do
table.insert(roomNames, v["jitsi_web_query_room"])
local roomName = v["jitsi_web_query_room"]
if (roomName ~= nil) then
roomNames[roomName] = true;
end
end
local rooms_with_participants = {}
for _, room_name in pairs(roomNames) do
rooms_with_participants[room_name] = get_participants_for_room(room_name)
local rooms_with_participants = array();
for room_name, _ in pairs(roomNames) do
local room = { roomName = room_name, participants = get_participants_for_room(room_name) }
rooms_with_participants:push(room)
end
return json.encode(rooms_with_participants)
end
@ -143,7 +147,7 @@ function handle_room_event(event)
return;
end
async_http_request("https://www.toptal.com/developers/postbin/1673793686086-1283829133026",
async_http_request("http://192.168.2.116:8081/roomdata",
{
method = "POST",
body = get_all_rooms_with_participants()