Adding fallback to unauthenticated Jitsi
This commit is contained in:
parent
260b0ea408
commit
16d1c2354e
@ -1,4 +1,6 @@
|
||||
DEBUG_MODE=false
|
||||
JITSI_URL=meet.jit.si
|
||||
# If your Jitsi environment has authentication set up, you MUST set JITSI_PRIVATE_MODE to "true" and you MUST pass a SECRET_JITSI_KEY to generate the JWT secret
|
||||
JITSI_PRIVATE_MODE=false
|
||||
SECRET_JITSI_KEY=
|
||||
ADMIN_API_TOKEN=123
|
||||
|
@ -612,7 +612,7 @@ class SocketManager {
|
||||
"aud": "jitsi",
|
||||
"iss": "meetworkadventure",
|
||||
"sub": "coremeet.workadventu.re",
|
||||
"room": "*"
|
||||
"room": room
|
||||
}, SECRET_JITSI_KEY, {
|
||||
expiresIn: '1d',
|
||||
algorithm: "HS256",
|
||||
|
@ -23,6 +23,7 @@ services:
|
||||
environment:
|
||||
DEBUG_MODE: "$DEBUG_MODE"
|
||||
JITSI_URL: $JITSI_URL
|
||||
JITSI_PRIVATE_MODE: "$JITSI_PRIVATE_MODE"
|
||||
HOST: "0.0.0.0"
|
||||
NODE_ENV: development
|
||||
API_URL: api.workadventure.localhost
|
||||
|
@ -4,6 +4,7 @@ const TURN_SERVER: string = process.env.TURN_SERVER || "turn:numb.viagenie.ca";
|
||||
const TURN_USER: string = process.env.TURN_USER || 'g.parant@thecodingmachine.com';
|
||||
const TURN_PASSWORD: string = process.env.TURN_PASSWORD || 'itcugcOHxle9Acqi$';
|
||||
const JITSI_URL : string|undefined = (process.env.JITSI_URL === '') ? undefined : process.env.JITSI_URL;
|
||||
const JITSI_PRIVATE_MODE : boolean = process.env.JITSI_PRIVATE_MODE == "true";
|
||||
const RESOLUTION = 3;
|
||||
const ZOOM_LEVEL = 1/*3/4*/;
|
||||
const POSITION_DELAY = 200; // Wait 200ms between sending position events
|
||||
@ -19,5 +20,6 @@ export {
|
||||
TURN_SERVER,
|
||||
TURN_USER,
|
||||
TURN_PASSWORD,
|
||||
JITSI_URL
|
||||
JITSI_URL,
|
||||
JITSI_PRIVATE_MODE
|
||||
}
|
||||
|
@ -9,7 +9,14 @@ import {
|
||||
RoomJoinedMessageInterface
|
||||
} from "../../Connexion/ConnexionModels";
|
||||
import {CurrentGamerInterface, hasMovedEventName, Player} from "../Player/Player";
|
||||
import {DEBUG_MODE, JITSI_URL, POSITION_DELAY, RESOLUTION, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
|
||||
import {
|
||||
DEBUG_MODE,
|
||||
JITSI_PRIVATE_MODE,
|
||||
JITSI_URL,
|
||||
POSITION_DELAY,
|
||||
RESOLUTION,
|
||||
ZOOM_LEVEL
|
||||
} from "../../Enum/EnvironmentVariable";
|
||||
import {
|
||||
ITiledMap,
|
||||
ITiledMapLayer,
|
||||
@ -466,10 +473,14 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
if (newValue === undefined) {
|
||||
this.stopJitsi();
|
||||
} else {
|
||||
// TODO: get jitsiRoomAdminTag
|
||||
const adminTag = allProps.get("jitsiRoomAdminTag") as string|undefined;
|
||||
console.log("JITSI_PRIVATE_MODE", JITSI_PRIVATE_MODE);
|
||||
if (JITSI_PRIVATE_MODE) {
|
||||
const adminTag = allProps.get("jitsiRoomAdminTag") as string|undefined;
|
||||
|
||||
this.connection.emitQueryJitsiJwtMessage(this.instance + "-" + newValue, adminTag);
|
||||
this.connection.emitQueryJitsiJwtMessage(this.instance + "-" + newValue, adminTag);
|
||||
} else {
|
||||
this.startJitsi(newValue as string);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -579,6 +590,9 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
item.fire(message.event, message.state, message.parameters);
|
||||
}));
|
||||
|
||||
/**
|
||||
* Triggered when we receive the JWT token to connect to Jitsi
|
||||
*/
|
||||
connection.onStartJitsiRoom((jwt, room) => {
|
||||
this.startJitsi(room, jwt);
|
||||
});
|
||||
@ -1178,7 +1192,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
this.updateCameraOffset();
|
||||
}
|
||||
|
||||
public startJitsi(roomName: string, jwt: string): void {
|
||||
public startJitsi(roomName: string, jwt?: string): void {
|
||||
CoWebsiteManager.insertCoWebsite((cowebsiteDiv => {
|
||||
const domain = JITSI_URL;
|
||||
const options = {
|
||||
@ -1195,6 +1209,9 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
MOBILE_APP_PROMO: false
|
||||
}
|
||||
};
|
||||
if (!options.jwt) {
|
||||
delete options.jwt;
|
||||
}
|
||||
this.jitsiApi = new (window as any).JitsiMeetExternalAPI(domain, options); // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
this.jitsiApi.executeCommand('displayName', gameManager.getPlayerName());
|
||||
}));
|
||||
|
@ -45,7 +45,7 @@ module.exports = {
|
||||
new webpack.ProvidePlugin({
|
||||
Phaser: 'phaser'
|
||||
}),
|
||||
new webpack.EnvironmentPlugin(['API_URL', 'DEBUG_MODE', 'TURN_SERVER', 'TURN_USER', 'TURN_PASSWORD', 'JITSI_URL'])
|
||||
new webpack.EnvironmentPlugin(['API_URL', 'DEBUG_MODE', 'TURN_SERVER', 'TURN_USER', 'TURN_PASSWORD', 'JITSI_URL', 'JITSI_PRIVATE_MODE'])
|
||||
],
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user