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

@@ -147,7 +147,8 @@ inactive-room and occupancy callbacks from
`templates/prosody-token-auth.cfg.lua.example`. The inactive callback clears the `templates/prosody-token-auth.cfg.lua.example`. The inactive callback clears the
event `meetingCode` when the last host leaves, and the occupancy callback keeps event `meetingCode` when the last host leaves, and the occupancy callback keeps
the platform room cards updated with the current room occupancy count, including the platform room cards updated with the current room occupancy count, including
the host. the host. If the occupancy callback URL is omitted, the module derives it from
the inactive callback URL by replacing `room-inactive` with `room-occupancy`.
## Token Auth Rollout ## Token Auth Rollout

View File

@@ -10,7 +10,7 @@ local ROOM_INACTIVE_CALLBACK_URL = module:get_option_string(
"politictalk_room_inactive_callback_url", "politictalk_room_inactive_callback_url",
os.getenv("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", "politictalk_room_occupancy_callback_url",
os.getenv("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") 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"); module:log("info", "Loaded PoliticTalk JWT role enforcement");
local function get_user(session) local function get_user(session)