Skip to content

Commit

Permalink
fix(matrix_affiliation): regex
Browse files Browse the repository at this point in the history
  • Loading branch information
emrahcom committed Oct 17, 2024
1 parent 36ee14d commit ebf8a82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth_hybrid_matrix_token/mod_matrix_affiliation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
-- if this room is created by widget or not...
--
-- There are two possible formats for Jitsi room names created by widget:
-- - jitsi_room_name should match "jitsi[a-z]{24}" (regex) or
-- - base32.decode(jitsi_room_name) should match "!.*:.*[.].*" (regex)
-- - jitsi_room_name should match "^jitsi[a-z]{24}$" (regex) or
-- - base32.decode(jitsi_room_name) should match "^!.*:.*[.].*" (regex)
--
-- This module assumes that the authentication is already enabled on Jicofo. So
-- every participants who have a valid token will become moderator (owner) by
Expand Down Expand Up @@ -50,7 +50,7 @@ module:hook("muc-occupant-joined", function (event)
local roomName, _ = jid_split(room.jid)
local isMatrixRoomName = string.match(
roomName,
"jitsi%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l"
"^jitsi%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l%l$"
)

-- if it doesnt match the first format, check the second possible format
Expand All @@ -61,7 +61,7 @@ module:hook("muc-occupant-joined", function (event)
return
end

local isMatrixRoomId = string.match(roomId, "!.*:.*[.].*")
local isMatrixRoomId = string.match(roomId, "^!.*:.*[.].*")
if not isMatrixRoomId then
module:log(LOGLEVEL, "skip affiliation, not a Matrix room")
return
Expand Down

0 comments on commit ebf8a82

Please sign in to comment.