2021-05-13 03:02:51 +00:00
|
|
|
-- Jitsi session information
|
|
|
|
-- Copyright (C) 2021-present 8x8, Inc.
|
|
|
|
module:set_global();
|
|
|
|
|
|
|
|
local formdecode = require "util.http".formdecode;
|
2021-12-06 20:59:33 +00:00
|
|
|
local urlencode = require "util.http".urlencode;
|
2021-05-13 03:02:51 +00:00
|
|
|
|
|
|
|
-- Extract the following parameters from the URL and set them in the session:
|
|
|
|
-- * previd: for session resumption
|
|
|
|
function init_session(event)
|
|
|
|
local session, request = event.session, event.request;
|
|
|
|
local query = request.url.query;
|
|
|
|
|
|
|
|
if query ~= nil then
|
|
|
|
local params = formdecode(query);
|
|
|
|
|
|
|
|
-- previd is used together with https://modules.prosody.im/mod_smacks.html
|
|
|
|
-- the param is used to find resumed session and re-use anonymous(random) user id
|
|
|
|
session.previd = query and params.previd or nil;
|
|
|
|
|
|
|
|
-- The room name and optional prefix from the web query
|
2021-12-06 20:59:33 +00:00
|
|
|
session.jitsi_web_query_room = urlencode(params.room);
|
2021-12-07 15:14:08 +00:00
|
|
|
session.jitsi_web_query_prefix = urlencode(params.prefix) or "";
|
2021-05-13 03:02:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
module:hook_global("bosh-session", init_session);
|
|
|
|
module:hook_global("websocket-session", init_session);
|