Created
June 4, 2019 17:49
-
-
Save VinSpee/5e983714ff0764d3fe4cb9e71ffe18c4 to your computer and use it in GitHub Desktop.
Open links in BlueJeans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name BlueJeans Open In App | |
// @namespace https://vinspee.me | |
// @version 0.1 | |
// @license MIT | |
// @description Open BlueJeans meetings in the app | |
// @author Vince Speelman <[email protected]> | |
// @match *://*.bluejeans.com/* | |
// @grant window.close | |
// @require https://cdn.rawgit.com/agnoster/base32-js/91f43b82f19f467ade1270aa4b0e579b201d7efd/dist/base32.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const meetingIDFromURL = /^https?:\/\/(?:.+\.)?bluejeans.com\/(\d+)\/?/; // sloppy but dumb and working | |
const url = window.location; | |
const meetingID = meetingIDFromURL.exec(url)[1]; // get the meeting ID from the URL | |
const context = { | |
ctxver: '1.0.0', | |
meeting_api: window.location.origin, | |
meeting_id: meetingID, | |
release_channel: 'live', | |
}; // set the params we'll pass to the app | |
const encodedContext = window.base32 && window.base32.encode(JSON.stringify(context)); // encode the options in a format BJ is ok with. | |
console.log({ meetingID }); | |
const launchCommand = `bjnb://meeting/${encodedContext}?ctxver=${context.ctxver}`; // build the app link | |
window.location = launchCommand; // redirect to the app link | |
setTimeout(() => window.close(), 500); //close the bluejeans tab | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment