mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
feat(prosody): Simplifies modules that need to add identity.
This commit is contained in:
@@ -58,28 +58,21 @@ VirtualHost "jitmeet.example.com"
|
||||
key = "/etc/prosody/certs/jitmeet.example.com.key";
|
||||
certificate = "/etc/prosody/certs/jitmeet.example.com.crt";
|
||||
}
|
||||
av_moderation_component = "avmoderation.jitmeet.example.com"
|
||||
speakerstats_component = "speakerstats.jitmeet.example.com"
|
||||
end_conference_component = "endconference.jitmeet.example.com"
|
||||
-- we need bosh
|
||||
modules_enabled = {
|
||||
"bosh";
|
||||
"websocket";
|
||||
"smacks";
|
||||
"ping"; -- Enable mod_ping
|
||||
"speakerstats";
|
||||
"external_services";
|
||||
"features_identity";
|
||||
"conference_duration";
|
||||
"end_conference";
|
||||
"muc_lobby_rooms";
|
||||
"muc_breakout_rooms";
|
||||
"av_moderation";
|
||||
"room_metadata";
|
||||
}
|
||||
c2s_require_encryption = false
|
||||
lobby_muc = "lobby.jitmeet.example.com"
|
||||
breakout_rooms_muc = "breakout.jitmeet.example.com"
|
||||
room_metadata_component = "metadata.jitmeet.example.com"
|
||||
main_muc = "conference.jitmeet.example.com"
|
||||
-- muc_lobby_whitelist = { "recorder.jitmeet.example.com" } -- Here we can whitelist jibri to enter lobby enabled rooms
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local avmoderation_component = module:get_option_string('av_moderation_component', 'avmoderation.'..module.host);
|
||||
-- TODO: Remove this file after several stable releases when people update their configs
|
||||
module:log('warn', 'mod_av_moderation is deprecated and will be removed in a future release. '
|
||||
.. 'Please update your config by removing this module from the list of loaded modules.');
|
||||
|
||||
-- Advertise AV Moderation so client can pick up the address and use it
|
||||
module:add_identity('component', 'av_moderation', avmoderation_component);
|
||||
|
||||
module:depends("jitsi_session");
|
||||
module:depends('jitsi_session');
|
||||
module:depends('features_identity');
|
||||
|
||||
@@ -15,6 +15,12 @@ if muc_component_host == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
local main_virtual_host = module:get_option_string('muc_mapper_domain_base');
|
||||
if not main_virtual_host then
|
||||
module:log('warn', 'No "muc_mapper_domain_base" option set, disabling AV moderation.');
|
||||
return ;
|
||||
end
|
||||
|
||||
module:log('info', 'Starting av_moderation for %s', muc_component_host);
|
||||
|
||||
-- Returns the index of the given element in the table
|
||||
@@ -357,3 +363,9 @@ process_host_module(muc_component_host, function(host_module, host)
|
||||
host_module:hook('muc-occupant-joined', occupant_joined, -2); -- make sure it runs after allowners or similar
|
||||
host_module:hook('muc-set-affiliation', occupant_affiliation_changed, -1);
|
||||
end);
|
||||
|
||||
process_host_module(main_virtual_host, function(host_module)
|
||||
module:context(host_module.host):fire_event('jitsi-add-identity', {
|
||||
name = 'av_moderation'; host = module.host;
|
||||
});
|
||||
end);
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
-- This module is added under the main virtual host domain
|
||||
--
|
||||
-- VirtualHost "jitmeet.example.com"
|
||||
-- modules_enabled = {
|
||||
-- "end_conference"
|
||||
-- }
|
||||
-- end_conference_component = "endconference.jitmeet.example.com"
|
||||
--
|
||||
-- Component "endconference.jitmeet.example.com" "end_conference"
|
||||
-- muc_component = muc.jitmeet.example.com
|
||||
--
|
||||
local get_room_by_name_and_subdomain = module:require 'util'.get_room_by_name_and_subdomain;
|
||||
local util = module:require 'util';
|
||||
local get_room_by_name_and_subdomain = util.get_room_by_name_and_subdomain;
|
||||
local process_host_module = util.process_host_module;
|
||||
|
||||
local END_CONFERENCE_REASON = 'The meeting has been terminated';
|
||||
|
||||
-- Since this file serves as both the host module and the component, we rely on the assumption that
|
||||
-- end_conference_component var would only be define for the host and not in the end_conference component
|
||||
-- TODO: Remove this if block after several stable releases when people update their configs
|
||||
local end_conference_component = module:get_option_string('end_conference_component');
|
||||
if end_conference_component then
|
||||
-- Advertise end conference so client can pick up the address and use it
|
||||
module:add_identity('component', 'end_conference', end_conference_component);
|
||||
module:log('warn', 'Please update your config by removing muc_end_conference module from '
|
||||
.. 'the list of loaded modules in the main virtual host.');
|
||||
module:depends("features_identity");
|
||||
return; -- nothing left to do if called as host module
|
||||
end
|
||||
|
||||
@@ -32,6 +29,12 @@ if muc_component_host == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
local main_virtual_host = module:get_option_string('muc_mapper_domain_base');
|
||||
if not main_virtual_host then
|
||||
module:log('warn', 'No "muc_mapper_domain_base" option set, disabling AV moderation.');
|
||||
return ;
|
||||
end
|
||||
|
||||
module:log('info', 'Starting end_conference for %s', muc_component_host);
|
||||
|
||||
-- receives messages from clients to the component to end a conference
|
||||
@@ -84,3 +87,9 @@ end
|
||||
|
||||
-- we will receive messages from the clients
|
||||
module:hook('message/host', on_message);
|
||||
|
||||
process_host_module(main_virtual_host, function(host_module)
|
||||
module:context(host_module.host):fire_event('jitsi-add-identity', {
|
||||
name = 'end_conference'; host = module.host;
|
||||
});
|
||||
end);
|
||||
|
||||
8
resources/prosody-plugins/mod_features_identity.lua
Normal file
8
resources/prosody-plugins/mod_features_identity.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Other components can use the event 'jitsi-add-identity' to attach identity which
|
||||
-- will be advertised by the main virtual host and discovered by clients.
|
||||
-- With this we avoid having an almost empty module to just add identity with an extra config
|
||||
|
||||
module:hook('jitsi-add-identity', function(event)
|
||||
module:log('info', 'Adding identity %s for host %s', event.name, event.host);
|
||||
module:add_identity('component', event.name, event.host);
|
||||
end);
|
||||
@@ -1,10 +1,6 @@
|
||||
-- Generic room metadata
|
||||
-- See mod_room_metadata_component.lua
|
||||
|
||||
local COMPONENT_IDENTITY_TYPE = 'room_metadata';
|
||||
local room_metadata_component_host = module:get_option_string('room_metadata_component', 'metadata.'..module.host);
|
||||
-- TODO: Remove this file after several stable releases when people update their configs
|
||||
module:log('warn', 'mod_room_metadata is deprecated and will be removed in a future release. '
|
||||
.. 'Please update your config by removing this module from the list of loaded modules.');
|
||||
|
||||
module:depends("jitsi_session");
|
||||
|
||||
-- Advertise the component so clients can pick up the address and use it
|
||||
module:add_identity('component', COMPONENT_IDENTITY_TYPE, room_metadata_component_host);
|
||||
module:depends("features_identity");
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
-- This module implements a generic metadata storage system for rooms.
|
||||
--
|
||||
-- VirtualHost "jitmeet.example.com"
|
||||
-- modules_enabled = {
|
||||
-- "room_metadata"
|
||||
-- }
|
||||
-- room_metadata_component = "metadata.jitmeet.example.com"
|
||||
-- main_muc = "conference.jitmeet.example.com"
|
||||
--
|
||||
-- Component "metadata.jitmeet.example.com" "room_metadata_component"
|
||||
-- muc_component = "conference.jitmeet.example.com"
|
||||
-- breakout_rooms_component = "breakout.jitmeet.example.com"
|
||||
@@ -37,9 +30,9 @@ if muc_component_host == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
local muc_domain_base = module:get_option_string('muc_mapper_domain_base');
|
||||
if not muc_domain_base then
|
||||
module:log('warn', 'No muc_domain_base option set.');
|
||||
local main_virtual_host = module:get_option_string('muc_mapper_domain_base');
|
||||
if not main_virtual_host then
|
||||
module:log('warn', 'No muc_mapper_domain_base option set.');
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -182,7 +175,7 @@ function on_message(event)
|
||||
|
||||
if occupant.role ~= 'moderator' then
|
||||
-- will return a non nil filtered data to use, if it is nil, it is not allowed
|
||||
local res = module:context(muc_domain_base):fire_event('jitsi-metadata-allow-moderation',
|
||||
local res = module:context(main_virtual_host):fire_event('jitsi-metadata-allow-moderation',
|
||||
{ room = room; actor = occupant; key = jsonData.key ; data = jsonData.data; session = session; });
|
||||
|
||||
if not res then
|
||||
@@ -342,3 +335,9 @@ end
|
||||
|
||||
-- enable filtering presences
|
||||
filters.add_filter_hook(filter_session);
|
||||
|
||||
process_host_module(main_virtual_host, function(host_module)
|
||||
module:context(host_module.host):fire_event('jitsi-add-identity', {
|
||||
name = 'room_metadata'; host = module.host;
|
||||
});
|
||||
end);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local speakerstats_component
|
||||
= module:get_option_string("speakerstats_component", "speakerstats."..module.host);
|
||||
-- TODO: Remove this file after several stable releases when people update their configs
|
||||
module:log('warn', 'mod_speakerstats is deprecated and will be removed in a future release. '
|
||||
.. 'Please update your config by removing this module from the list of loaded modules.');
|
||||
|
||||
-- Advertise speaker stats so client can pick up the address and start sending
|
||||
-- dominant speaker events
|
||||
module:add_identity("component", "speakerstats", speakerstats_component);
|
||||
module:depends('jitsi_session');
|
||||
module:depends('features_identity');
|
||||
|
||||
@@ -20,13 +20,13 @@ if not have_async then
|
||||
end
|
||||
|
||||
local muc_component_host = module:get_option_string("muc_component");
|
||||
local muc_domain_base = module:get_option_string("muc_mapper_domain_base");
|
||||
local main_virtual_host = module:get_option_string("muc_mapper_domain_base");
|
||||
|
||||
if muc_component_host == nil or muc_domain_base == nil then
|
||||
if muc_component_host == nil or main_virtual_host == nil then
|
||||
module:log("error", "No muc_component specified. No muc to operate on!");
|
||||
return;
|
||||
end
|
||||
local breakout_room_component_host = "breakout." .. muc_domain_base;
|
||||
local breakout_room_component_host = "breakout." .. main_virtual_host;
|
||||
|
||||
module:log("info", "Starting speakerstats for %s", muc_component_host);
|
||||
|
||||
@@ -376,3 +376,9 @@ process_host_module(breakout_room_component_host, function(host_module, host)
|
||||
end);
|
||||
end
|
||||
end);
|
||||
|
||||
process_host_module(main_virtual_host, function(host_module)
|
||||
module:context(host_module.host):fire_event('jitsi-add-identity', {
|
||||
name = 'speakerstats'; host = module.host;
|
||||
});
|
||||
end);
|
||||
|
||||
@@ -582,7 +582,7 @@ function process_host_module(name, callback)
|
||||
module:log('info', 'No host/component found, will wait for it: %s', name)
|
||||
|
||||
-- when a host or component is added
|
||||
prosody.events.add_handler('host-activated', process_host);
|
||||
prosody.events.add_handler('host-activated', process_host, -100); -- make sure everything is loaded
|
||||
else
|
||||
process_host(name);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user