-
Notifications
You must be signed in to change notification settings - Fork 19
/
downstream-electron-fe.js
2 lines (2 loc) · 57.7 KB
/
downstream-electron-fe.js
1
2
/*! For license information please see downstream-electron-fe.js.LICENSE.txt */
!function(Q,B){if("object"==typeof exports&&"object"==typeof module)module.exports=B();else if("function"==typeof define&&define.amd)define([],B);else{var F=B();for(var U in F)("object"==typeof exports?exports:Q)[U]=F[U]}}(global,(()=>(()=>{"use strict";var __webpack_modules__={5434:module=>{eval("/*eslint no-console: [\"error\", { allow: [\"warn\", \"error\", \"info\"] }] */\n\n\nvar WIDEVINE_SCHEME_ID_URI = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed';\nvar downstreamElectronFE;\nfunction serialize(obj) {\n return JSON.stringify(obj);\n}\nfunction getWidevinePSSH(info) {\n var manifestProtections = info.manifestInfo.protections;\n var videoRepresentation = manifestProtections.video[0] || {};\n if (manifestProtections.video && info.manifest.video) {\n videoRepresentation = manifestProtections.video.filter(function (manifestProtection) {\n return info.manifest.video.indexOf(manifestProtection.id) >= 0;\n });\n videoRepresentation = videoRepresentation[0] || {};\n }\n var protections = videoRepresentation.protections || [];\n var widevinePSSH;\n for (var i = 0, j = protections.length; i < j; i++) {\n if (protections[i].schemeIdUri === WIDEVINE_SCHEME_ID_URI) {\n widevinePSSH = protections[i].cencPSSH;\n break;\n }\n }\n return widevinePSSH;\n}\nfunction bind(scope, f) {\n return function bindF() {\n f.apply(scope, arguments);\n };\n}\nfunction bindAll(scope) {\n for (var i = 1, j = arguments.length; i < j; i++) {\n var fName = arguments[i];\n scope[fName] = bind(scope, scope[fName]);\n }\n}\nfunction clonePersistentConfig(config) {\n // deep clone the config\n var clonedConfig = JSON.parse(JSON.stringify(config));\n if (typeof config.serverCertificate !== 'undefined') {\n clonedConfig.serverCertificate = config.serverCertificate;\n }\n if (typeof config.licenseRequest === 'function') {\n clonedConfig.licenseRequest = config.licenseRequest;\n }\n if (typeof config.licenseResponse === 'function') {\n clonedConfig.licenseResponse = config.licenseResponse;\n }\n return clonedConfig;\n}\n\n/**\n * @constructor\n * @namespace DownstreamElectronFE\n * @param {object} window - window object from renderer window\n * @param {Persistent} persistent - persistent helper class for creating and removing persistent session\n * @property {DownstreamElectronFE.downloads} downloads - api for downloads\n * @description\n * this a bridge class for [DownstreamElectronBE]{@link DownstreamElectronBE}\n * all methods described in ({@link DownstreamElectronFE.downloads})\n */\nfunction DownstreamElectronFE(window, persistent) {\n this._promisesObj = {};\n this._subscribersId = {};\n this._promiseCounter = 0;\n this._window = window;\n this._persistent = persistent;\n bindAll(this, '_processApi', '_beforeUnload');\n this._createApiMethods('downloads', ['create', 'createPersistent', 'getFolderInfo', 'getList', 'getListWithInfo', 'getOfflineLink', 'info', 'remove', 'removeAll', 'removeAllUnfinished', 'removePersistent', 'resume', 'saveData', 'savePersistent', 'start', 'stop', 'stopAll', 'subscribe', 'unsubscribe', 'updateDownloadFolder']);\n this._attachEvents();\n}\nDownstreamElectronFE.prototype.downloads = {};\n\n/**\n * Creates a persistent session in renderer process using external plugin defined as {@link Persistent}\n * @param {array} args - arguments\n * @param {function} resolve - should called on success\n * @param {function} reject - should called on failure\n * @returns {void}\n */\nDownstreamElectronFE.prototype.downloads.createPersistent = function (args, resolve, reject) {\n var manifestId = args[0];\n var config = clonePersistentConfig(args[1]);\n var forced = args[2];\n var scope = this;\n if (this._persistent) {\n this.downloads.info(manifestId).then(function (info) {\n if (!info) {\n reject(\"Manifest with id='\" + manifestId + \"' not found.\");\n return;\n }\n var existingPersistentSessionId = info.persistent;\n if (existingPersistentSessionId && !forced) {\n reject('persistent session already exists:' + JSON.stringify(existingPersistentSessionId));\n } else {\n if (!config.pssh) {\n config.pssh = getWidevinePSSH(info);\n }\n scope._persistent.createPersistentSession(config).then(function (persistentSessionId) {\n scope.downloads.savePersistent(manifestId, persistentSessionId).then(function () {\n if (existingPersistentSessionId) {\n scope._persistent.removePersistentSession(existingPersistentSessionId).then(function () {\n resolve(persistentSessionId);\n })[\"catch\"](function () {\n resolve(persistentSessionId);\n });\n } else {\n resolve(persistentSessionId);\n }\n }, reject);\n }, reject);\n }\n }, reject);\n } else {\n reject('No persistent plugin initialized');\n }\n};\n\n/**\n * Removes a persistent session in renderer process using external plugin defined as {@link Persistent}\n * @param {array} args - arguments\n * @param {function} resolve - should called on success\n * @param {function} reject - should called on failure\n * @param {object} manifest - full information about manifest\n * @returns {void}\n */\nDownstreamElectronFE.prototype.downloads.removePersistent = function (args, resolve, reject, manifest) {\n if (this._persistent) {\n if (manifest && manifest.persistent) {\n this._persistent.removePersistentSession(manifest.persistent).then(resolve, reject);\n } else {\n resolve();\n }\n } else {\n reject('No persistent plugin initialized');\n }\n};\n\n/**\n * Removes a manifest - this is needed on renderer process to check for existence of persistent session\n * and then remove it if necessary\n * @param {array} args - arguments\n * @param {function} resolve - should called on success\n * @param {function} reject - should called on failure\n * @param {object} manifest - full information about manifest\n * @returns {void}\n */\nDownstreamElectronFE.prototype.downloads.remove = function (args, resolve, reject, manifest) {\n var scope = this;\n if (this._persistent && manifest && manifest.persistent) {\n scope._persistent.removePersistentSession(manifest.persistent).then(resolve, reject);\n } else {\n resolve();\n }\n};\n\n/**\n * Removes all manifests - this is needed on renderer process to check for existence of persistent sessions\n * and then remove them if necessary\n * @param {array} args - arguments\n * @param {function} resolve - should called on success\n * @param {function} reject - should called on failure\n * @param {object} manifests - full information about all manifests\n * @returns {void}\n */\nDownstreamElectronFE.prototype.downloads.removeAll = function (args, resolve, reject, manifests) {\n var scope = this;\n manifests = manifests || [];\n var filtered = manifests.filter(function (manifest) {\n return !!manifest.persistent;\n });\n var persistentArr = filtered.map(function (manifest) {\n return manifest.persistent;\n });\n if (this._persistent && persistentArr.length > 0) {\n var promises = [];\n for (var i = 0, j = persistentArr.length; i < j; i++) {\n promises.push(scope._persistent.removePersistentSession(persistentArr[i]));\n }\n Promise.all(promises).then(resolve, reject);\n } else {\n resolve();\n }\n};\n\n/**\n * @param {string} method - method name\n * @param {object} args - arguments\n * @param {function} originalMethod - method to ba called on renderer when main process finishes\n * @private\n * @returns {Promise} - promise\n */\nDownstreamElectronFE.prototype._apiCall = function (method, args, originalMethod) {\n var self = this;\n var promiseId = this._generatePromiseId();\n var promise = new Promise(function (resolve, reject) {\n self._promisesObj[promiseId] = {\n resolve: resolve,\n reject: reject,\n method: method,\n args: args,\n originalMethod: originalMethod\n };\n });\n var request = {};\n request.promiseId = promiseId;\n request.method = method;\n request.args = serialize(args);\n this._send(request);\n return promise;\n};\n\n/**\n *\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._attachEvents = function () {\n var _this = this;\n this._window.downstreamElectronAPI.receive('downstreamElectronFE', this._processApi);\n this._window.onbeforeunload = function (e) {\n _this._beforeUnload();\n // Unlike usual browsers that a message box will be prompted to users, returning\n // a non-void value will silently cancel the close.\n // It is recommended to use the dialog API to let the user confirm closing the\n // application.\n e.returnValue = false;\n };\n};\n\n/**\n *\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._beforeUnload = function () {\n this._removeSubscribers();\n};\n\n/**\n *\n * @private\n * @param {string} namespace - namespace\n * @param {array} methods - methods name array\n * @returns {\n * void}\n */\nDownstreamElectronFE.prototype._createApiMethods = function (namespace, methods) {\n function apiFunction(scope, name, originalMethod) {\n return function () {\n return scope._apiCall(name, arguments, originalMethod);\n };\n }\n this[namespace] = this[namespace] || {};\n function createApiMethod(scope, namespace, name) {\n var originalMethod;\n if (typeof scope[namespace][name] === 'function') {\n originalMethod = scope[namespace][name];\n }\n scope[namespace][name] = apiFunction(scope, namespace + '.' + name, originalMethod);\n }\n for (var i = 0, j = methods.length; i < j; i++) {\n createApiMethod(this, namespace, methods[i]);\n }\n};\n\n/**\n * @private\n * @param {string} subscriberId - subscriber identifier\n * @param {object} err - error\n * @param {object} result - result\n * @param {boolean} subscriberFinished - information if the subscriber is the last one which helps to remove subscribers\n * for finished downloads\n * @returns {void}\n */\nDownstreamElectronFE.prototype._executeSubscriber = function (subscriberId, err, result, subscriberFinished) {\n var subscriber = this._subscribersId[subscriberId];\n if (subscriber) {\n subscriber.callback(err, result);\n } else {\n //ignore wrong window\n }\n if (subscriberFinished && subscriber) {\n this._removeLocalSubscribers(subscriber.manifestId);\n }\n};\n\n/**\n *\n * @private\n * @returns {string} - promise identifier\n */\nDownstreamElectronFE.prototype._generatePromiseId = function () {\n var ts = new Date().getTime();\n var promiseId;\n this._promiseCounter++;\n promiseId = this._promiseCounter + '-' + ts;\n return promiseId;\n};\n\n/**\n * @private\n * @param {object} obj - object to be processed\n * @param {object} evt - event\n * @returns {void}\n */\nDownstreamElectronFE.prototype._processApi = function (obj, evt) {\n var promiseId = evt.promiseId;\n var error = evt.error;\n var result = evt.result;\n var promiseObj = this._promisesObj[promiseId + ''];\n function resolve(result) {\n promiseObj.resolve(result);\n this._removeLocalSubscribersForDefinedMethods(promiseObj.method, promiseObj.args[0] || result);\n }\n if (promiseObj) {\n if (evt.status === 'OK') {\n if (typeof promiseObj.originalMethod === 'function') {\n promiseObj.originalMethod.call(this, promiseObj.args, resolve.bind(this), promiseObj.reject.bind(this), result);\n } else {\n resolve.call(this, result);\n }\n } else {\n promiseObj.reject(error);\n }\n if (evt.subscribersId) {\n this._saveSubscribersId(promiseObj, evt.subscribersId);\n }\n delete this._promisesObj[promiseId];\n } else if (evt.subscriberId) {\n this._executeSubscriber(evt.subscriberId, evt.err, result, evt.subscriberFinished);\n } else {\n //ignore different window\n }\n};\n\n/**\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._removeSubscribers = function () {\n var request = {};\n var subscribersId;\n subscribersId = [];\n for (var key in this._subscribersId) {\n if (this._subscribersId.hasOwnProperty(key)) {\n subscribersId.push(key);\n }\n }\n request.method = 'removeSubscribers';\n request.args = serialize([subscribersId]);\n this._send(request);\n};\n\n/**\n * @param {string|array} manifestId - manifest identifier or array of manifests identifier\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._removeLocalSubscribers = function (manifestId) {\n var self = this;\n if (typeof manifestId === 'string') {\n manifestId = [manifestId];\n } else if (manifestId instanceof Array) {\n manifestId = manifestId.map(function (item) {\n if (typeof item === 'string') {\n return item;\n } else {\n return item.manifestInfo && item.manifestInfo.id;\n }\n });\n }\n function removeSubscribers(subscriberKey) {\n for (var i = 0, j = manifestId.length; i < j; i++) {\n if (typeof self._subscribersId[subscriberKey].manifestId === 'string') {\n if (self._subscribersId[subscriberKey].manifestId === manifestId[i]) {\n delete self._subscribersId[subscriberKey];\n break;\n }\n } else {\n var pos = self._subscribersId[subscriberKey].manifestId.indexOf(manifestId[i]);\n if (pos >= 0) {\n self._subscribersId[subscriberKey].manifestId.splice(pos, 1);\n }\n if (!self._subscribersId[subscriberKey].manifestId.length) {\n delete self._subscribersId[subscriberKey];\n break;\n }\n }\n }\n }\n if (manifestId) {\n for (var key in this._subscribersId) {\n if (this._subscribersId.hasOwnProperty(key)) {\n removeSubscribers(key);\n }\n }\n } else {\n this._subscribersId = {};\n }\n};\n\n/**\n *\n * @param {string} method - method name\n * @param {string|array} manifestId - manifest identifier or array of manifests identifier\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._removeLocalSubscribersForDefinedMethods = function (method, manifestId) {\n var methods = ['downloads.stop', 'downloads.stopAll', 'downloads.remove', 'downloads.removeAll', 'downloads.removeAllUnfinished', 'downloads.unsubscribe'];\n // remove all subscribers when user removes or stop all\n if (method === 'downloads.removeAll' || method === 'downloads.stopAll') {\n manifestId = undefined;\n }\n for (var i = 0, j = methods.length; i < j; i++) {\n if (method === methods[i]) {\n this._removeLocalSubscribers(manifestId);\n break;\n }\n }\n};\n/**\n * @param {Promise} promise - promise\n * @param {string} subscribersId - subscriber identifier\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._saveSubscribersId = function (promise, subscribersId) {\n var i, j;\n if (typeof subscribersId === 'string' || typeof subscribersId === 'number') {\n subscribersId = [String(subscribersId)];\n }\n for (i = 0, j = subscribersId.length; i < j; i++) {\n this._subscribersId[subscribersId[i]] = {\n manifestId: promise.args[0],\n callback: promise.args[2 + i]\n };\n }\n};\n\n/**\n * @param {object} request - request\n * @private\n * @returns {void}\n */\nDownstreamElectronFE.prototype._send = function (request) {\n try {\n this._window.downstreamElectronAPI.send('downstreamElectronBE', request);\n } catch (e) {\n console.error(e);\n }\n};\n\n//---------------------------\nmodule.exports = {\n /**\n * @function\n * @name DownstreamElectronFE#init\n * @param {object} window - window object from renderer window\n * @param {Persistent} persistent - persistent helper class for creating and removing persistent session\n * @description\n * initialize the api in render process\n * @returns {DownstreamElectronFE} DownstreamElectronFE\n * @example\n * // somewhere in the renderer process\n * // this is example based on persistent plugin from {@link https://castlabs.com/products/prestoplay-desktop/|PRESTOplay for Desktops},\n * // you can create its own too, for details click on >> {@link Persistent} <<\n * const persistent = require('./clpp_persistent.plugin.min');\n * const downstreamElectron = require(\"downstream-electron\").init(window, persistent);\n */\n init: function init(window, persistent) {\n if (!downstreamElectronFE) {\n downstreamElectronFE = new DownstreamElectronFE(window, persistent);\n }\n return downstreamElectronFE;\n }\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTQzNC5qcyIsIm1hcHBpbmdzIjoiQUFBQTtBQUNhOztBQUNiLElBQU1BLHNCQUFzQixHQUFHLCtDQUErQztBQUU5RSxJQUFJQyxvQkFBb0I7QUFFeEIsU0FBU0MsU0FBU0EsQ0FBRUMsR0FBRyxFQUFFO0VBQ3ZCLE9BQU9DLElBQUksQ0FBQ0MsU0FBUyxDQUFDRixHQUFHLENBQUM7QUFDNUI7QUFFQSxTQUFTRyxlQUFlQSxDQUFFQyxJQUFJLEVBQUU7RUFDOUIsSUFBTUMsbUJBQW1CLEdBQUdELElBQUksQ0FBQ0UsWUFBWSxDQUFDQyxXQUFXO0VBQ3pELElBQUlDLG1CQUFtQixHQUFHSCxtQkFBbUIsQ0FBQ0ksS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQztFQU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CJTdHJpbmciLCJzZW5kIiwiY29uc29sZSIsIm1vZHVsZSIsImV4cG9ydHMiLCJpbml0Il0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///5434\n")}},__webpack_module_cache__={};function __webpack_require__(Q){var B=__webpack_module_cache__[Q];if(void 0!==B)return B.exports;var F=__webpack_module_cache__[Q]={exports:{}};return __webpack_modules__[Q](F,F.exports,__webpack_require__),F.exports}var __webpack_exports__=__webpack_require__(5434);return __webpack_exports__})()));