|
|
@ -1,9 +1,11 @@
|
|
|
|
define([
|
|
|
|
define([
|
|
|
|
'/file/file-crypto.js',
|
|
|
|
'/file/file-crypto.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
|
|
|
|
'/common/common-util.js',
|
|
|
|
|
|
|
|
'/common/outer/cache-store.js',
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/bower_components/tweetnacl/nacl-fast.min.js',
|
|
|
|
'/bower_components/tweetnacl/nacl-fast.min.js',
|
|
|
|
], function (FileCrypto, Hash, nThen) {
|
|
|
|
], function (FileCrypto, Hash, Util, Cache, nThen) {
|
|
|
|
var Nacl = window.nacl;
|
|
|
|
var Nacl = window.nacl;
|
|
|
|
var module = {};
|
|
|
|
var module = {};
|
|
|
|
|
|
|
|
|
|
|
@ -31,9 +33,11 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var actual = 0;
|
|
|
|
var actual = 0;
|
|
|
|
|
|
|
|
var encryptedArr = [];;
|
|
|
|
var again = function (err, box) {
|
|
|
|
var again = function (err, box) {
|
|
|
|
if (err) { onError(err); }
|
|
|
|
if (err) { onError(err); }
|
|
|
|
if (box) {
|
|
|
|
if (box) {
|
|
|
|
|
|
|
|
encryptedArr.push(box);
|
|
|
|
actual += box.length;
|
|
|
|
actual += box.length;
|
|
|
|
var progressValue = (actual / estimate * 100);
|
|
|
|
var progressValue = (actual / estimate * 100);
|
|
|
|
progressValue = Math.min(progressValue, 100);
|
|
|
|
progressValue = Math.min(progressValue, 100);
|
|
|
@ -55,10 +59,12 @@ define([
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var box_u8 = Util.uint8ArrayJoin(encryptedArr);
|
|
|
|
|
|
|
|
Cache.setBlobCache(id, box_u8, function (err) {
|
|
|
|
|
|
|
|
if (err) { console.warn(err); }
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
common.uploadStatus(teamId, estimate, function (e, pending) {
|
|
|
|
common.uploadStatus(teamId, estimate, function (e, pending) {
|
|
|
|