fix url encoding in prosody module
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
77a00e68e9
commit
e21ca799d6
0
prodsody/fix-permissions.sh
Normal file → Executable file
0
prodsody/fix-permissions.sh
Normal file → Executable file
|
@ -4,6 +4,7 @@ local json = require "util.json";
|
||||||
local array = require "util.array";
|
local array = require "util.array";
|
||||||
local iterators = require "util.iterators";
|
local iterators = require "util.iterators";
|
||||||
local jid = require "util.jid";
|
local jid = require "util.jid";
|
||||||
|
local http = require "util.http";
|
||||||
|
|
||||||
local async_handler_wrapper = module:require "util".async_handler_wrapper;
|
local async_handler_wrapper = module:require "util".async_handler_wrapper;
|
||||||
local get_room_from_jid = module:require "util".get_room_from_jid;
|
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)
|
function get_participants_for_room(room_name)
|
||||||
|
|
||||||
local room_address = jid.join(room_name, muc_domain_prefix .. "." .. domain_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();
|
local occupants_json = array();
|
||||||
if room then
|
if room then
|
||||||
local occupants = room._occupants;
|
local occupants = room._occupants;
|
||||||
|
@ -47,7 +48,6 @@ function get_participants_for_room(room_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_all_rooms_with_participants()
|
function get_all_rooms_with_participants()
|
||||||
|
|
||||||
local sessions = prosody.full_sessions;
|
local sessions = prosody.full_sessions;
|
||||||
|
|
||||||
local someTable = (it.join(it.keys(sessions)));
|
local someTable = (it.join(it.keys(sessions)));
|
||||||
|
@ -74,7 +74,7 @@ end
|
||||||
-- @return GET response, containing a json with participants details
|
-- @return GET response, containing a json with participants details
|
||||||
function handle_get_sessions(event)
|
function handle_get_sessions(event)
|
||||||
handle_room_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
|
end
|
||||||
|
|
||||||
function module.load()
|
function module.load()
|
||||||
|
@ -86,9 +86,9 @@ function module.load()
|
||||||
module:log("info", "Hello! You can reach me at: %s", module:http_url());
|
module:log("info", "Hello! You can reach me at: %s", module:http_url());
|
||||||
module:provides("http", {
|
module:provides("http", {
|
||||||
route = {
|
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
|
end
|
||||||
|
|
||||||
|
@ -125,7 +125,6 @@ end
|
||||||
|
|
||||||
--- Checks if event is triggered by healthchecks or focus user.
|
--- Checks if event is triggered by healthchecks or focus user.
|
||||||
function is_system_event(event)
|
function is_system_event(event)
|
||||||
|
|
||||||
if event == nil or event.room == nil or event.room.jid == nil then
|
if event == nil or event.room == nil or event.room.jid == nil then
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
|
@ -147,12 +146,11 @@ function handle_room_event(event)
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
async_http_request("http://192.168.2.116:8081/roomdata",
|
async_http_request("http://jitsi-rooms:8081/roomdata",
|
||||||
{
|
{
|
||||||
method = "POST",
|
method = "POST",
|
||||||
body = get_all_rooms_with_participants()
|
body = get_all_rooms_with_participants()
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--Helper function to wait till a component is loaded before running the given callback
|
--Helper function to wait till a component is loaded before running the given callback
|
||||||
|
|
Loading…
Reference in a new issue