|
|
@ -65,9 +65,8 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if not box then done
|
|
|
|
// if not box then done
|
|
|
|
Cryptpad.rpc.send('UPLOAD_COMPLETE', '', function (e, res) {
|
|
|
|
Cryptpad.uploadComplete(function (e, id) {
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
var id = res[0];
|
|
|
|
|
|
|
|
var uri = ['', 'blob', id.slice(0,2), id].join('/');
|
|
|
|
var uri = ['', 'blob', id.slice(0,2), id].join('/');
|
|
|
|
console.log("encrypted blob is now available as %s", uri);
|
|
|
|
console.log("encrypted blob is now available as %s", uri);
|
|
|
|
|
|
|
|
|
|
|
@ -78,32 +77,28 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
APP.toolbar.addElement(['fileshare'], {});
|
|
|
|
APP.toolbar.addElement(['fileshare'], {});
|
|
|
|
|
|
|
|
|
|
|
|
// check if the uploaded file can be decrypted
|
|
|
|
var title = document.title = metadata.name;
|
|
|
|
var newU8 = FileCrypto.joinChunks(chunks);
|
|
|
|
myFile = blob;
|
|
|
|
FileCrypto.decrypt(newU8, key, function (e, res) {
|
|
|
|
myDataType = metadata.type;
|
|
|
|
if (e) { return console.error(e); }
|
|
|
|
|
|
|
|
var title = document.title = res.metadata.name;
|
|
|
|
|
|
|
|
myFile = res.content;
|
|
|
|
|
|
|
|
myDataType = res.metadata.type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var defaultName = Cryptpad.getDefaultName(Cryptpad.parsePadUrl(window.location.href));
|
|
|
|
var defaultName = Cryptpad.getDefaultName(Cryptpad.parsePadUrl(window.location.href));
|
|
|
|
Title.updateTitle(title || defaultName);
|
|
|
|
Title.updateTitle(title || defaultName);
|
|
|
|
APP.toolbar.title.show();
|
|
|
|
APP.toolbar.title.show();
|
|
|
|
|
|
|
|
console.log(title);
|
|
|
|
Cryptpad.alert(Messages._getKey('upload_success', [title]));
|
|
|
|
Cryptpad.alert(Messages._getKey('upload_success', [title]));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Cryptpad.rpc.send('UPLOAD_STATUS', estimate, function (e, pending) {
|
|
|
|
Cryptpad.uploadStatus(estimate, function (e, pending) {
|
|
|
|
if (e) {
|
|
|
|
if (e) {
|
|
|
|
console.error(e);
|
|
|
|
console.error(e);
|
|
|
|
return void Cryptpad.alert(Messages.upload_serverError);
|
|
|
|
return void Cryptpad.alert(Messages.upload_serverError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pending[0]) {
|
|
|
|
if (pending) {
|
|
|
|
|
|
|
|
// TODO queue uploads... ?
|
|
|
|
return void Cryptpad.confirm(Messages.upload_uploadPending, function (yes) {
|
|
|
|
return void Cryptpad.confirm(Messages.upload_uploadPending, function (yes) {
|
|
|
|
if (!yes) { return; }
|
|
|
|
if (!yes) { return; }
|
|
|
|
Cryptpad.rpc.send('UPLOAD_CANCEL', '', function (e, res) {
|
|
|
|
Cryptpad.uploadCancel(function (e, res) {
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
console.log(res);
|
|
|
|
console.log(res);
|
|
|
|
next(again);
|
|
|
|
next(again);
|
|
|
|