Adding a new "jitsiNoPrefix" property.

When set to "true", WorkAdventure will NOT prefix the Jitsi room name with a hash, gicing full control to the user over the Jitsi room name.
This commit is contained in:
David Négrier 2022-04-16 11:36:10 +02:00
parent b89997c9f1
commit 8c5c680cfb
5 changed files with 30 additions and 8 deletions

View File

@ -10,7 +10,7 @@ On your map, you can define special zones (meeting rooms) that will trigger the
In order to create Jitsi meet zones: In order to create Jitsi meet zones:
* You must create a specific layer. * You must create a specific layer.
* In layer properties, you MUST add a "`jitsiRoom`" property (of type "`string`"). The value of the property is the name of the room in Jitsi. Note: the name of the room will be "slugified" and prepended with the name of the instance of the map (so that different instances of the map have different rooms) * In layer properties, you MUST add a "`jitsiRoom`" property (of type "`string`"). The value of the property is the name of the room in Jitsi. Note: the name of the room will be "slugified" and prepended with a hash of the room URL
* You may also use "jitsiWidth" property (of type "number" between 0 and 100) to control the width of the iframe containing the meeting room. * You may also use "jitsiWidth" property (of type "number" between 0 and 100) to control the width of the iframe containing the meeting room.
You can have this layer (i.e. your meeting area) to be selectable as the precise location for your meeting using the [Google Calendar integration for Work Adventure](/integrations/google-calendar). To do so, you must set the `meetingRoomLabel` property. You can provide any name that you would like your meeting room to have (as a string). You can have this layer (i.e. your meeting area) to be selectable as the precise location for your meeting using the [Google Calendar integration for Work Adventure](/integrations/google-calendar). To do so, you must set the `meetingRoomLabel` property. You can provide any name that you would like your meeting room to have (as a string).
@ -82,3 +82,15 @@ and not
{.alert.alert-info} {.alert.alert-info}
When you use `jitsiUrl`, the targeted Jitsi instance must be public. You cannot use moderation features or the JWT When you use `jitsiUrl`, the targeted Jitsi instance must be public. You cannot use moderation features or the JWT
tokens authentication with maps configured using the `jitsiUrl` property. tokens authentication with maps configured using the `jitsiUrl` property.
## Full control over the Jitsi room name
By default, the name of the room will be "slugified" and prepended with a hash of the room URL.
This is what you want most of the time. Indeed, different maps with the same Jitsi room name (the same `jitsiRoom` property) will not share the same Jitsi room instance.
However, sometimes, you may actually want to have different WorkAdventure meeting rooms that are actually sharing
the same Jitsi meet meeting room. Or if you are pointing to a custom Jitsi server (using the `jitsiUrl` property),
you may want to point to a specific existing room.
For all those use cases, you can use `jitsiNoPrefix: true`. This will remove the automatic prefixing
of the hash and will give you full control on the Jitsi room name.

View File

@ -15,6 +15,7 @@ export enum GameMapProperties {
JITSI_TRIGGER_MESSAGE = "jitsiTriggerMessage", JITSI_TRIGGER_MESSAGE = "jitsiTriggerMessage",
JITSI_URL = "jitsiUrl", JITSI_URL = "jitsiUrl",
JITSI_WIDTH = "jitsiWidth", JITSI_WIDTH = "jitsiWidth",
JITSI_NO_PREFIX = "jitsiNoPrefix",
NAME = "name", NAME = "name",
OPEN_TAB = "openTab", OPEN_TAB = "openTab",
OPEN_WEBSITE = "openWebsite", OPEN_WEBSITE = "openWebsite",

View File

@ -67,7 +67,11 @@ export class GameMapPropertiesListener {
}); });
} else { } else {
const openJitsiRoomFunction = () => { const openJitsiRoomFunction = () => {
const roomName = jitsiFactory.getRoomName(newValue.toString(), this.scene.roomUrl); let addPrefix = true;
if (allProps.get(GameMapProperties.JITSI_NO_PREFIX)) {
addPrefix = false;
}
const roomName = jitsiFactory.getRoomName(newValue.toString(), this.scene.roomUrl, addPrefix);
const jitsiUrl = allProps.get(GameMapProperties.JITSI_URL) as string | undefined; const jitsiUrl = allProps.get(GameMapProperties.JITSI_URL) as string | undefined;
if (JITSI_PRIVATE_MODE && !jitsiUrl) { if (JITSI_PRIVATE_MODE && !jitsiUrl) {

View File

@ -136,8 +136,8 @@ class JitsiFactory {
/** /**
* Slugifies the room name and prepends the room name with the instance * Slugifies the room name and prepends the room name with the instance
*/ */
public getRoomName(roomName: string, roomId: string): string { public getRoomName(roomName: string, roomId: string, addPrefix: boolean): string {
return slugify(StringUtils.shortHash(roomId) + "-" + roomName); return slugify((addPrefix ? StringUtils.shortHash(roomId) + "-" : "") + roomName);
} }
public start( public start(

View File

@ -43,6 +43,11 @@
"type":"string", "type":"string",
"value":"{\"DEFAULT_BACKGROUND\":\"#77ee77\"}" "value":"{\"DEFAULT_BACKGROUND\":\"#77ee77\"}"
}, },
{
"name":"jitsiNoPrefix",
"type":"bool",
"value":true
},
{ {
"name":"jitsiRoom", "name":"jitsiRoom",
"type":"string", "type":"string",
@ -65,7 +70,7 @@
"name":"floorLayer", "name":"floorLayer",
"objects":[ "objects":[
{ {
"height":83.6666666666666, "height":110.891622876526,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
@ -73,14 +78,14 @@
{ {
"fontfamily":"Sans Serif", "fontfamily":"Sans Serif",
"pixelsize":13, "pixelsize":13,
"text":"Test:\nWalk on the carpet and press space\nResult:\nJitsi opens, background in green and audio\/video is muted", "text":"Test:\nWalk on the carpet and press space\nResult:\nJitsi opens, background in green and audio\/video is muted.\nThe name of the room (displayed at the top of Jitsi) is \"Myroom Avec Espace EA\"",
"wrap":true "wrap":true
}, },
"type":"", "type":"",
"visible":true, "visible":true,
"width":315.4375, "width":315.4375,
"x":2.28125, "x":1.48051599382768,
"y":235.166666666667 "y":209.535838407429
}], }],
"opacity":1, "opacity":1,
"type":"objectgroup", "type":"objectgroup",