From cb664616d312554666c9a8d81c414146712b1a58 Mon Sep 17 00:00:00 2001 From: emrah Date: Thu, 17 Oct 2024 14:42:17 +0300 Subject: [PATCH] refactor(auth_hybrid_matrix_token): minor improvements --- .../mod_auth_hybrid_matrix_token.lua | 13 +++++++++---- .../mod_matrix_lobby_bypass.lua | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/auth_hybrid_matrix_token/mod_auth_hybrid_matrix_token.lua b/auth_hybrid_matrix_token/mod_auth_hybrid_matrix_token.lua index fecf3ac..01d9f01 100644 --- a/auth_hybrid_matrix_token/mod_auth_hybrid_matrix_token.lua +++ b/auth_hybrid_matrix_token/mod_auth_hybrid_matrix_token.lua @@ -73,9 +73,12 @@ function init_session(event) if query ~= nil then local params = formdecode(query) - if params and params.token then - token = params.token - session.jitsi_room = params.room or nil + if params then + session.jitsi_room = params.room + + if params.token then + token = params.token + end end end @@ -235,7 +238,9 @@ local function matrix_handler(session, payload) return res, error, reason end - if payload.context.matrix.room_id == nil then + if not payload.context.matrix.room_id + or payload.context.matrix.room_id == "" + then module:log("warn", "Missing Matrix room_id in token") session.auth_token = nil measure_verify_fail(1) diff --git a/auth_hybrid_matrix_token/mod_matrix_lobby_bypass.lua b/auth_hybrid_matrix_token/mod_matrix_lobby_bypass.lua index 45b5891..3b8894b 100644 --- a/auth_hybrid_matrix_token/mod_matrix_lobby_bypass.lua +++ b/auth_hybrid_matrix_token/mod_matrix_lobby_bypass.lua @@ -8,7 +8,7 @@ -- base32.decode(jitsi_room_name) should match "!.*:.*[.].*" (regex) for related -- rooms. -- --- Since the participant is already a valid member of Matrix's room, no need to +-- If the participant is already a valid member of Matrix's room then no need to -- check her again in Jitsi lobby. -- ----------------------------------------------------------------------------- local basexx = require 'basexx'