Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not depend on deployment on root context #1202

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,14 @@ function maybeRedirectToWelcomePage(options) {
if (config.enableWelcomePage) {
setTimeout(() => {
APP.settings.setWelcomePageEnabled(true);
window.location.pathname = "/";
if ( window.location.pathname.lastIndexOf("/") > -1 ) {
window.location.pathname =
window.location.pathname.substring(
0, window.location.pathname.lastIndexOf("/") + 1);
}
else {
window.location.pathname = "/";
}
}, 3000);
}
}
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@
window.addEventListener(
'error', loadErrHandler, true /* capture phase type of listener */);
</script>
<script><!--#include virtual="/config.js" --></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
<script><!--#include virtual="config.js" --></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guusdk why do you need this change? Can't you handle this in your webserver's configs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually not using SSI at all - I cannot process them in my webserver. I assumed, perhaps incorrectly, that making the reference relative to the file makes for a safer inclusion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have access to the jetty that you are using, can you add some handlers there? I cannot remember can this be added runtime or handlers are setup on startup of jetty...

<script src="utils.js?v=1"></script>
<!--#include virtual="connection_optimization/connection_optimization.html" -->
<script src="connection_optimization/do_external_connect.js?v=1"></script>
<script><!--#include virtual="/interface_config.js" --></script>
<script><!--#include virtual="/logging_config.js" --></script>
<script><!--#include virtual="interface_config.js" --></script>
<script><!--#include virtual="logging_config.js" --></script>
<script src="libs/lib-jitsi-meet.min.js?v=139"></script>
<script src="libs/app.bundle.min.js?v=139"></script>
<!--#include virtual="title.html" -->
Expand Down
3 changes: 2 additions & 1 deletion modules/UI/UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ UI.getSharedVideoManager = function () {
UI.start = function () {
document.title = interfaceConfig.APP_NAME;
var setupWelcomePage = null;
if(config.enableWelcomePage && window.location.pathname == "/" &&
var regex = /\/([a-zA-Z0-9=\?]+)$/g;
if(config.enableWelcomePage && !regex.exec(window.location.pathname) &&
Settings.isWelcomePageEnabled()) {
$("#videoconference_page").hide();
if (!setupWelcomePage)
Expand Down
5 changes: 4 additions & 1 deletion modules/UI/welcome_page/WelcomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ function enterRoom() {
val = $enterRoomField.data("room-name");
}
if (val) {
window.location.pathname = "/" + val;
if (val.slice(-1) !== "/") {
window.location.pathname += "/";
}
window.location.pathname += val;
}
}

Expand Down
6 changes: 3 additions & 3 deletions title.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<title>Jitsi Meet</title>
<meta property="og:title" content="Jitsi Meet"/>
<meta property="og:image" content="/images/jitsilogo.png?v=1"/>
<meta property="og:image" content="images/jitsilogo.png?v=1"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guusdk I think you should fix this by setting:

<head>
<base href="http://example.org/meet/">
</head>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I typically try to avoid the base tag, as in the past, I've ran into subtle issues that were time-consuming to fix (in relation to in-page anchors, if memory serves).

Additioally, I did not want to add them here, as I dislike how this adds a reference to a specific domain and context (although I believe that the href value of base can be relative, but why would you use base at all then?) Without the base element, you can deploy the source on any domain, with them, you'll have to manually modify the source.

I don't really see an upside to having base. It is handy if you want to port an older code-base to a new context, but in general, it adds only confusion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deployment specific we use, but basically a way to serve the index from one place and rest of the code from a CDN, you can check that in current meet.

<meta property="og:description" content="Join a WebRTC video conference powered by the Jitsi Videobridge"/>
<meta description="Join a WebRTC video conference powered by the Jitsi Videobridge"/>
<meta itemprop="name" content="Jitsi Meet"/>
<meta itemprop="description" content="Join a WebRTC video conference powered by the Jitsi Videobridge"/>
<meta itemprop="image" content="/images/jitsilogo.png?v=1"/>
<link rel="icon" type="image/png" href="/images/favicon.ico?v=1"/>
<meta itemprop="image" content="images/jitsilogo.png?v=1"/>
<link rel="icon" type="image/png" href="images/favicon.ico?v=1"/>
18 changes: 10 additions & 8 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ function getRoomName () { // eslint-disable-line no-unused-vars
roomName = config.getroomnode(path);
} else {
/* fall back to default strategy
* this is making assumptions about how the URL->room mapping happens.
* It currently assumes deployment at root, with a rewrite like the
* following one (for nginx):
location ~ ^/([a-zA-Z0-9]+)$ {
rewrite ^/(.*)$ / break;
}
*/
* This is making assumptions about how the URL->room mapping happens.
* It assumes that the room name is expressed in the URL in the last
* part of the (non-empty) URL path, that matches the regular
* expression pattern used for rewrite rules in NGINX: [a-zA-Z0-9=\?]+
*/
if (path.length > 1) {
roomName = path.substr(1).toLowerCase();
var regex = /\/([a-zA-Z0-9=\?]+)$/g;
var match = regex.exec(path);
if ( match && match.length > 0 ) {
roomName = match[1].toLowerCase();
}
}
}

Expand Down