From 33dcd2ae286f667995d78a45273812192e9d08c6 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 11:08:20 +0200 Subject: [PATCH 01/10] drop black border from avatars in userlist --- customize.dist/src/less/toolbar.less | 1 - 1 file changed, 1 deletion(-) diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 8cb7a5a20..2b3135848 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -115,7 +115,6 @@ body .userlist-drawer { .avatar(30px); .default, media-tag { margin-right: 5px; - border: 1px solid black; } } } From 1aecdeb075ca54b01da6f5e74b7c1dae1670cc3a Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 11:08:39 +0200 Subject: [PATCH 02/10] fresh media tag build --- www/common/media-tag.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/media-tag.js b/www/common/media-tag.js index 87c835c58..b43220c84 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=95)}([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__(34);var MatchingEngine=__webpack_require__(33);var PluginStore=__webpack_require__(53);var UriStore=__webpack_require__(54);var MediaTag=__webpack_require__(31);function MediaTagAPI(elements){if(elements instanceof Array){var mediaObjects=[];elements.forEach(function(element){if(element.mediaObject){mediaObjects.push(element.mediaObject)}else{var _mediaTag=new MediaTag(element,MediaTagAPI.processingEngine);_mediaTag.mediaObjects.forEach(function(mediaObject){mediaObjects.push(MediaTagAPI.processingEngine.start(mediaObject))})}});return mediaObjects}var element=elements;var mediaTag=new MediaTag(element,MediaTagAPI.processingEngine);mediaTag.mediaObjects.forEach(function(mediaObject){MediaTagAPI.processingEngine.start(mediaObject)})}MediaTagAPI.pluginStore=MediaTagAPI.pluginStore||new PluginStore;MediaTagAPI.uriStore=MediaTagAPI.uriStore||new UriStore("../plugins");MediaTagAPI.processingEngine=MediaTagAPI.processingEngine||new ProcessingEngine(MediaTagAPI.pluginStore);MediaTagAPI.matchingEngine=MediaTagAPI.matchingEngine||new MatchingEngine(MediaTagAPI.pluginStore,MediaTagAPI.uriStore);MediaTagAPI.loadingEngine=null;module.exports=MediaTagAPI},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 hide=__webpack_require__(13);var show=__webpack_require__(14);module.exports=function(mediaObjectToActivate,mediaTag){mediaTag.mediaObjects.forEach(function(mediaObject){hide(mediaObject)});mediaTag.activeMediaObject=mediaObjectToActivate;show(mediaObjectToActivate)}},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i0}}]);return AttributesObject}();module.exports=AttributesObject},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 Errors={PluginExists:function(_Error){_inherits(PluginExists,_Error);function PluginExists(objPlugin){_classCallCheck(this,PluginExists);return _possibleConstructorReturn(this,(PluginExists.__proto__||Object.getPrototypeOf(PluginExists)).call(this,'Plugin with same "'+objPlugin.identifier+'" identifier found.'))}return PluginExists}(Error),TypeNotFound:function(_Error2){_inherits(TypeNotFound,_Error2);function TypeNotFound(){_classCallCheck(this,TypeNotFound);return _possibleConstructorReturn(this,(TypeNotFound.__proto__||Object.getPrototypeOf(TypeNotFound)).call(this,"Media Tag could not find the content type of an instance.}."))}return TypeNotFound}(Error),FilterExists:function(_Error3){_inherits(FilterExists,_Error3);function FilterExists(filter){_classCallCheck(this,FilterExists);return _possibleConstructorReturn(this,(FilterExists.__proto__||Object.getPrototypeOf(FilterExists)).call(this,'Filter with same "'+filter.identifier+' identifier found."'))}return FilterExists}(Error),FetchFail:function(_Error4){_inherits(FetchFail,_Error4);function FetchFail(response){_classCallCheck(this,FetchFail);return _possibleConstructorReturn(this,(FetchFail.__proto__||Object.getPrototypeOf(FetchFail)).call(this,'Could not fetch "'+response.url+'", received "'+response.status+": "+response.statusText+'".'))}return FetchFail}(Error),InvalidCryptoKey:function(_Error5){_inherits(InvalidCryptoKey,_Error5);function InvalidCryptoKey(){_classCallCheck(this,InvalidCryptoKey);return _possibleConstructorReturn(this,(InvalidCryptoKey.__proto__||Object.getPrototypeOf(InvalidCryptoKey)).call(this,"Invalid cryptographic key."))}return InvalidCryptoKey}(Error),InvalidCryptoLib:function(_Error6){_inherits(InvalidCryptoLib,_Error6);function InvalidCryptoLib(){_classCallCheck(this,InvalidCryptoLib);return _possibleConstructorReturn(this,(InvalidCryptoLib.__proto__||Object.getPrototypeOf(InvalidCryptoLib)).call(this,"Invalid cryptographic algorithm name."))}return InvalidCryptoLib}(Error),FailedCrypto:function(_Error7){_inherits(FailedCrypto,_Error7);function FailedCrypto(err){_classCallCheck(this,FailedCrypto);return _possibleConstructorReturn(this,(FailedCrypto.__proto__||Object.getPrototypeOf(FailedCrypto)).call(this,"Failed to decrypt file"+(err&&err.message?" "+err.message:"")+"."))}return FailedCrypto}(Error)};module.exports=Errors},function(module,exports,__webpack_require__){"use strict";var Permission={ALLOWED:0,REQUIRED:1,FORBIDDEN:2};module.exports=Permission},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__(29);var Permission=__webpack_require__(17);var Identifier=__webpack_require__(0);var configuration=new Configuration;MediaTag.PdfPlugin=PdfPlugin;MediaTag.PdfPlugin.viewer="/pdfjs/web/viewer.html";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 Action={clear:__webpack_require__(24),show:__webpack_require__(14),hide:__webpack_require__(13),upgrade:__webpack_require__(26),downgrade:__webpack_require__(25),activate:__webpack_require__(9)};module.exports=Action},function(module,exports,__webpack_require__){"use strict";module.exports=function(mediaObject){mediaObject.clearContents()}},function(module,exports,__webpack_require__){"use strict";var activate=__webpack_require__(9);module.exports=function(mediaTag){var index=mediaTag.mediaObjects.indexOf(mediaTag.activeMediaObject);if(index>0){activate(mediaTag.mediaObjects[index-1],mediaTag)}}},function(module,exports,__webpack_require__){"use strict";var activate=__webpack_require__(9);module.exports=function(mediaTag){var index=mediaTag.mediaObjects.indexOf(mediaTag.activeMediaObject);if(index1){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=window.nacl;var rdm=Nacl.randomBytes(18);return 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=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(AttributeObject){var array=AttributeObject.getAttribute("src").split("://");if(array.length>1){return array[1].split("/")[0]}return window.location.hostname}},{key:"source",value:function source(AttributeObject){var source=AttributeObject.getAttribute("src");return source}},{key:"schemes",value:function schemes(AttributeObject){return/\w+:/.exec(AttributeObject.getAttribute("src"))}},{key:"sources",value:function sources(AttributeObject){var sources=AttributeObject.getAttribute("sources")||AttributeObject.getAttribute("srcs");if(sources){return JSON.parse(sources)}return null}},{key:"actions",value:function actions(AttributeObject){var actions=AttributeObject.getAttribute("actions");if(actions){return JSON.parse(actions)}return null}},{key:"parse",value:function parse(AttributeObject){return{protocol:Parser.protocol(AttributeObject),hostname:Parser.hostname(AttributeObject),src:Parser.source(AttributeObject),type:Parser.type(AttributeObject),extension:Parser.extension(AttributeObject),mime:Parser.mime(AttributeObject),sources:Parser.sources(AttributeObject),actions:Parser.actions(AttributeObject)}}}]);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(!plugin){return}try{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}}catch(err){console.error(err,this.snapshots[stackId])}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 hide=__webpack_require__(13);var show=__webpack_require__(14);module.exports=function(mediaObjectToActivate,mediaTag){mediaTag.mediaObjects.forEach(function(mediaObject){hide(mediaObject)});mediaTag.activeMediaObject=mediaObjectToActivate;show(mediaObjectToActivate)}},function(module,exports,__webpack_require__){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i0}}]);return AttributesObject}();module.exports=AttributesObject},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 Errors={PluginExists:function(_Error){_inherits(PluginExists,_Error);function PluginExists(objPlugin){_classCallCheck(this,PluginExists);return _possibleConstructorReturn(this,(PluginExists.__proto__||Object.getPrototypeOf(PluginExists)).call(this,'Plugin with same "'+objPlugin.identifier+'" identifier found.'))}return PluginExists}(Error),TypeNotFound:function(_Error2){_inherits(TypeNotFound,_Error2);function TypeNotFound(){_classCallCheck(this,TypeNotFound);return _possibleConstructorReturn(this,(TypeNotFound.__proto__||Object.getPrototypeOf(TypeNotFound)).call(this,"Media Tag could not find the content type of an instance.}."))}return TypeNotFound}(Error),FilterExists:function(_Error3){_inherits(FilterExists,_Error3);function FilterExists(filter){_classCallCheck(this,FilterExists);return _possibleConstructorReturn(this,(FilterExists.__proto__||Object.getPrototypeOf(FilterExists)).call(this,'Filter with same "'+filter.identifier+' identifier found."'))}return FilterExists}(Error),FetchFail:function(_Error4){_inherits(FetchFail,_Error4);function FetchFail(response){_classCallCheck(this,FetchFail);return _possibleConstructorReturn(this,(FetchFail.__proto__||Object.getPrototypeOf(FetchFail)).call(this,'Could not fetch "'+response.url+'", received "'+response.status+": "+response.statusText+'".'))}return FetchFail}(Error),InvalidCryptoKey:function(_Error5){_inherits(InvalidCryptoKey,_Error5);function InvalidCryptoKey(){_classCallCheck(this,InvalidCryptoKey);return _possibleConstructorReturn(this,(InvalidCryptoKey.__proto__||Object.getPrototypeOf(InvalidCryptoKey)).call(this,"Invalid cryptographic key."))}return InvalidCryptoKey}(Error),InvalidCryptoLib:function(_Error6){_inherits(InvalidCryptoLib,_Error6);function InvalidCryptoLib(){_classCallCheck(this,InvalidCryptoLib);return _possibleConstructorReturn(this,(InvalidCryptoLib.__proto__||Object.getPrototypeOf(InvalidCryptoLib)).call(this,"Invalid cryptographic algorithm name."))}return InvalidCryptoLib}(Error),FailedCrypto:function(_Error7){_inherits(FailedCrypto,_Error7);function FailedCrypto(err){_classCallCheck(this,FailedCrypto);return _possibleConstructorReturn(this,(FailedCrypto.__proto__||Object.getPrototypeOf(FailedCrypto)).call(this,"Failed to decrypt file"+(err&&err.message?" "+err.message:"")+"."))}return FailedCrypto}(Error)};module.exports=Errors},function(module,exports,__webpack_require__){"use strict";var Permission={ALLOWED:0,REQUIRED:1,FORBIDDEN:2};module.exports=Permission},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__(29);var Permission=__webpack_require__(17);var Identifier=__webpack_require__(0);var configuration=new Configuration;MediaTag.PdfPlugin=PdfPlugin;MediaTag.PdfPlugin.viewer="/pdfjs/web/viewer.html";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 Action={clear:__webpack_require__(24),show:__webpack_require__(14),hide:__webpack_require__(13),upgrade:__webpack_require__(26),downgrade:__webpack_require__(25),activate:__webpack_require__(9)};module.exports=Action},function(module,exports,__webpack_require__){"use strict";module.exports=function(mediaObject){mediaObject.clearContents()}},function(module,exports,__webpack_require__){"use strict";var activate=__webpack_require__(9);module.exports=function(mediaTag){var index=mediaTag.mediaObjects.indexOf(mediaTag.activeMediaObject);if(index>0){activate(mediaTag.mediaObjects[index-1],mediaTag)}}},function(module,exports,__webpack_require__){"use strict";var activate=__webpack_require__(9);module.exports=function(mediaTag){var index=mediaTag.mediaObjects.indexOf(mediaTag.activeMediaObject);if(index1){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=window.nacl;var rdm=Nacl.randomBytes(18);return Nacl.util.encodeBase64(rdm)}},{key:"getKeyFromStr",value:function getKeyFromStr(str){return window.nacl.util.decodeBase64(str)}},{key:"encrypt",value:function encrypt(){}},{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=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(AttributeObject){var array=AttributeObject.getAttribute("src").split("://");if(array.length>1){return array[1].split("/")[0]}return window.location.hostname}},{key:"source",value:function source(AttributeObject){var source=AttributeObject.getAttribute("src");return source}},{key:"schemes",value:function schemes(AttributeObject){return/\w+:/.exec(AttributeObject.getAttribute("src"))}},{key:"sources",value:function sources(AttributeObject){var sources=AttributeObject.getAttribute("sources")||AttributeObject.getAttribute("srcs");if(sources){return JSON.parse(sources)}return null}},{key:"actions",value:function actions(AttributeObject){var actions=AttributeObject.getAttribute("actions");if(actions){return JSON.parse(actions)}return null}},{key:"parse",value:function parse(AttributeObject){return{protocol:Parser.protocol(AttributeObject),hostname:Parser.hostname(AttributeObject),src:Parser.source(AttributeObject),type:Parser.type(AttributeObject),extension:Parser.extension(AttributeObject),mime:Parser.mime(AttributeObject),sources:Parser.sources(AttributeObject),actions:Parser.actions(AttributeObject)}}}]);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(!plugin){return}try{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}}catch(err){console.error(err,this.snapshots[stackId])}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 Date: Mon, 17 Jul 2017 11:56:34 +0200 Subject: [PATCH 03/10] stub invite app --- www/invite/main.js | 16 ++++++++++++++++ www/invite/main.less | 13 +++++++++++++ www/profile/main.js | 1 + 3 files changed, 30 insertions(+) diff --git a/www/invite/main.js b/www/invite/main.js index 0ad8138e7..7f216892c 100644 --- a/www/invite/main.js +++ b/www/invite/main.js @@ -5,6 +5,22 @@ define([ '/common/curve.js', 'less!/invite/main.less', ], function ($, Cryptpad, Listmap, Curve) { + var Messages = Cryptpad.Messages; + var comingSoon = function () { + return $('
', { + 'class': 'coming-soon', + }) + .text(Messages.comingSoon) + .append('
'); + }; + + $(function () { + Cryptpad.removeLoadingScreen(); + console.log("wut"); + $('body #mainBlock').append(comingSoon()); + }); + return; + var APP = window.APP = {}; //var Messages = Cryptpad.Messages; diff --git a/www/invite/main.less b/www/invite/main.less index d3d3f2e07..4ef2a8fa4 100644 --- a/www/invite/main.less +++ b/www/invite/main.less @@ -1,3 +1,4 @@ +/* .cp { #mainBlock { z-index: 1; @@ -135,3 +136,15 @@ justify-content: center; } } +*/ + +.coming-soon { + text-align: center; + font-size: 25px; + + height: 100%; + display: flex; + flex-flow: column; + align-items: center; + justify-content: center; +} diff --git a/www/profile/main.js b/www/profile/main.js index 03ec334d8..364b6ea87 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -164,6 +164,7 @@ define([ }; var addCreateInviteLinkButton = function ($container) { + return; var obj = APP.lm.proxy; var proxy = Cryptpad.getProxy(); From 6306de52652beef674320b6ba18db7dc5ea2b1d1 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 13:43:51 +0200 Subject: [PATCH 04/10] set avatar border-radius to 4px --- customize.dist/src/less/mixins.less | 2 +- www/profile/main.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less/mixins.less b/customize.dist/src/less/mixins.less index 08876a291..cd900a60c 100644 --- a/customize.dist/src/less/mixins.less +++ b/customize.dist/src/less/mixins.less @@ -78,7 +78,7 @@ height: @width; justify-content: center; align-items: center; - border-radius: @width / 2px; + border-radius: 4px; overflow: hidden; box-sizing: content-box; } diff --git a/www/profile/main.less b/www/profile/main.less index 0de830fde..d0aa180de 100644 --- a/www/profile/main.less +++ b/www/profile/main.less @@ -23,7 +23,7 @@ height: 300px; width: 300px; border: 1px solid black; - border-radius: 150px; + border-radius: 4px; overflow: hidden; position: relative; .delete { From 2e0aa185cdc142e5b73029d8539331fa1190fc12 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 14:12:05 +0200 Subject: [PATCH 05/10] uppercase first letter of new translation keys --- customize.dist/translations/messages.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index d028bc29f..df1cfc5d2 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -263,8 +263,8 @@ define(function () { out.profile_viewMyProfile = "View my profile"; // friends/userlist - out.userlist_addAsFriendTitle = 'add "{0}" as a friend'; - out.userlist_thisIsYou = 'this is you ("{0}")'; + out.userlist_addAsFriendTitle = 'Add "{0}" as a friend'; + out.userlist_thisIsYou = 'This is you ("{0}")'; // File manager From 756b561bbc00e46fbded7fb7993ea3dede41b7dc Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 14:12:30 +0200 Subject: [PATCH 06/10] lint compliance --- www/invite/main.js | 6 ++++-- www/profile/main.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/www/invite/main.js b/www/invite/main.js index 7f216892c..21d084757 100644 --- a/www/invite/main.js +++ b/www/invite/main.js @@ -2,9 +2,9 @@ define([ 'jquery', '/common/cryptpad-common.js', '/bower_components/chainpad-listmap/chainpad-listmap.js', - '/common/curve.js', + //'/common/curve.js', 'less!/invite/main.less', -], function ($, Cryptpad, Listmap, Curve) { +], function ($, Cryptpad /*, Listmap, Curve*/) { var Messages = Cryptpad.Messages; var comingSoon = function () { return $('
', { @@ -21,6 +21,7 @@ define([ }); return; + /* jshint ignore:start */ var APP = window.APP = {}; //var Messages = Cryptpad.Messages; @@ -99,4 +100,5 @@ define([ andThen(); }); }); + /* jshint ignore:end */ }); diff --git a/www/profile/main.js b/www/profile/main.js index 364b6ea87..4c9274d90 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -82,7 +82,7 @@ define([ var CREATE_ID = "createProfile"; var HEADER_ID = "header"; var HEADER_RIGHT_ID = "rightside"; - var CREATE_INVITE_BUTTON = 'inviteButton'; + var CREATE_INVITE_BUTTON = 'inviteButton'; /* jshint ignore: line */ var VIEW_PROFILE_BUTTON = 'viewProfileButton'; var createEditableInput = function ($block, name, ph, getValue, setValue, realtime, fallbackValue) { @@ -158,6 +158,7 @@ define([ }; */ +/* jshint ignore:start */ var isFriend = function (proxy, edKey) { var friends = Cryptpad.find(proxy, ['friends']); return typeof(edKey) === 'string' && friends && (edKey in friends); @@ -205,6 +206,7 @@ define([ }) .appendTo($container); }; + /* jshint ignore:end */ var addViewButton = function ($container) { if (!Cryptpad.isLoggedIn() || window.location.hash) { @@ -239,7 +241,7 @@ define([ $span.text(value || Messages.anonymous); }); - addCreateInviteLinkButton($block); + //addCreateInviteLinkButton($block); return; } var setValue = function (value, cb) { From 06c971ec47dc440ff23bdb759250b06e28ddc1ff Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 15:52:13 +0200 Subject: [PATCH 07/10] s/friend/contact/g --- customize.dist/translations/messages.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index df1cfc5d2..a8371ad5a 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -262,8 +262,8 @@ define(function () { out.profile_inviteExplanation = "Clicking OK will create a link to a secure messaging session that only {0} will be able to redeem.

The link will be copied to your clipboard and can be shared publicly."; out.profile_viewMyProfile = "View my profile"; - // friends/userlist - out.userlist_addAsFriendTitle = 'Add "{0}" as a friend'; + // contacts/userlist + out.userlist_addAsFriendTitle = 'Add "{0}" as a contact'; out.userlist_thisIsYou = 'This is you ("{0}")'; // File manager From a28a59abf0752a421495082ba03064f343e9b4fa Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 16:34:47 +0200 Subject: [PATCH 08/10] harden server further against bad channel ids --- rpc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc.js b/rpc.js index e54362e98..73fb43736 100644 --- a/rpc.js +++ b/rpc.js @@ -28,8 +28,8 @@ var WARN = function (e, output) { }; var isValidId = function (chan) { - return chan && chan.length && /^[a-fA-F0-9]/.test(chan) || - [32, 48].indexOf(chan.length) !== -1; + return chan && chan.length && /^[a-fA-F0-9]/.test(chan) && + [32, 48].indexOf(chan.length) > -1; }; var uint8ArrayToHex = function (a) { From f2320190b8985b3b38c9527b970476a58e7ffb09 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 17:18:28 +0200 Subject: [PATCH 09/10] change friends url to /contacts/ --- customize.dist/pages.js | 2 +- customize.dist/src/less/toolbar.less | 2 +- customize.dist/template.js | 6 +++--- www/{friends => contacts}/index.html | 0 www/{friends => contacts}/inner.html | 2 +- www/{friends => contacts}/inner.js | 2 +- www/{friends => contacts}/main.js | 0 www/{friends => contacts}/main.less | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename www/{friends => contacts}/index.html (100%) rename www/{friends => contacts}/inner.html (75%) rename www/{friends => contacts}/inner.js (93%) rename www/{friends => contacts}/main.js (100%) rename www/{friends => contacts}/main.less (100%) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index a62c962fb..6fac30280 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -481,7 +481,7 @@ define([ return loadingScreen(); }; - Pages['/friends/'] = Pages['/friends/index.html'] = function () { + Pages['/contacts/'] = Pages['/contacts/index.html'] = function () { return loadingScreen(); }; diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 2b3135848..3e0458dae 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -265,7 +265,7 @@ body { @color: @toolbar-file-color; .addToolbarColors(@color, @bgcolor); } - &.app-friends { + &.app-contacts { @bgcolor: @toolbar-friends-bg; @color: @toolbar-friends-color; .addToolbarColors(@color, @bgcolor); diff --git a/customize.dist/template.js b/customize.dist/template.js index ca0fb7bd3..7fc7172ce 100644 --- a/customize.dist/template.js +++ b/customize.dist/template.js @@ -12,7 +12,7 @@ $(function () { var Messages = Cryptpad.Messages; var $body = $('body'); var isMainApp = function () { - return /^\/(pad|code|slide|poll|whiteboard|file|media|friends|drive|settings|profile)\/$/.test(location.pathname); + return /^\/(pad|code|slide|poll|whiteboard|file|media|contacts|drive|settings|profile)\/$/.test(location.pathname); }; var rightLink = function (ref, loc, txt) { @@ -148,9 +148,9 @@ $(function () { } else if (/\/file\//.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); require([ '/file/main.js' ], ready); - } else if (/friends/.test(pathname)) { + } else if (/contacts/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); - require([ '/friends/main.js' ], ready); + require([ '/contacts/main.js' ], ready); } else if (/pad/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); require([ '/pad/main.js' ], ready); diff --git a/www/friends/index.html b/www/contacts/index.html similarity index 100% rename from www/friends/index.html rename to www/contacts/index.html diff --git a/www/friends/inner.html b/www/contacts/inner.html similarity index 75% rename from www/friends/inner.html rename to www/contacts/inner.html index 3809c9ac6..ebfb164c8 100644 --- a/www/friends/inner.html +++ b/www/contacts/inner.html @@ -3,7 +3,7 @@ - + diff --git a/www/friends/inner.js b/www/contacts/inner.js similarity index 93% rename from www/friends/inner.js rename to www/contacts/inner.js index 5ea8cf63e..556f37ee3 100644 --- a/www/friends/inner.js +++ b/www/contacts/inner.js @@ -2,7 +2,7 @@ define([ 'jquery', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', - 'less!/friends/main.less', + 'less!/contacts/main.less', 'less!/customize/src/less/toolbar.less', ], function ($) { $('.loading-hidden').removeClass('loading-hidden'); diff --git a/www/friends/main.js b/www/contacts/main.js similarity index 100% rename from www/friends/main.js rename to www/contacts/main.js diff --git a/www/friends/main.less b/www/contacts/main.less similarity index 100% rename from www/friends/main.less rename to www/contacts/main.less From 0cd94e2ba885d7b73b4da8d41eef2048c2fbb448 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 17 Jul 2017 17:38:41 +0200 Subject: [PATCH 10/10] add title to contacts app --- customize.dist/translations/messages.js | 1 + www/contacts/main.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index a8371ad5a..c8a472954 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -265,6 +265,7 @@ define(function () { // contacts/userlist out.userlist_addAsFriendTitle = 'Add "{0}" as a contact'; out.userlist_thisIsYou = 'This is you ("{0}")'; + out.contacts_title = "Contacts"; // File manager diff --git a/www/contacts/main.js b/www/contacts/main.js index c7c57965c..c89d31a95 100644 --- a/www/contacts/main.js +++ b/www/contacts/main.js @@ -25,14 +25,15 @@ define([ var $messages = $iframe.find('#messaging'); var $bar = $iframe.find('.toolbar-container'); - var displayed = ['useradmin', 'newpad', 'limit']; + var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle']; var configTb = { displayed: displayed, ifrw: ifrw, common: Cryptpad, $container: $bar, - network: Cryptpad.getNetwork() + network: Cryptpad.getNetwork(), + pageTitle: Messages.contacts_title, }; var toolbar = APP.toolbar = Toolbar.create(configTb); toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar