Automatically initializes Chrome Web Store inline install URL with extension ID defined in config.js.
This commit is contained in:
parent
0fe46675de
commit
83a685bca6
5
app.js
5
app.js
|
@ -1044,6 +1044,11 @@ $(document).ready(function () {
|
||||||
|
|
||||||
// Set default desktop sharing method
|
// Set default desktop sharing method
|
||||||
setDesktopSharing(config.desktopSharing);
|
setDesktopSharing(config.desktopSharing);
|
||||||
|
// Initialize Chrome extension inline installs
|
||||||
|
if(config.chromeExtensionId)
|
||||||
|
{
|
||||||
|
initInlineInstalls();
|
||||||
|
}
|
||||||
|
|
||||||
// By default we use camera
|
// By default we use camera
|
||||||
getVideoSize = getCameraVideoSize;
|
getVideoSize = getCameraVideoSize;
|
||||||
|
|
|
@ -74,6 +74,25 @@ function showDesktopSharingButton() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes <link rel=chrome-webstore-item /> with extension id set in config.js to support inline installs.
|
||||||
|
* Host site must be selected as main website of published extension.
|
||||||
|
*/
|
||||||
|
function initInlineInstalls()
|
||||||
|
{
|
||||||
|
$("link[rel=chrome-webstore-item]").attr("href", getWebStoreInstallUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs inline install URL for Chrome desktop streaming extension.
|
||||||
|
* The 'chromeExtensionId' must be defined in config.js.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function getWebStoreInstallUrl()
|
||||||
|
{
|
||||||
|
return "https://chrome.google.com/webstore/detail/" + config.chromeExtensionId;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Toggles screen sharing.
|
* Toggles screen sharing.
|
||||||
*/
|
*/
|
||||||
|
@ -168,7 +187,7 @@ function obtainScreenFromExtension(streamCallback, failCallback) {
|
||||||
doGetStreamFromExtension(streamCallback, failCallback);
|
doGetStreamFromExtension(streamCallback, failCallback);
|
||||||
} else {
|
} else {
|
||||||
chrome.webstore.install(
|
chrome.webstore.install(
|
||||||
"https://chrome.google.com/webstore/detail/" + config.chromeExtensionId,
|
getWebStoreInstallUrl(),
|
||||||
function(arg) {
|
function(arg) {
|
||||||
console.log("Extension installed successfully", arg);
|
console.log("Extension installed successfully", arg);
|
||||||
// We need to reload the page in order to get the access to chrome.runtime
|
// We need to reload the page in order to get the access to chrome.runtime
|
||||||
|
@ -188,7 +207,6 @@ function checkExtInstalled(isInstalledCallback) {
|
||||||
if(!chrome.runtime) {
|
if(!chrome.runtime) {
|
||||||
// No API, so no extension for sure
|
// No API, so no extension for sure
|
||||||
isInstalledCallback(false);
|
isInstalledCallback(false);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
chrome.runtime.sendMessage(
|
chrome.runtime.sendMessage(
|
||||||
config.chromeExtensionId,
|
config.chromeExtensionId,
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<link rel="stylesheet" href="css/modaldialog.css?v=3">
|
<link rel="stylesheet" href="css/modaldialog.css?v=3">
|
||||||
<!--
|
<!--
|
||||||
Link used for inline installation of chrome desktop streaming extension,
|
Link used for inline installation of chrome desktop streaming extension,
|
||||||
must contain the same extension id as defined in config.js -->
|
is updated automatically from the code with the value defined in config.js -->
|
||||||
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/diibjkoicjeejcmhdnailmkgecihlobk">
|
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/diibjkoicjeejcmhdnailmkgecihlobk">
|
||||||
<script src="libs/jquery-impromptu.js"></script>
|
<script src="libs/jquery-impromptu.js"></script>
|
||||||
<script src="libs/jquery.autosize.js"></script>
|
<script src="libs/jquery.autosize.js"></script>
|
||||||
|
|
Loading…
Reference in New Issue