|
|
|
@ -369,7 +369,8 @@ define([
|
|
|
|
|
content.hashes[i] = {
|
|
|
|
|
file: data.url,
|
|
|
|
|
hash: ev.hash,
|
|
|
|
|
index: ev.index
|
|
|
|
|
index: ev.index,
|
|
|
|
|
version: NEW_VERSION
|
|
|
|
|
};
|
|
|
|
|
oldHashes = JSON.parse(JSON.stringify(content.hashes));
|
|
|
|
|
content.locks = {};
|
|
|
|
@ -596,7 +597,13 @@ define([
|
|
|
|
|
if (arrayBuffer) {
|
|
|
|
|
var u8 = new Uint8Array(arrayBuffer);
|
|
|
|
|
FileCrypto.decrypt(u8, key, function (err, decrypted) {
|
|
|
|
|
if (err) { return void console.error(err); }
|
|
|
|
|
if (err) {
|
|
|
|
|
if (err === "DECRYPTION_ERROR") {
|
|
|
|
|
console.warn(err);
|
|
|
|
|
return void onCpError(err);
|
|
|
|
|
}
|
|
|
|
|
return void console.error(err);
|
|
|
|
|
}
|
|
|
|
|
var blob = new Blob([decrypted.content], {type: 'plain/text'});
|
|
|
|
|
if (cb) {
|
|
|
|
|
return cb(blob, getFileType());
|
|
|
|
@ -890,7 +897,7 @@ define([
|
|
|
|
|
var handleNewLocks = function (o, n) {
|
|
|
|
|
var hasNew = false;
|
|
|
|
|
// Check if we have at least one new lock
|
|
|
|
|
Object.keys(n).some(function (id) {
|
|
|
|
|
Object.keys(n || {}).some(function (id) {
|
|
|
|
|
if (typeof(n[id]) !== "object") { return; } // Ignore old format
|
|
|
|
|
// n[id] = { uid: lock, uid2: lock2 };
|
|
|
|
|
return Object.keys(n[id]).some(function (uid) {
|
|
|
|
@ -902,7 +909,7 @@ define([
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// Remove old locks
|
|
|
|
|
Object.keys(o).forEach(function (id) {
|
|
|
|
|
Object.keys(o || {}).forEach(function (id) {
|
|
|
|
|
if (typeof(o[id]) !== "object") { return; } // Ignore old format
|
|
|
|
|
Object.keys(o[id]).forEach(function (uid) {
|
|
|
|
|
// Removed lock
|
|
|
|
|