Terms&Conditions (#18) WIP:

* channel terms
This commit is contained in:
John Livingston
2024-06-25 11:28:46 +02:00
parent b110456029
commit a06ef00e2a
9 changed files with 101 additions and 42 deletions

View File

@ -14,6 +14,9 @@ local get_room_from_jid = rawget(mod_muc, "get_room_from_jid");
module:depends"http";
local mod_muc_peertubelivechat_terms = module:depends"muc_peertubelivechat_terms";
local set_muc_terms = rawget(mod_muc_peertubelivechat_terms, "set_muc_terms");
function check_auth(routes)
local function check_request_auth(event)
local apikey = module:get_option_string("peertubelivechat_manage_rooms_apikey", "")
@ -94,6 +97,12 @@ local function update_room(event)
must104 = true;
end
end
if (type(config.livechat_muc_terms) == "string") then
-- to easily detect if the value is given or not, we consider that the caller passes "" when terms must be deleted.
if set_muc_terms then
set_muc_terms(room, config.livechat_muc_terms or nil);
end
end
if type(config.removeAffiliationsFor) == "table" then
-- array of jids
for _, jid in ipairs(config.removeAffiliationsFor) do