Snippets
Created by
Fabio Montefuscolo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | <html itemscope itemtype="http://schema.org/Product" prefix="og: http://ogp.me/ns#" xmlns="http://www.w3.org/1999/html">
<head>
<?php echo file_get_contents("head.html"); ?>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php echo file_get_contents("base.html"); ?>
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="stylesheet" href="css/all.css">
<script>
// IE11 and earlier can be identified via their user agent and be
// redirected to a page that is known to have no newer js syntax.
if (window.navigator.userAgent.match(/(MSIE|Trident)/)) {
var roomName = encodeURIComponent(window.location.pathname);
window.location.href = "static/recommendedBrowsers.html" + "?room=" + roomName;
}
window.indexLoadedTime = window.performance.now();
console.log("(TIME) index.html loaded:\t", indexLoadedTime);
// XXX the code below listeners for errors and displays an error message
// in the document body when any of the required files fails to load.
// The intention is to prevent from displaying broken page.
var criticalFiles = [
"config.js",
"utils.js",
"do_external_connect.js",
"interface_config.js",
"logging_config.js",
"lib-jitsi-meet.min.js",
"app.bundle.min.js",
"all.css"
];
var loadErrHandler = function(e) {
var target = e.target;
// Error on <script> and <link>(CSS)
// <script> will have .src and <link> .href
var fileRef = (target.src ? target.src : target.href);
if (("SCRIPT" === target.tagName || "LINK" === target.tagName)
&& criticalFiles.some(
function(file) { return fileRef.indexOf(file) !== -1 })) {
window.onload = function() {
// The whole complex part below implements page reloads with
// "exponential backoff". The retry attempt is passes as
// "rCounter" query parameter
var href = window.location.href;
var retryMatch = href.match(/.+(\?|&)rCounter=(\d+)/);
var retryCountStr = retryMatch ? retryMatch[2] : "0";
var retryCount = Number.parseInt(retryCountStr);
if (retryMatch == null) {
var separator = href.indexOf("?") === -1 ? "?" : "&";
var hashIdx = href.indexOf("#");
if (hashIdx === -1) {
href += separator + "rCounter=1";
} else {
var hashPart = href.substr(hashIdx);
href = href.substr(0, hashIdx)
+ separator + "rCounter=1" + hashPart;
}
} else {
var separator = retryMatch[1];
href = href.replace(
/(\?|&)rCounter=(\d+)/,
separator + "rCounter=" + (retryCount + 1));
}
var delay = Math.pow(2, retryCount) * 2000;
if (isNaN(delay) || delay < 2000 || delay > 60000)
delay = 10000;
var showMoreText = "show more";
var showLessText = "show less";
document.body.innerHTML
= "<div style='"
+ "position: absolute;top: 50%;left: 50%;"
+ "text-align: center;"
+ "font-size: medium;"
+ "font-weight: 400;"
+ "transform: translate(-50%, -50%)'>"
+ "Uh oh! We couldn't fully download everything we needed :("
+ "<br/> "
+ "We will try again shortly. In the mean time, check for problems with your Internet connection!"
+ "<br/><br/> "
+ "<div id='moreInfo' style='"
+ "display: none;'>" + "Missing " + fileRef
+ "<br/><br/></div>"
+ "<a id='showMore' style='"
+ "text-decoration: underline;"
+ "font-size:small;"
+ "cursor: pointer'>" + showMoreText + "</a>"
+ " "
+ "<a id ='reloadLink' style='"
+ "text-decoration: underline;"
+ "font-size:small;"
+ "'>reload now</a>"
+ "</div>";
var reloadLink = document.getElementById('reloadLink');
reloadLink.setAttribute('href', href);
var showMoreElem = document.getElementById("showMore");
showMoreElem.addEventListener('click', function () {
var moreInfoElem
= document.getElementById("moreInfo");
if (showMoreElem.innerHTML === showMoreText) {
moreInfoElem.setAttribute(
"style",
"display: block;"
+ "color:#FF991F;"
+ "font-size:small;"
+ "user-select:text;");
showMoreElem.innerHTML = showLessText;
}
else {
moreInfoElem.setAttribute(
"style", "display: none;");
showMoreElem.innerHTML = showMoreText;
}
});
window.setTimeout(
function () { window.location.replace(href); }, delay);
// Call extra handler if defined.
if (typeof postLoadErrorHandler === "function") {
postLoadErrorHandler(fileRef);
}
};
window.removeEventListener(
'error', loadErrHandler, true /* capture phase */);
}
};
window.addEventListener(
'error', loadErrHandler, true /* capture phase type of listener */);
</script>
<script><?php echo file_get_contents("config.js"); ?></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
<?php echo file_get_contents("connection_optimization/connection_optimization.html"); ?>
<script src="libs/do_external_connect.min.js?v=1"></script>
<script><?php echo file_get_contents("interface_config.js"); ?></script>
<script><?php echo file_get_contents("logging_config.js"); ?></script>
<script src="libs/lib-jitsi-meet.min.js?v=139"></script>
<!-- Customizing to auto-login -->
<script type="text/javascript">(function(){
//https://d1n7j1lsem6fu8.cloudfront.net/sa/my-team?organizationId=1
var okta = null;
var token = null;
var info = null;
var username = null;
var password = null;
okta = sessionStorage['okta-token-storage']
|| localStorage['okta-token-storage'];
if (okta) {
okta = JSON.parse(okta);
if (okta['accessToken'] && okta['accessToken']['accessToken']) {
token = okta['accessToken']['accessToken'];
console.log('Found token on "okta-token-storage"', token);
}
}
if (token) {
info = token.split('.');
info = info[1];
if (info) {
info = atob(info);
info = JSON.parse(info);
console.log('Found token info', info);
}
}
if (info && info['sub']) {
username = info['sub'];
username = username.substring(0, username.lastIndexOf('@'));
if (config && config['hosts'] && config['hosts']['domain']) {
username = username.concat('@', config.hosts.domain)
}
localStorage['xmpp_username_override'] = username;
localStorage['xmpp_password_override'] = token;
console.log('Setting username: ', username);
console.log('Setting password: ', token);
console.log('Raising Strophe.SASLOAuthBearer.prototype.priority to 100');
Strophe.SASLOAuthBearer.prototype.priority = 100;
} else {
console.log('Dropping Strophe.SASLOAuthBearer.prototype.priority to 0');
Strophe.SASLOAuthBearer.prototype.priority = 0;
}
})();
</script>
<script src="libs/app.bundle.min.js?v=140"></script>
<?php echo file_get_contents("title.html"); ?>
<?php echo file_get_contents("plugin.head.html"); ?>
<?php echo file_get_contents("static/welcomePageAdditionalContent.html"); ?>
<?php echo file_get_contents("static/settingsToolbarAdditionalContent.html"); ?>
</head>
<body>
<?php echo file_get_contents("body.html"); ?>
<div id="react"></div>
</body>
</html>
|
Comments (1)
You can clone a snippet to your computer for local editing. Learn more.
The script from line 151 to 201 is about getting getting accessToken from Okta and inputing it to Jitsi.
From this app https://d1n7j1lsem6fu8.cloudfront.net/sa/my-team?organizationId=1, I saw okta writes accessToken into localStorage and I can use that to authenticate.
Also, debugging Jitsi code I found two entries on localStorage are read by Jitsi:
xmpp_username_override
andxmpp_username_override
and I can hook on these to provide authentication info to Jitsi.