Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
bace2c6281
|
@ -5,3 +5,4 @@ JITSI_PRIVATE_MODE=false
|
||||||
JITSI_ISS=
|
JITSI_ISS=
|
||||||
SECRET_JITSI_KEY=
|
SECRET_JITSI_KEY=
|
||||||
ADMIN_API_TOKEN=123
|
ADMIN_API_TOKEN=123
|
||||||
|
START_ROOM_URL=/_/global/maps.workadventure.localhost/Floor0/floor0.json
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const SECRET_KEY = process.env.SECRET_KEY || "THECODINGMACHINE_SECRET_KEY";
|
const SECRET_KEY = process.env.SECRET_KEY || "THECODINGMACHINE_SECRET_KEY";
|
||||||
const URL_ROOM_STARTED = "/Floor0/floor0.json";
|
|
||||||
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
|
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
|
||||||
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;
|
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;
|
||||||
const ALLOW_ARTILLERY = process.env.ALLOW_ARTILLERY ? process.env.ALLOW_ARTILLERY == 'true' : false;
|
const ALLOW_ARTILLERY = process.env.ALLOW_ARTILLERY ? process.env.ALLOW_ARTILLERY == 'true' : false;
|
||||||
|
@ -16,7 +15,6 @@ export const SOCKET_IDLE_TIMER = parseInt(process.env.SOCKET_IDLE_TIMER as strin
|
||||||
|
|
||||||
export {
|
export {
|
||||||
SECRET_KEY,
|
SECRET_KEY,
|
||||||
URL_ROOM_STARTED,
|
|
||||||
MINIMUM_DISTANCE,
|
MINIMUM_DISTANCE,
|
||||||
ADMIN_API_URL,
|
ADMIN_API_URL,
|
||||||
ADMIN_API_TOKEN,
|
ADMIN_API_TOKEN,
|
||||||
|
|
|
@ -29,10 +29,12 @@ services:
|
||||||
API_URL: pusher.workadventure.localhost
|
API_URL: pusher.workadventure.localhost
|
||||||
UPLOADER_URL: uploader.workadventure.localhost
|
UPLOADER_URL: uploader.workadventure.localhost
|
||||||
ADMIN_URL: workadventure.localhost
|
ADMIN_URL: workadventure.localhost
|
||||||
STARTUP_COMMAND_1: yarn install
|
STARTUP_COMMAND_1: ./templater.sh
|
||||||
|
STARTUP_COMMAND_2: yarn install
|
||||||
TURN_SERVER: "turn:coturn.workadventu.re:443,turns:coturn.workadventu.re:443"
|
TURN_SERVER: "turn:coturn.workadventu.re:443,turns:coturn.workadventu.re:443"
|
||||||
TURN_USER: workadventure
|
TURN_USER: workadventure
|
||||||
TURN_PASSWORD: WorkAdventure123
|
TURN_PASSWORD: WorkAdventure123
|
||||||
|
START_ROOM_URL: "$START_ROOM_URL"
|
||||||
command: yarn run start
|
command: yarn run start
|
||||||
volumes:
|
volumes:
|
||||||
- ./front:/usr/src/app
|
- ./front:/usr/src/app
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Axios from "axios";
|
import Axios from "axios";
|
||||||
import {API_URL, URL_ROOM_STARTED} from "../Enum/EnvironmentVariable";
|
import {API_URL, START_ROOM_URL} from "../Enum/EnvironmentVariable";
|
||||||
import {RoomConnection} from "./RoomConnection";
|
import {RoomConnection} from "./RoomConnection";
|
||||||
import {OnConnectInterface, PositionInterface, ViewportInterface} from "./ConnexionModels";
|
import {OnConnectInterface, PositionInterface, ViewportInterface} from "./ConnexionModels";
|
||||||
import {GameConnexionTypes, urlManager} from "../Url/UrlManager";
|
import {GameConnexionTypes, urlManager} from "../Url/UrlManager";
|
||||||
|
@ -27,9 +27,9 @@ class ConnectionManager {
|
||||||
const organizationSlug = data.organizationSlug;
|
const organizationSlug = data.organizationSlug;
|
||||||
const worldSlug = data.worldSlug;
|
const worldSlug = data.worldSlug;
|
||||||
const roomSlug = data.roomSlug;
|
const roomSlug = data.roomSlug;
|
||||||
urlManager.editUrlForRoom(roomSlug, organizationSlug, worldSlug);
|
|
||||||
|
|
||||||
const room = new Room(window.location.pathname + window.location.hash);
|
const room = new Room('/@/'+organizationSlug+'/'+worldSlug+'/'+roomSlug + window.location.hash);
|
||||||
|
urlManager.pushRoomIdToUrl(room);
|
||||||
return Promise.resolve(room);
|
return Promise.resolve(room);
|
||||||
} else if (connexionType === GameConnexionTypes.organization || connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
|
} else if (connexionType === GameConnexionTypes.organization || connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
|
||||||
const localUser = localUserStore.getLocalUser();
|
const localUser = localUserStore.getLocalUser();
|
||||||
|
@ -48,10 +48,7 @@ class ConnectionManager {
|
||||||
}
|
}
|
||||||
let roomId: string
|
let roomId: string
|
||||||
if (connexionType === GameConnexionTypes.empty) {
|
if (connexionType === GameConnexionTypes.empty) {
|
||||||
roomId = urlManager.editUrlForRoom(URL_ROOM_STARTED, null, null);
|
roomId = START_ROOM_URL;
|
||||||
if (URL_ROOM_STARTED.startsWith('http://') || URL_ROOM_STARTED.startsWith('https://')) {
|
|
||||||
roomId = '/_/global/' + URL_ROOM_STARTED.replace('http://', '').replace('https://', '');
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
roomId = window.location.pathname + window.location.hash;
|
roomId = window.location.pathname + window.location.hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true";
|
const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true";
|
||||||
const URL_ROOM_STARTED : string = process.env.URL_ROOM_STARTED || 'tcm/workadventure/floor0';
|
const START_ROOM_URL : string = process.env.START_ROOM_URL || '/_/global/maps.workadventure.localhost/Floor0/floor0.json';
|
||||||
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "pusher.workadventure.localhost");
|
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "pusher.workadventure.localhost");
|
||||||
const UPLOADER_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.UPLOADER_URL || 'uploader.workadventure.localhost');
|
const UPLOADER_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.UPLOADER_URL || 'uploader.workadventure.localhost');
|
||||||
const ADMIN_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.ADMIN_URL || "workadventure.localhost");
|
const ADMIN_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.ADMIN_URL || "workadventure.localhost");
|
||||||
|
@ -15,7 +15,7 @@ const MAX_EXTRAPOLATION_TIME = 100; // Extrapolate a maximum of 250ms if no new
|
||||||
|
|
||||||
export {
|
export {
|
||||||
DEBUG_MODE,
|
DEBUG_MODE,
|
||||||
URL_ROOM_STARTED,
|
START_ROOM_URL,
|
||||||
API_URL,
|
API_URL,
|
||||||
UPLOADER_URL,
|
UPLOADER_URL,
|
||||||
ADMIN_URL,
|
ADMIN_URL,
|
||||||
|
|
|
@ -606,8 +606,18 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||||
if (url === undefined) {
|
if (url === undefined) {
|
||||||
audioManager.unloadAudio();
|
audioManager.unloadAudio();
|
||||||
} else {
|
} else {
|
||||||
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
|
const audioPath = url as string;
|
||||||
const realAudioPath = mapDirUrl + '/' + url;
|
let realAudioPath = '';
|
||||||
|
|
||||||
|
if (audioPath.indexOf('://') > 0) {
|
||||||
|
// remote file or stream
|
||||||
|
realAudioPath = audioPath;
|
||||||
|
} else {
|
||||||
|
// local file, include it relative to map directory
|
||||||
|
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
|
||||||
|
realAudioPath = mapDirUrl + '/' + url;
|
||||||
|
}
|
||||||
|
|
||||||
audioManager.loadAudio(realAudioPath);
|
audioManager.loadAudio(realAudioPath);
|
||||||
|
|
||||||
if (loop) {
|
if (loop) {
|
||||||
|
@ -704,6 +714,10 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public cleanupClosingScene(): void {
|
public cleanupClosingScene(): void {
|
||||||
|
// stop playing audio, close any open website, stop any open Jitsi
|
||||||
|
coWebsiteManager.closeCoWebsite();
|
||||||
|
this.stopJitsi();
|
||||||
|
this.playAudio(undefined);
|
||||||
// We are completely destroying the current scene to avoid using a half-backed instance when coming back to the same map.
|
// We are completely destroying the current scene to avoid using a half-backed instance when coming back to the same map.
|
||||||
if(this.connection) {
|
if(this.connection) {
|
||||||
this.connection.closeConnection();
|
this.connection.closeConnection();
|
||||||
|
|
|
@ -32,20 +32,6 @@ class UrlManager {
|
||||||
return match ? match [1] : null;
|
return match ? match [1] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//todo: simply use the roomId
|
|
||||||
//todo: test this with cypress
|
|
||||||
public editUrlForRoom(roomSlug: string, organizationSlug: string|null, worldSlug: string |null): string {
|
|
||||||
let newUrl:string;
|
|
||||||
if (organizationSlug) {
|
|
||||||
newUrl = '/@/'+organizationSlug+'/'+worldSlug+'/'+roomSlug;
|
|
||||||
} else {
|
|
||||||
newUrl = '/@/'+roomSlug;
|
|
||||||
}
|
|
||||||
history.pushState({}, 'WorkAdventure', newUrl);
|
|
||||||
return newUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public pushRoomIdToUrl(room:Room): void {
|
public pushRoomIdToUrl(room:Room): void {
|
||||||
if (window.location.pathname === room.id) return;
|
if (window.location.pathname === room.id) return;
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
|
|
|
@ -151,15 +151,6 @@ export class DiscussionManager {
|
||||||
this.nbpParticipants.innerText = `PARTICIPANTS (${nb})`;
|
this.nbpParticipants.innerText = `PARTICIPANTS (${nb})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private urlify(text: string) {
|
|
||||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
|
||||||
return text.replace(urlRegex, (url: string) => {
|
|
||||||
return '<a href="' + url + '" target="_blank">' + url + '</a>';
|
|
||||||
})
|
|
||||||
// or alternatively
|
|
||||||
// return text.replace(urlRegex, '<a href="$1">$1</a>')
|
|
||||||
}
|
|
||||||
|
|
||||||
public addMessage(name: string, message: string, isMe: boolean = false) {
|
public addMessage(name: string, message: string, isMe: boolean = false) {
|
||||||
const divMessage: HTMLDivElement = document.createElement('div');
|
const divMessage: HTMLDivElement = document.createElement('div');
|
||||||
divMessage.classList.add('message');
|
divMessage.classList.add('message');
|
||||||
|
@ -170,7 +161,7 @@ export class DiscussionManager {
|
||||||
const pMessage: HTMLParagraphElement = document.createElement('p');
|
const pMessage: HTMLParagraphElement = document.createElement('p');
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
if(isMe){
|
if(isMe){
|
||||||
name = 'Moi';
|
name = 'Me';
|
||||||
}
|
}
|
||||||
pMessage.innerHTML = `<span style="font-weight: bold">${name}</span>
|
pMessage.innerHTML = `<span style="font-weight: bold">${name}</span>
|
||||||
<span style="color:#bac2cc;display:inline-block;font-size:12px;">
|
<span style="color:#bac2cc;display:inline-block;font-size:12px;">
|
||||||
|
@ -179,7 +170,7 @@ export class DiscussionManager {
|
||||||
divMessage.appendChild(pMessage);
|
divMessage.appendChild(pMessage);
|
||||||
|
|
||||||
const userMessage: HTMLParagraphElement = document.createElement('p');
|
const userMessage: HTMLParagraphElement = document.createElement('p');
|
||||||
userMessage.innerHTML = this.urlify(message);
|
userMessage.innerHTML = HtmlUtils.urlify(message);
|
||||||
userMessage.classList.add('body');
|
userMessage.classList.add('body');
|
||||||
divMessage.appendChild(userMessage);
|
divMessage.appendChild(userMessage);
|
||||||
this.divMessages?.appendChild(divMessage);
|
this.divMessages?.appendChild(divMessage);
|
||||||
|
|
|
@ -17,4 +17,11 @@ export class HtmlUtils {
|
||||||
elem.remove();
|
elem.remove();
|
||||||
return elem as T;
|
return elem as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static urlify(text: string): string {
|
||||||
|
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||||
|
return text.replace(urlRegex, (url: string) => {
|
||||||
|
return '<a href="' + url + '" target="_blank" style=":visited {color: white}">' + url + '</a>';
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,28 @@ const fps : Phaser.Types.Core.FPSConfig = {
|
||||||
smoothStep: false
|
smoothStep: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the ?phaserMode=canvas parameter can be used to force Canvas usage
|
||||||
|
const params = new URLSearchParams(document.location.search.substring(1));
|
||||||
|
const phaserMode = params.get("phaserMode");
|
||||||
|
let mode: number;
|
||||||
|
switch (phaserMode) {
|
||||||
|
case 'auto':
|
||||||
|
case null:
|
||||||
|
mode = Phaser.AUTO;
|
||||||
|
break;
|
||||||
|
case 'canvas':
|
||||||
|
mode = Phaser.CANVAS;
|
||||||
|
break;
|
||||||
|
case 'webgl':
|
||||||
|
mode = Phaser.WEBGL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error('phaserMode parameter must be one of "auto", "canvas" or "webgl"');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const config: GameConfig = {
|
const config: GameConfig = {
|
||||||
type: Phaser.AUTO,
|
type: mode,
|
||||||
title: "WorkAdventure",
|
title: "WorkAdventure",
|
||||||
width: width / RESOLUTION,
|
width: width / RESOLUTION,
|
||||||
height: height / RESOLUTION,
|
height: height / RESOLUTION,
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import "jasmine";
|
||||||
|
import {HtmlUtils} from "../../../src/WebRtc/HtmlUtils";
|
||||||
|
|
||||||
|
describe("urlify()", () => {
|
||||||
|
it("should transform an url into a link", () => {
|
||||||
|
const text = HtmlUtils.urlify('https://google.com');
|
||||||
|
expect(text).toEqual('<a href="https://google.com" target="_blank" style=":visited {color: white}">https://google.com</a>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not transform a normal text into a link", () => {
|
||||||
|
const text = HtmlUtils.urlify('hello');
|
||||||
|
expect(text).toEqual('hello');
|
||||||
|
});
|
||||||
|
});
|
|
@ -45,7 +45,7 @@ module.exports = {
|
||||||
new webpack.ProvidePlugin({
|
new webpack.ProvidePlugin({
|
||||||
Phaser: 'phaser'
|
Phaser: 'phaser'
|
||||||
}),
|
}),
|
||||||
new webpack.EnvironmentPlugin(['API_URL', 'UPLOADER_URL', 'ADMIN_URL', 'DEBUG_MODE', 'TURN_SERVER', 'TURN_USER', 'TURN_PASSWORD', 'JITSI_URL', 'JITSI_PRIVATE_MODE', 'URL_ROOM_STARTED'])
|
new webpack.EnvironmentPlugin(['API_URL', 'UPLOADER_URL', 'ADMIN_URL', 'DEBUG_MODE', 'TURN_SERVER', 'TURN_USER', 'TURN_PASSWORD', 'JITSI_URL', 'JITSI_PRIVATE_MODE', 'START_ROOM_URL'])
|
||||||
],
|
],
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const SECRET_KEY = process.env.SECRET_KEY || "THECODINGMACHINE_SECRET_KEY";
|
const SECRET_KEY = process.env.SECRET_KEY || "THECODINGMACHINE_SECRET_KEY";
|
||||||
const URL_ROOM_STARTED = "/Floor0/floor0.json";
|
|
||||||
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
|
const MINIMUM_DISTANCE = process.env.MINIMUM_DISTANCE ? Number(process.env.MINIMUM_DISTANCE) : 64;
|
||||||
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;
|
const GROUP_RADIUS = process.env.GROUP_RADIUS ? Number(process.env.GROUP_RADIUS) : 48;
|
||||||
const ALLOW_ARTILLERY = process.env.ALLOW_ARTILLERY ? process.env.ALLOW_ARTILLERY == 'true' : false;
|
const ALLOW_ARTILLERY = process.env.ALLOW_ARTILLERY ? process.env.ALLOW_ARTILLERY == 'true' : false;
|
||||||
|
@ -16,7 +15,6 @@ export const SOCKET_IDLE_TIMER = parseInt(process.env.SOCKET_IDLE_TIMER as strin
|
||||||
|
|
||||||
export {
|
export {
|
||||||
SECRET_KEY,
|
SECRET_KEY,
|
||||||
URL_ROOM_STARTED,
|
|
||||||
MINIMUM_DISTANCE,
|
MINIMUM_DISTANCE,
|
||||||
API_URL,
|
API_URL,
|
||||||
ADMIN_API_URL,
|
ADMIN_API_URL,
|
||||||
|
|
Loading…
Reference in New Issue