Add a new hash version for the file viewer

This commit is contained in:
yflory
2017-04-25 17:19:13 +02:00
parent 5194677443
commit d985b144cc
5 changed files with 42 additions and 22 deletions

View File

@@ -20,25 +20,30 @@ define([
var andThen = function () {
var $bar = $iframe.find('.toolbar-container');
var secret = Cryptpad.getSecrets();
var readOnly = secret.keys && !secret.keys.editKeyStr;
if (!secret.keys) {
secret.keys = secret.key;
}
if (secret.keys) { throw new Error("You need a hash"); } // TODO
var cryptKey = secret.key;
var fileId = secret.file;
var hexFileName = Cryptpad.base64ToHex(fileId);
var type = secret.type;
// Test hash:
// #/2/K6xWU-LT9BJHCQcDCT-DcQ/TBo77200c0e-FdldQFcnQx4Y/image-png
var $mt = $iframe.find('#encryptedFile');
$mt.attr('src', './assets/image.png-encrypted');
$mt.attr('data-crypto-key', 'TBo77200c0e/FdldQFcnQx4Y');
$mt.attr('data-type', 'image/png');
$mt.attr('src', '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName);
$mt.attr('data-crypto-key', cryptKey);
$mt.attr('data-type', type);
require(['/common/media-tag.js'], function (MediaTag) {
MediaTag($mt[0]);
Cryptpad.removeLoadingScreen();
var configTb = {
displayed: ['useradmin', 'newpad'],
ifrw: ifrw,
common: Cryptpad
};
toolbar = Toolbar.create($bar, null, null, null, null, configTb);
var configTb = {
displayed: ['useradmin', 'newpad'],
ifrw: ifrw,
common: Cryptpad
};
Toolbar.create($bar, null, null, null, null, configTb);
});
};