Removes unnecessary history.pushState if the welcome page is disabled and the user enter the base URL
This commit is contained in:
parent
6c1349c501
commit
3d5af92c7a
26
app.js
26
app.js
|
@ -24,24 +24,6 @@ import API from './modules/API/API';
|
||||||
|
|
||||||
import UIEvents from './service/UI/UIEvents';
|
import UIEvents from './service/UI/UIEvents';
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to push history state with the following parameters:
|
|
||||||
* 'VideoChat', `Room: ${roomName}`, URL. If fail, prints the error and returns
|
|
||||||
* it.
|
|
||||||
*/
|
|
||||||
function pushHistoryState(roomName, URL) {
|
|
||||||
try {
|
|
||||||
window.history.pushState(
|
|
||||||
'VideoChat', `Room: ${roomName}`, URL
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Push history state failed with parameters:",
|
|
||||||
'VideoChat', `Room: ${roomName}`, URL, e);
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds and returns the room name.
|
* Builds and returns the room name.
|
||||||
*/
|
*/
|
||||||
|
@ -51,14 +33,6 @@ function buildRoomName () {
|
||||||
if(!roomName) {
|
if(!roomName) {
|
||||||
let word = RoomnameGenerator.generateRoomWithoutSeparator();
|
let word = RoomnameGenerator.generateRoomWithoutSeparator();
|
||||||
roomName = word.toLowerCase();
|
roomName = word.toLowerCase();
|
||||||
let historyURL = window.location.pathname + word;
|
|
||||||
//Trying to push state with URL "/" + roomName
|
|
||||||
var err = pushHistoryState(word, historyURL);
|
|
||||||
//If URL "/" + roomName is not good, trying with explicitly adding the
|
|
||||||
//domain name.
|
|
||||||
if(err && config.hosts.domain) {
|
|
||||||
pushHistoryState(word, "//" + config.hosts.domain + historyURL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return roomName;
|
return roomName;
|
||||||
|
|
Loading…
Reference in New Issue