diff --git a/prodsody/Readme.md b/prodsody/Readme.md index 65ebf87..959a162 100644 --- a/prodsody/Readme.md +++ b/prodsody/Readme.md @@ -10,7 +10,7 @@ ### Get started - run `./run_dev.sh` -- open [https://localhost:8443/](https://localhost:8443/) +- open [https://localhost:8443/](https://localhost:8443/) (accept the risk about self-signed certs) - make changes to mod_jitsi_rooms.lua and save the file - prosody will be restarted - join a room in jitsi diff --git a/prodsody/docker-compose.yml b/prodsody/docker-compose.yml index 08feefc..0c4a04b 100644 --- a/prodsody/docker-compose.yml +++ b/prodsody/docker-compose.yml @@ -347,7 +347,7 @@ services: meet.jitsi: jitsi-rooms: - image: jitsi-rooms:67y5d9y2zbi7wkqm2jpcjj1k2614qwx2 + image: jitsi-rooms restart: ${RESTART_POLICY:-unless-stopped} ports: - '9160:9160' diff --git a/prodsody/mod_jitsi_rooms.lua b/prodsody/mod_jitsi_rooms.lua index dde9499..cfe138b 100644 --- a/prodsody/mod_jitsi_rooms.lua +++ b/prodsody/mod_jitsi_rooms.lua @@ -4,6 +4,7 @@ local json = require "util.json"; local array = require "util.array"; local iterators = require "util.iterators"; local jid = require "util.jid"; +local http = require "util.http"; local async_handler_wrapper = module:require "util".async_handler_wrapper; local get_room_from_jid = module:require "util".get_room_from_jid; @@ -12,9 +13,9 @@ local domain_name = "meet.jitsi" function get_participants_for_room(room_name) - local room_address = jid.join(room_name, muc_domain_prefix .. "." .. domain_name); - local room = get_room_from_jid(room_address); + local decoded_room_address = http.urldecode(room_address); + local room = get_room_from_jid(decoded_room_address); local occupants_json = array(); if room then local occupants = room._occupants; @@ -47,7 +48,6 @@ function get_participants_for_room(room_name) end function get_all_rooms_with_participants() - local sessions = prosody.full_sessions; local someTable = (it.join(it.keys(sessions))); @@ -74,7 +74,7 @@ end -- @return GET response, containing a json with participants details function handle_get_sessions(event) handle_room_event() - return { status_code = 200; body = get_all_rooms_with_participants() }; + return { status_code = 200, body = get_all_rooms_with_participants() }; end function module.load() @@ -86,9 +86,9 @@ function module.load() module:log("info", "Hello! You can reach me at: %s", module:http_url()); module:provides("http", { route = { - ["GET"] = function(event) return async_handler_wrapper(event, handle_get_sessions) end; + ["GET"] = function(event) return async_handler_wrapper(event, handle_get_sessions) end, - }; + }, }); end @@ -125,7 +125,6 @@ end --- Checks if event is triggered by healthchecks or focus user. function is_system_event(event) - if event == nil or event.room == nil or event.room.jid == nil then return true; end @@ -147,12 +146,11 @@ function handle_room_event(event) return; end - async_http_request("http://192.168.2.116:8081/roomdata", + async_http_request("http://jitsi-rooms:8081/roomdata", { method = "POST", body = get_all_rooms_with_participants() }) - end --Helper function to wait till a component is loaded before running the given callback