diff --git a/bower.json b/bower.json
index afa2e3784..b04ff3a6b 100644
--- a/bower.json
+++ b/bower.json
@@ -38,6 +38,7 @@
"scrypt-async": "1.2.0",
"require-css": "0.1.10",
"less": "^2.7.2",
- "bootstrap": "#v4.0.0-alpha.6"
+ "bootstrap": "#v4.0.0-alpha.6",
+ "diff-dom": "2.1.1"
}
}
diff --git a/rpc.js b/rpc.js
index 3a97dc80d..5b5d058b9 100644
--- a/rpc.js
+++ b/rpc.js
@@ -583,9 +583,10 @@ var resetUserPins = function (Env, publicKey, channelList, cb) {
if (e) { return void cb(e); }
var pinSize = sumChannelSizes(sizes);
- getFreeSpace(Env, publicKey, function (e, free) {
+
+ getLimit(Env, publicKey, function (e, limit) {
if (e) {
- WARN('getFreeSpace', e);
+ WARN('[RESET_ERR]', e);
return void cb(e);
}
@@ -597,7 +598,7 @@ var resetUserPins = function (Env, publicKey, channelList, cb) {
They will not be able to pin additional pads until they upgrade
or delete enough files to go back under their limit. */
- if (pinSize > free && session.hasPinned) { return void(cb('E_OVER_LIMIT')); }
+ if (pinSize > limit && session.hasPinned) { return void(cb('E_OVER_LIMIT')); }
pinStore.message(publicKey, JSON.stringify(['RESET', channelList]),
function (e) {
if (e) { return void cb(e); }
@@ -1087,8 +1088,8 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
return void handleMessage(false);
}
- // restrict upload capability unless explicitly disabled
- if (config.restrictUploads === false) {
+ // allow unrestricted uploads unless restrictUploads is true
+ if (config.restrictUploads !== true) {
return void handleMessage(true);
}
diff --git a/www/code/main.js b/www/code/main.js
index f9a6a0c63..68d9c68bc 100644
--- a/www/code/main.js
+++ b/www/code/main.js
@@ -9,7 +9,6 @@ define([
'/common/cryptpad-common.js',
'/common/cryptget.js',
'/common/diffMarked.js',
- '/bower_components/tweetnacl/nacl-fast.min.js', // needed for media-tag
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less'
diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js
index 412a0f693..f2bf0d08e 100644
--- a/www/common/cryptpad-common.js
+++ b/www/common/cryptpad-common.js
@@ -16,9 +16,10 @@ define([
'/common/clipboard.js',
'/common/pinpad.js',
- '/customize/application_config.js'
+ '/customize/application_config.js',
+ '/common/media-tag.js',
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
- CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig) {
+ CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig, MediaTag) {
/* This file exposes functionality which is specific to Cryptpad, but not to
any particular pad type. This includes functions for committing metadata
@@ -830,7 +831,9 @@ define([
if (!pinsReady()) { return void cb('RPC_NOT_READY'); }
var account = common.account;
- if (typeof(account.limit) !== 'number' ||
+
+ var ALWAYS_REVALIDATE = true;
+ if (ALWAYS_REVALIDATE || typeof(account.limit) !== 'number' ||
typeof(account.plan) !== 'string' ||
typeof(account.note) !== 'string') {
return void rpc.getLimit(function (e, limit, plan, note) {
@@ -893,7 +896,6 @@ define([
var $container = $('', {'class':'limit-container'});
var todo;
var updateUsage = window.updateUsage = common.notAgainForAnother(function () {
- console.log("updating usage bar");
common.getPinnedUsage(todo);
}, LIMIT_REFRESH_RATE);
@@ -963,21 +965,12 @@ define([
};
setInterval(function () {
- var t = updateUsage();
- if (t) {
- console.log("usage already updated. eligible for refresh in %sms", t);
- }
+ updateUsage();
}, LIMIT_REFRESH_RATE * 3);
updateUsage();
getProxy().on('change', ['drive'], function () {
- var t = updateUsage();
- if (t) {
- console.log("usage bar update throttled due to overuse." +
- " Eligible for update in %sms", t);
- } else {
- console.log("usage bar updated");
- }
+ updateUsage();
});
cb(null, $container);
};
@@ -1231,18 +1224,18 @@ define([
}
if (decrypted.blob) {
- size = decrypted.blob.size
+ size = decrypted.blob.size;
}
- var sizeMb = Cryptpad.bytesToMegabytes(size);
+ var sizeMb = common.bytesToMegabytes(size);
var $btn = $(root).find('button');
$btn.addClass('btn btn-success')
.attr('type', 'download')
- .html(function (i, html) {
+ .html(function () {
var text = Messages.download_mt_button + '
';
if (title) {
- text += '' + Cryptpad.fixHTML(title) + '
';
+ text += '' + common.fixHTML(title) + '
';
}
if (size) {
text += '' + Messages._getKey('formattedMB', [sizeMb]) + '';
@@ -1284,35 +1277,32 @@ define([
var $img = $('').appendTo($container);
$img.attr('src', src);
$img.attr('data-crypto-key', 'cryptpad:' + cryptKey);
- require(['/common/media-tag.js'], function (MediaTag) {
- MediaTag($img[0]);
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (mutation.type === 'childList' && mutation.addedNodes.length) {
- console.log(mutation);
- if (mutation.addedNodes.length > 1 ||
- mutation.addedNodes[0].nodeName !== 'IMG') {
- $img.remove();
- return void displayDefault();
- }
- var $image = $img.find('img');
- var onLoad = function () {
- var w = $image.width();
- var h = $image.height();
- if (w>h) {
- $image.css('max-height', '100%');
- $img.css('flex-direction', 'row');
- if (cb) { cb($img); }
- return;
- }
- $image.css('max-width', '100%');
- $img.css('flex-direction', 'column');
- if (cb) { cb($img); }
- };
- if ($image[0].complete) { onLoad(); }
- $image.on('load', onLoad);
+ MediaTag($img[0]);
+ var observer = new MutationObserver(function(mutations) {
+ mutations.forEach(function(mutation) {
+ if (mutation.type === 'childList' && mutation.addedNodes.length) {
+ if (mutation.addedNodes.length > 1 ||
+ mutation.addedNodes[0].nodeName !== 'IMG') {
+ $img.remove();
+ return void displayDefault();
}
- });
+ var $image = $img.find('img');
+ var onLoad = function () {
+ var w = $image.width();
+ var h = $image.height();
+ if (w>h) {
+ $image.css('max-height', '100%');
+ $img.css('flex-direction', 'row');
+ if (cb) { cb($img); }
+ return;
+ }
+ $image.css('max-width', '100%');
+ $img.css('flex-direction', 'column');
+ if (cb) { cb($img); }
+ };
+ if ($image[0].complete) { onLoad(); }
+ $image.on('load', onLoad);
+ }
});
observer.observe($img[0], {
attributes: false,
diff --git a/www/common/media-tag.js b/www/common/media-tag.js
index d919d1965..2d9a0180e 100644
--- a/www/common/media-tag.js
+++ b/www/common/media-tag.js
@@ -1 +1 @@
-(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["MediaTag"]=factory();else root["MediaTag"]=factory()})(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.i=function(value){return value};__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=86)}([function(module,exports,__webpack_require__){"use strict";var Identifier={IMAGE:"image",AUDIO:"audio",VIDEO:"video",PDF:"pdf",DASH:"dash",DOWNLOAD:"download",CRYPTO:"crypto",CLEAR_KEY:"clear-key",MEDIA_OBJECT:"media-object"};module.exports=Identifier},function(module,exports,__webpack_require__){"use strict";var Type={MATCHER:"matcher",RENDERER:"renderer",FILTER:"filter",SANITIZER:"sanitizer"};module.exports=Type},function(module,exports,__webpack_require__){"use strict";var ProcessingEngine=__webpack_require__(25);var MatchingEngine=__webpack_require__(24);var PluginStore=__webpack_require__(44);var UriStore=__webpack_require__(45);var Parser=__webpack_require__(23);var MediaObject=__webpack_require__(22);function MediaTag(elements){if(elements instanceof Array){var mediaObjects=[];elements.forEach(function(element){if(element.mediaObject){mediaObjects.push(element.mediaObject)}else{mediaObjects.push(MediaTag.start(element))}});return mediaObjects}var element=elements;return MediaTag.start(element)}MediaTag.createMediaObject=function(element){var mediaObject=new MediaObject(element);var properties=Parser.parse(mediaObject);mediaObject.setProperties(properties);return mediaObject};MediaTag.start=function(element){var mediaObject=MediaTag.createMediaObject(element);return MediaTag.processingEngine.start(mediaObject)};MediaTag.pluginStore=MediaTag.pluginStore||new PluginStore;MediaTag.uriStore=MediaTag.uriStore||new UriStore("../plugins");MediaTag.processingEngine=MediaTag.processingEngine||new ProcessingEngine(MediaTag.pluginStore);MediaTag.matchingEngine=MediaTag.matchingEngine||new MatchingEngine(MediaTag.pluginStore,MediaTag.uriStore);MediaTag.loadingEngine=null;module.exports=MediaTag},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0){CryptoFilter.mediaTypes.splice(index,1)}};CryptoFilter.removeAllAllowedMediaTypes=function(mediaTypes){mediaTypes.forEach(function(mediaType){CryptoFilter.removeAllowedMediaType(mediaType)})};CryptoFilter.isAllowedMediaType=function(mediaType){return CryptoFilter.mediaTypes.some(function(type){return type===mediaType})};module.exports=CryptoFilter},,function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i MediaTag cannot find a plugin able to renderer your content
","Download");MediaTag.processingEngine.setDefaultPlugin(defaultPlugin);MediaTag.CryptoFilter=CryptoFilter;var allowedMediaTypes=["image/png","image/jpeg","image/jpg","image/gif","audio/mp3","audio/ogg","audio/wav","audio/webm","video/mp4","video/ogg","video/webm","application/pdf","application/dash+xml","download"];MediaTag.CryptoFilter.setAllowedMediaTypes(allowedMediaTypes);var Configuration=__webpack_require__(21);var Permission=__webpack_require__(13);var Identifier=__webpack_require__(0);var configuration=new Configuration;MediaTag.processingEngine.configure(configuration);module.exports=MediaTag},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Type=__webpack_require__(1);var Occurrence=__webpack_require__(5);var Plugin=__webpack_require__(6);var Sanitizer=function(_Plugin){_inherits(Sanitizer,_Plugin);function Sanitizer(identifier){_classCallCheck(this,Sanitizer);return _possibleConstructorReturn(this,(Sanitizer.__proto__||Object.getPrototypeOf(Sanitizer)).call(this,identifier,Type.SANITIZER,Occurrence.EVERY))}return Sanitizer}(Plugin);module.exports=Sanitizer},,,function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i1){if(PARANOIA){if(typeof N[l]!=="number"){throw new Error("E_UNSAFE_TYPE")}if(N[l]>255){throw new Error("E_OUT_OF_BOUNDS")}}if(N[l]!==255){return void N[l]++}N[l]=0;if(l===0){throw new Error("E_NONCE_TOO_LARGE")}}}},{key:"encodePrefix",value:function encodePrefix(p){return[65280,255].map(function(n,i){return(p&n)>>(1-i)*8})}},{key:"decodePrefix",value:function decodePrefix(A){return A[0]<<8|A[1]}},{key:"joinChunks",value:function joinChunks(chunks){return new Blob(chunks)}},{key:"slice",value:function slice(u8){return Array.prototype.slice.call(u8)}},{key:"getRandomKeyStr",value:function getRandomKeyStr(){var Nacl=Cryptopad.Nacl;var rdm=Nacl.randomBytes(18);return Nacl.util.encodeBase64(rdm)}},{key:"getKeyFromStr",value:function getKeyFromStr(str){return Cryptopad.Nacl.util.decodeBase64(str)}},{key:"encrypt",value:function encrypt(u8,key){var array=u8;var nonce=Cryptopad.Nacl.randomBytes(24);var packed=Cryptopad.Nacl.secretbox(array,nonce,key);if(packed){return new Uint8Array(Cryptopad.slice(nonce).concat(Cryptopad.slice(packed)))}throw new Error}},{key:"decrypt",value:function decrypt(u8,key,done){var Nacl=Cryptopad.Nacl;var progress=function progress(offset){var ev=new Event("decryptionProgress");ev.percent=offset/u8.length*100;window.document.dispatchEvent(ev)};var nonce=Cryptopad.createNonce();var i=0;var prefix=u8.subarray(0,2);var metadataLength=Cryptopad.decodePrefix(prefix);var res={metadata:undefined};var metaBox=new Uint8Array(u8.subarray(2,2+metadataLength));var metaChunk=Nacl.secretbox.open(metaBox,nonce,key);Cryptopad.increment(nonce);try{res.metadata=JSON.parse(Nacl.util.encodeUTF8(metaChunk))}catch(e){return done("E_METADATA_DECRYPTION")}if(!res.metadata){return done("NO_METADATA")}var takeChunk=function takeChunk(cb){setTimeout(function(){var start=i*cypherChunkLength+2+metadataLength;var end=start+cypherChunkLength;i++;var box=new Uint8Array(u8.subarray(start,end));var plaintext=Nacl.secretbox.open(box,nonce,key);Cryptopad.increment(nonce);if(!plaintext){return void cb("DECRYPTION_FAILURE")}progress(Math.min(end,u8.length));cb(void 0,plaintext)})};var chunks=[];var again=function again(){takeChunk(function(e,plaintext){if(e){return setTimeout(function(){done(e)})}if(plaintext){if(i*cypherChunkLength1){return array[0]}return window.location.protocol}},{key:"hostname",value:function hostname(mediaObject){var array=mediaObject.getAttribute("src").split("://");if(array.length>1){return array[1].split("/")[0]}return window.location.hostname}},{key:"source",value:function source(mediaObject){var source=mediaObject.getAttribute("src");return source}},{key:"schemes",value:function schemes(mediaObject){return/\w+:/.exec(mediaObject.getAttribute("src"))}},{key:"parse",value:function parse(mediaObject){return{protocol:Parser.protocol(mediaObject),hostname:Parser.hostname(mediaObject),src:Parser.source(mediaObject),type:Parser.type(mediaObject),extension:Parser.extension(mediaObject),mime:Parser.mime(mediaObject)}}}]);return Parser}();module.exports=Parser},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i=ProcessingEngine.STACK_LIMIT){console.error(this.snapshots[stackId]);throw new Error("Plugin stack size exceed")}if(this.snapshots[stackId].length>=ProcessingEngine.SNAPSHOT_LIMIT){console.error(this.snapshots[stackId]);throw new Error("Plugin snapshots size exceed")}var rendererCount=0;this.stacks[stackId].forEach(function(plugin){if(plugin.type===Type.RENDERER){rendererCount++}});if(rendererCount>1){console.error(this.snapshots[stackId]);throw new Error("More of one renderer in the stack")}if(this.stacks[stackId].length===0&&!this.stats[stackId][Type.RENDERER]){if(!this.defaultPlugin){throw new Error("No default plugin assignated")}this.stacks[stackId].unshift(this.defaultPlugin)}}},{key:"return",value:function _return(mediaObject){var stackId=mediaObject.getId();var plugin=this.unstack(mediaObject);if(!this.stats[stackId]){this.stats[stackId]={}}if(this.stats[stackId][plugin.type]){this.stats[stackId][plugin.type]+=1}else{this.stats[stackId][plugin.type]=1}if(this.stacks[stackId].length===0&&plugin.type===Type.RENDERER){this.run(mediaObject)}else if(plugin.type!==Type.SANITIZER){this.fill(mediaObject)}this.snapshot(mediaObject);this.check(mediaObject);this.run(mediaObject)}},{key:"process",value:function process(mediaObject){var stackId=mediaObject.getId();var size=this.stacks[stackId].length;var plugin=this.stacks[stackId][size-1];if(plugin){plugin.process(mediaObject)}else{console.log(this.stacks);throw new Error("Impossible to run a undefined plugin")}}},{key:"isStacked",value:function isStacked(mediaObject,plugin){var stackId=mediaObject.getId();if(this.stacks[stackId]){if(this.stacks[stackId].includes(plugin)){return true}}return false}},{key:"setDefaultPlugin",value:function setDefaultPlugin(plugin){this.defaultPlugin=plugin}}]);return ProcessingEngine}();ProcessingEngine.STACK_LIMIT=100;ProcessingEngine.SNAPSHOT_LIMIT=100;module.exports=ProcessingEngine},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0){CryptoFilter.mediaTypes.splice(index,1)}};CryptoFilter.removeAllAllowedMediaTypes=function(mediaTypes){mediaTypes.forEach(function(mediaType){CryptoFilter.removeAllowedMediaType(mediaType)})};CryptoFilter.isAllowedMediaType=function(mediaType){return CryptoFilter.mediaTypes.some(function(type){return type===mediaType})};module.exports=CryptoFilter},,function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i MediaTag cannot find a plugin able to renderer your content ","Download");MediaTag.processingEngine.setDefaultPlugin(defaultPlugin);MediaTag.CryptoFilter=CryptoFilter;var allowedMediaTypes=["image/png","image/jpeg","image/jpg","image/gif","audio/mp3","audio/ogg","audio/wav","audio/webm","video/mp4","video/ogg","video/webm","application/pdf","application/dash+xml","download"];MediaTag.CryptoFilter.setAllowedMediaTypes(allowedMediaTypes);var Configuration=__webpack_require__(21);var Permission=__webpack_require__(13);var Identifier=__webpack_require__(0);var configuration=new Configuration;MediaTag.processingEngine.configure(configuration);module.exports=MediaTag},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Type=__webpack_require__(1);var Occurrence=__webpack_require__(5);var Plugin=__webpack_require__(6);var Sanitizer=function(_Plugin){_inherits(Sanitizer,_Plugin);function Sanitizer(identifier){_classCallCheck(this,Sanitizer);return _possibleConstructorReturn(this,(Sanitizer.__proto__||Object.getPrototypeOf(Sanitizer)).call(this,identifier,Type.SANITIZER,Occurrence.EVERY))}return Sanitizer}(Plugin);module.exports=Sanitizer},,,function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i1){if(PARANOIA){if(typeof N[l]!=="number"){throw new Error("E_UNSAFE_TYPE")}if(N[l]>255){throw new Error("E_OUT_OF_BOUNDS")}}if(N[l]!==255){return void N[l]++}N[l]=0;if(l===0){throw new Error("E_NONCE_TOO_LARGE")}}}},{key:"encodePrefix",value:function encodePrefix(p){return[65280,255].map(function(n,i){return(p&n)>>(1-i)*8})}},{key:"decodePrefix",value:function decodePrefix(A){return A[0]<<8|A[1]}},{key:"joinChunks",value:function joinChunks(chunks){return new Blob(chunks)}},{key:"slice",value:function slice(u8){return Array.prototype.slice.call(u8)}},{key:"getRandomKeyStr",value:function getRandomKeyStr(){window.nacl.randomBytes(18);return window.nacl.util.encodeBase64(rdm)}},{key:"getKeyFromStr",value:function getKeyFromStr(str){return window.nacl.util.decodeBase64(str)}},{key:"encrypt",value:function encrypt(u8,key){var array=u8;var nonce=window.nacl.randomBytes(24);var packed=window.nacl.secretbox(array,nonce,key);if(packed){return new Uint8Array(Cryptopad.slice(nonce).concat(Cryptopad.slice(packed)))}throw new Error}},{key:"decrypt",value:function decrypt(u8,key,done){var Nacl=window.nacl;var progress=function progress(offset){var ev=new Event("decryptionProgress");ev.percent=offset/u8.length*100;window.document.dispatchEvent(ev)};var nonce=Cryptopad.createNonce();var i=0;var prefix=u8.subarray(0,2);var metadataLength=Cryptopad.decodePrefix(prefix);var res={metadata:undefined};var metaBox=new Uint8Array(u8.subarray(2,2+metadataLength));var metaChunk=window.nacl.secretbox.open(metaBox,nonce,key);Cryptopad.increment(nonce);try{res.metadata=JSON.parse(window.nacl.util.encodeUTF8(metaChunk))}catch(e){return done("E_METADATA_DECRYPTION")}if(!res.metadata){return done("NO_METADATA")}var takeChunk=function takeChunk(cb){setTimeout(function(){var start=i*cypherChunkLength+2+metadataLength;var end=start+cypherChunkLength;i++;var box=new Uint8Array(u8.subarray(start,end));var plaintext=window.nacl.secretbox.open(box,nonce,key);Cryptopad.increment(nonce);if(!plaintext){return void cb("DECRYPTION_FAILURE")}progress(Math.min(end,u8.length));cb(void 0,plaintext)})};var chunks=[];var again=function again(){takeChunk(function(e,plaintext){if(e){return setTimeout(function(){done(e)})}if(plaintext){if(i*cypherChunkLength1){return array[0]}return window.location.protocol}},{key:"hostname",value:function hostname(mediaObject){var array=mediaObject.getAttribute("src").split("://");if(array.length>1){return array[1].split("/")[0]}return window.location.hostname}},{key:"source",value:function source(mediaObject){var source=mediaObject.getAttribute("src");return source}},{key:"schemes",value:function schemes(mediaObject){return/\w+:/.exec(mediaObject.getAttribute("src"))}},{key:"parse",value:function parse(mediaObject){return{protocol:Parser.protocol(mediaObject),hostname:Parser.hostname(mediaObject),src:Parser.source(mediaObject),type:Parser.type(mediaObject),extension:Parser.extension(mediaObject),mime:Parser.mime(mediaObject)}}}]);return Parser}();module.exports=Parser},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i=ProcessingEngine.STACK_LIMIT){console.error(this.snapshots[stackId]);throw new Error("Plugin stack size exceed")}if(this.snapshots[stackId].length>=ProcessingEngine.SNAPSHOT_LIMIT){console.error(this.snapshots[stackId]);throw new Error("Plugin snapshots size exceed")}var rendererCount=0;this.stacks[stackId].forEach(function(plugin){if(plugin.type===Type.RENDERER){rendererCount++}});if(rendererCount>1){console.error(this.snapshots[stackId]);throw new Error("More of one renderer in the stack")}if(this.stacks[stackId].length===0&&!this.stats[stackId][Type.RENDERER]){if(!this.defaultPlugin){throw new Error("No default plugin assignated")}this.stacks[stackId].unshift(this.defaultPlugin)}}},{key:"return",value:function _return(mediaObject){var stackId=mediaObject.getId();var plugin=this.unstack(mediaObject);if(!this.stats[stackId]){this.stats[stackId]={}}if(this.stats[stackId][plugin.type]){this.stats[stackId][plugin.type]+=1}else{this.stats[stackId][plugin.type]=1}if(this.stacks[stackId].length===0&&plugin.type===Type.RENDERER){this.run(mediaObject)}else if(plugin.type!==Type.SANITIZER){this.fill(mediaObject)}this.snapshot(mediaObject);this.check(mediaObject);this.run(mediaObject)}},{key:"process",value:function process(mediaObject){var stackId=mediaObject.getId();var size=this.stacks[stackId].length;var plugin=this.stacks[stackId][size-1];if(plugin){plugin.process(mediaObject)}else{console.log(this.stacks);throw new Error("Impossible to run a undefined plugin")}}},{key:"isStacked",value:function isStacked(mediaObject,plugin){var stackId=mediaObject.getId();if(this.stacks[stackId]){if(this.stacks[stackId].includes(plugin)){return true}}return false}},{key:"setDefaultPlugin",value:function setDefaultPlugin(plugin){this.defaultPlugin=plugin}}]);return ProcessingEngine}();ProcessingEngine.STACK_LIMIT=100;ProcessingEngine.SNAPSHOT_LIMIT=100;module.exports=ProcessingEngine},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i', {'class': 'drawer'}).text(Messages.printText));
// TODO reenable this when it is working again
+ $printButton = $printButton;
//$drawer.append($printButton);
var $slideOptions = $('