From d44dd097560510b0666ab1ef29303d12aaa242b3 Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 27 Sep 2023 17:27:43 -0500 Subject: [PATCH 1/2] feat: Adds an option to randomize user-id used when client logins. Updates to latest desktop lib dependency to fix ALWAYS_TRUST_MODE_ENABLED. --- jigasi-home/sip-communicator.properties | 4 +++ pom.xml | 2 +- .../java/org/jitsi/jigasi/JvbConference.java | 26 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/jigasi-home/sip-communicator.properties b/jigasi-home/sip-communicator.properties index ebd28baee..4d572fc96 100644 --- a/jigasi-home/sip-communicator.properties +++ b/jigasi-home/sip-communicator.properties @@ -163,6 +163,10 @@ org.jitsi.jigasi.xmpp.acc.USE_DEFAULT_STUN_SERVER=false # To fix SSL/TLS required by client but not supported by server #org.jitsi.jigasi.xmpp.acc.ALLOW_NON_SECURE=true +# Can be used in combination with jitsi-meet module mod_auth_jitsi-shared-secret +# To have jigasi use a random username on every call +#org.jitsi.jigasi.xmpp.acc.UNIQUE_USER_ID=true + # If you want to disconnect jigasi calls automatically when all web users have # left, you can set the following property to false. # org.jitsi.jigasi.ALLOW_ONLY_JIGASIS_IN_ROOM=true diff --git a/pom.xml b/pom.xml index 4d9294ab9..958ca0547 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ true - 2.14.113297e05 + 2.14.77b1f5e65 org.jitsi.desktop UTF-8 1.7.36 diff --git a/src/main/java/org/jitsi/jigasi/JvbConference.java b/src/main/java/org/jitsi/jigasi/JvbConference.java index 74c088234..881f582b3 100644 --- a/src/main/java/org/jitsi/jigasi/JvbConference.java +++ b/src/main/java/org/jitsi/jigasi/JvbConference.java @@ -180,6 +180,11 @@ public class JvbConference Util.createNewThreadPool("xmpp-executor-pool") ); + /** + * Used for randomizing usernames if needed. + */ + private static final Random RANDOM = new Random(); + /** * Adds the features supported by jigasi to a specific * OperationSetJitsiMeetTools instance. @@ -1649,6 +1654,27 @@ else if ("org.jitsi.jigasi.xmpp.acc.BOSH_URL_PATTERN".equals(overridenProp)) ctx.setBoshURL(value); } } + else if ("org.jitsi.jigasi.xmpp.acc.USER_ID".equals(overridenProp) + && JigasiBundleActivator.getConfigurationService().getBoolean(overridePrefix + ".UNIQUE_USER_ID", false)) + { + try + { + Jid jid = JidCreate.from(value); + long random = RANDOM.nextInt(); + Jid newJid = JidCreate.entityBareFrom( + Localpart.from( + jid.getLocalpartOrNull() + "-" + String.format("%8h", random).replace(' ', '0')), + jid.getDomain()); + + properties.put(ProtocolProviderFactory.USER_ID, newJid.toString()); + } + catch (XmppStringprepException e) + { + logger.error("Error jid in org.jitsi.jigasi.xmpp.acc.USER_ID config", e); + + properties.put(ProtocolProviderFactory.USER_ID, value); + } + } else { properties.put(key, value); From 7fb8b019ca221a145adbe9879aa6d0e6d0ba81df Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 27 Sep 2023 18:16:20 -0500 Subject: [PATCH 2/2] squash: Update jid random part. --- src/main/java/org/jitsi/jigasi/JvbConference.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/jitsi/jigasi/JvbConference.java b/src/main/java/org/jitsi/jigasi/JvbConference.java index 881f582b3..91a3d1998 100644 --- a/src/main/java/org/jitsi/jigasi/JvbConference.java +++ b/src/main/java/org/jitsi/jigasi/JvbConference.java @@ -1662,8 +1662,7 @@ else if ("org.jitsi.jigasi.xmpp.acc.USER_ID".equals(overridenProp) Jid jid = JidCreate.from(value); long random = RANDOM.nextInt(); Jid newJid = JidCreate.entityBareFrom( - Localpart.from( - jid.getLocalpartOrNull() + "-" + String.format("%8h", random).replace(' ', '0')), + Localpart.from(jid.getLocalpartOrNull() + "-" + String.format("%x", random)), jid.getDomain()); properties.put(ProtocolProviderFactory.USER_ID, newJid.toString());