Drive in sandboxed iframe

This commit is contained in:
yflory
2017-09-22 19:35:06 +02:00
parent a810d7bd85
commit 47fe7b1c53
12 changed files with 573 additions and 442 deletions

View File

@@ -83,9 +83,9 @@ define([
});
};
exp.anonDriveIntoUser = function (proxy, cb) {
exp.anonDriveIntoUser = function (proxyData, fsHash, cb) {
// Make sure we have an FS_hash and we don't use it, otherwise just stop the migration and cb
if (!localStorage.FS_hash || !Cryptpad.isLoggedIn()) {
if (!fsHash || !Cryptpad.isLoggedIn()) {
if (typeof(cb) === "function") { return void cb(); }
}
// Get the content of FS_hash and then merge the objects, remove the migration key and cb
@@ -102,13 +102,13 @@ define([
return;
}
if (parsed) {
var proxy = proxyData.proxy;
var oldFo = FO.init(parsed.drive, {
Cryptpad: Cryptpad
});
var onMigrated = function () {
oldFo.fixFiles();
var newData = Cryptpad.getStore().getProxy();
var newFo = newData.fo;
var newFo = proxyData.fo;
var oldRecentPads = parsed.drive[newFo.FILES_DATA];
var newRecentPads = proxy.drive[newFo.FILES_DATA];
var newFiles = newFo.getFiles([newFo.FILES_DATA]);
@@ -150,7 +150,7 @@ define([
if (!proxy.FS_hashes || !Array.isArray(proxy.FS_hashes)) {
proxy.FS_hashes = [];
}
proxy.FS_hashes.push(localStorage.FS_hash);
proxy.FS_hashes.push(fsHash);
if (typeof(cb) === "function") { cb(); }
};
oldFo.migrate(onMigrated);
@@ -158,7 +158,7 @@ define([
}
if (typeof(cb) === "function") { cb(); }
};
Crypt.get(localStorage.FS_hash, todo);
Crypt.get(fsHash, todo);
};
return exp;