Merge branch 'develop' of github.com:thecodingmachine/workadventure into protobuf
# Conflicts: # back/package.json
This commit is contained in:
commit
cd083a2090
7 changed files with 90 additions and 3 deletions
|
@ -10,10 +10,12 @@ import {FourOFourScene} from "./Phaser/Reconnecting/FourOFourScene";
|
|||
import WebGLRenderer = Phaser.Renderer.WebGL.WebGLRenderer;
|
||||
import {OutlinePipeline} from "./Phaser/Shaders/OutlinePipeline";
|
||||
import {CustomizeScene} from "./Phaser/Login/CustomizeScene";
|
||||
import {HtmlUtils} from "./WebRtc/HtmlUtils";
|
||||
import {CoWebsiteManager} from "./WebRtc/CoWebsiteManager";
|
||||
import {redirectIfToken} from "./register";
|
||||
|
||||
//CoWebsiteManager.loadCoWebsite('https://thecodingmachine.com');
|
||||
let connectionData //todo: do something with this data
|
||||
redirectIfToken().then(res => connectionData = res);
|
||||
|
||||
// Load Jitsi if the environment variable is set.
|
||||
if (JITSI_URL) {
|
||||
|
|
29
front/src/register.ts
Normal file
29
front/src/register.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import Axios from "axios";
|
||||
import {API_URL} from "./Enum/EnvironmentVariable";
|
||||
declare let history:History;
|
||||
|
||||
//todo: better naming
|
||||
export interface ConnexionData {
|
||||
organizationSlug: string,
|
||||
worldSlug: string,
|
||||
roomSlug: string,
|
||||
}
|
||||
|
||||
export async function redirectIfToken(): Promise<ConnexionData | null> {
|
||||
const match = /\/register\/(.+)/.exec(window.location.toString());
|
||||
if (!match) {
|
||||
return null
|
||||
}
|
||||
let res = null;
|
||||
try {
|
||||
res = await Axios.get(`${API_URL}/register/`+match[1])
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
const organizationSlug = res.data.organizationSlug;
|
||||
const worldSlug = res.data.worldSlug;
|
||||
const roomSlug = res.data.roomSlug;
|
||||
const connexionUrl = '/@/'+organizationSlug+'/'+worldSlug+'/'+roomSlug;
|
||||
history.pushState({}, '', connexionUrl);
|
||||
return {organizationSlug, worldSlug, roomSlug};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue