Merge branch 'master' of github.com:xwiki-labs/cryptpad

pull/1/head
yflory 7 years ago
commit 4b0a2c4c9e

@ -3,6 +3,11 @@ const Fs = require('fs');
const Semaphore = require('saferphore'); const Semaphore = require('saferphore');
const nThen = require('nthen'); const nThen = require('nthen');
/*
takes contents of a pinFile (UTF8 string)
and the pin file's name
returns an array of of channel ids which are pinned
*/
const hashesFromPinFile = (pinFile, fileName) => { const hashesFromPinFile = (pinFile, fileName) => {
var pins = {}; var pins = {};
pinFile.split('\n').filter((x)=>(x)).map((l) => JSON.parse(l)).forEach((l) => { pinFile.split('\n').filter((x)=>(x)).map((l) => JSON.parse(l)).forEach((l) => {
@ -10,8 +15,7 @@ const hashesFromPinFile = (pinFile, fileName) => {
case 'RESET': { case 'RESET': {
pins = {}; pins = {};
if (l[1] && l[1].length) { l[1].forEach((x) => { pins[x] = 1; }); } if (l[1] && l[1].length) { l[1].forEach((x) => { pins[x] = 1; }); }
//jshint -W086 break;
// fallthrough
} }
case 'PIN': { case 'PIN': {
l[1].forEach((x) => { pins[x] = 1; }); l[1].forEach((x) => { pins[x] = 1; });

@ -124,6 +124,12 @@ define([
var rightsideDisplayed = false; var rightsideDisplayed = false;
$(window.document).on('decryption', function (e) { $(window.document).on('decryption', function (e) {
/* FIXME
we're listening for decryption events and assuming that only
the main media-tag exists. In practice there is also your avatar
and there could be other things in the future, so we should
figure out a generic way target media-tag decryption events.
*/
var decrypted = e.originalEvent; var decrypted = e.originalEvent;
if (decrypted.callback) { if (decrypted.callback) {
decrypted.callback(); decrypted.callback();
@ -133,9 +139,6 @@ define([
$dlform.hide(); $dlform.hide();
var $dlButton = $dlview.find('media-tag button'); var $dlButton = $dlview.find('media-tag button');
if (ev) { $dlButton.click(); } if (ev) { $dlButton.click(); }
if (!$dlButton.length) {
$appContainer.css('background', 'white');
}
$dlButton.addClass('btn btn-success'); $dlButton.addClass('btn btn-success');
var text = Messages.download_mt_button + '<br>'; var text = Messages.download_mt_button + '<br>';
text += '<b>' + Util.fixHTML(title) + '</b><br>'; text += '<b>' + Util.fixHTML(title) + '</b><br>';

Loading…
Cancel
Save