Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
dac9d0647d
@ -1,6 +1,7 @@
|
|||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar {
|
.cryptpad-toolbar {
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
.cryptpad-toolbar {
|
.cryptpad-toolbar {
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
<input type="button" name="dl" id="dl" class="inputfile" />
|
<input type="button" name="dl" id="dl" class="inputfile" />
|
||||||
<label for="dl" class="block unselectable" data-localization-title="download_button"
|
<label for="dl" class="block unselectable" data-localization-title="download_button"
|
||||||
data-localization="download_button"></label>
|
data-localization="download_button"></label>
|
||||||
<span class="block" id="progress"> </span>
|
<span class="block" id="progress"></span>
|
||||||
</div>
|
</div>
|
||||||
<table id="status" style="display: none;">
|
<table id="status" style="display: none;">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -26,6 +26,9 @@ define([
|
|||||||
var $table = $iframe.find('#status');
|
var $table = $iframe.find('#status');
|
||||||
var $progress = $iframe.find('#progress');
|
var $progress = $iframe.find('#progress');
|
||||||
|
|
||||||
|
$iframe.find('body').on('dragover', function (e) { e.preventDefault(); });
|
||||||
|
$iframe.find('body').on('drop', function (e) { e.preventDefault(); });
|
||||||
|
|
||||||
Cryptpad.addLoadingScreen();
|
Cryptpad.addLoadingScreen();
|
||||||
|
|
||||||
var Title;
|
var Title;
|
||||||
@ -211,13 +214,10 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var exportFile = function () {
|
var exportFile = function () {
|
||||||
var suggestion = document.title;
|
var filename = Cryptpad.fixFileName(document.title);
|
||||||
Cryptpad.prompt(Messages.exportPrompt,
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
||||||
Cryptpad.fixFileName(suggestion), function (filename) {
|
var blob = new Blob([myFile], {type: myDataType});
|
||||||
if (!(typeof(filename) === 'string' && filename)) { return; }
|
saveAs(blob, filename);
|
||||||
var blob = new Blob([myFile], {type: myDataType});
|
|
||||||
saveAs(blob, filename);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Title = Cryptpad.createTitle({}, function(){}, Cryptpad);
|
Title = Cryptpad.createTitle({}, function(){}, Cryptpad);
|
||||||
@ -250,40 +250,50 @@ define([
|
|||||||
|
|
||||||
if (!uploadMode) {
|
if (!uploadMode) {
|
||||||
$dlform.show();
|
$dlform.show();
|
||||||
Cryptpad.removeLoadingScreen();
|
var src = Cryptpad.getBlobPathFromHex(hexFileName);
|
||||||
$dlform.find('#dl').click(function () {
|
var cryptKey = secret.keys && secret.keys.fileKeyStr;
|
||||||
if (myFile) { return void exportFile(); }
|
var key = Nacl.util.decodeBase64(cryptKey);
|
||||||
|
|
||||||
var src = Cryptpad.getBlobPathFromHex(hexFileName);
|
FileCrypto.fetchDecryptedMetadata(src, key, function (e, metadata) {
|
||||||
var cryptKey = secret.keys && secret.keys.fileKeyStr;
|
if (e) { return void console.error(e); }
|
||||||
var key = Nacl.util.decodeBase64(cryptKey);
|
var title = document.title = metadata.name;
|
||||||
|
Title.updateTitle(title || Title.defaultTitle);
|
||||||
|
|
||||||
/* return FileCrypto.fetchDecryptedMetadata(src, key, function (e, metadata) {
|
Cryptpad.removeLoadingScreen();
|
||||||
if (e) { return console.error(e); }
|
var decrypting = false;
|
||||||
console.log(metadata);
|
$dlform.find('#dl, #progress').click(function () {
|
||||||
});*/
|
if (decrypting) { return; }
|
||||||
return Cryptpad.fetch(src, function (e, u8) {
|
if (myFile) { return void exportFile(); }
|
||||||
if (e) { return void Cryptpad.alert(e); }
|
decrypting = true;
|
||||||
|
|
||||||
// now decrypt the u8
|
return Cryptpad.fetch(src, function (e, u8) {
|
||||||
if (!u8 || !u8.length) {
|
|
||||||
return void Cryptpad.errorLoadingScreen(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileCrypto.decrypt(u8, key, function (e, data) {
|
|
||||||
if (e) {
|
if (e) {
|
||||||
return console.error(e);
|
decrypting = false;
|
||||||
|
return void Cryptpad.alert(e);
|
||||||
}
|
}
|
||||||
console.log(data);
|
|
||||||
var title = document.title = data.metadata.name;
|
// now decrypt the u8
|
||||||
myFile = data.content;
|
if (!u8 || !u8.length) {
|
||||||
myDataType = data.metadata.type;
|
return void Cryptpad.errorLoadingScreen(e);
|
||||||
Title.updateTitle(title || Title.defaultTitle);
|
}
|
||||||
exportFile();
|
|
||||||
}, function (progress) {
|
FileCrypto.decrypt(u8, key, function (e, data) {
|
||||||
var p = progress * 100 +'%';
|
if (e) {
|
||||||
$progress.width(p);
|
decrypting = false;
|
||||||
console.error(progress);
|
return console.error(e);
|
||||||
|
}
|
||||||
|
console.log(data);
|
||||||
|
var title = document.title = data.metadata.name;
|
||||||
|
myFile = data.content;
|
||||||
|
myDataType = data.metadata.type;
|
||||||
|
Title.updateTitle(title || Title.defaultTitle);
|
||||||
|
exportFile();
|
||||||
|
decrypting = false;
|
||||||
|
}, function (progress) {
|
||||||
|
var p = progress * 100 +'%';
|
||||||
|
$progress.width(p);
|
||||||
|
console.error(progress);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -341,6 +351,7 @@ define([
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
})
|
})
|
||||||
.on('drop', function (e) {
|
.on('drop', function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
var dropped = e.originalEvent.dataTransfer.files;
|
var dropped = e.originalEvent.dataTransfer.files;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
$label.removeClass('hovering');
|
$label.removeClass('hovering');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user