This commit is contained in:
2026-05-22 02:41:49 +05:30
parent b5d2472b95
commit c9519912a2
2 changed files with 24 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ local ROOM_INACTIVE_CALLBACK_URL = module:get_option_string(
"politictalk_room_inactive_callback_url",
os.getenv("POLITICTALK_ROOM_INACTIVE_CALLBACK_URL")
);
local ROOM_OCCUPANCY_CALLBACK_URL = module:get_option_string(
local configured_room_occupancy_callback_url = module:get_option_string(
"politictalk_room_occupancy_callback_url",
os.getenv("POLITICTALK_ROOM_OCCUPANCY_CALLBACK_URL")
);
@@ -19,6 +19,27 @@ local ROOM_INACTIVE_CALLBACK_SECRET = module:get_option_string(
os.getenv("POLITICTALK_ROOM_INACTIVE_CALLBACK_SECRET")
);
local function derive_room_occupancy_callback_url(inactive_url)
if not inactive_url or inactive_url == "" then
return nil;
end
local derived_url, replacement_count = inactive_url:gsub("room%-inactive$", "room-occupancy");
if replacement_count > 0 then
return derived_url;
end
return nil;
end
local ROOM_OCCUPANCY_CALLBACK_URL = configured_room_occupancy_callback_url;
if not ROOM_OCCUPANCY_CALLBACK_URL or ROOM_OCCUPANCY_CALLBACK_URL == "" then
ROOM_OCCUPANCY_CALLBACK_URL = derive_room_occupancy_callback_url(ROOM_INACTIVE_CALLBACK_URL);
if ROOM_OCCUPANCY_CALLBACK_URL then
module:log("info", "Derived PoliticTalk occupancy callback URL from inactive callback URL");
end
end
module:log("info", "Loaded PoliticTalk JWT role enforcement");
local function get_user(session)