Use user object as default store in file manager

This commit is contained in:
yflory
2016-12-20 17:27:45 +01:00
parent 4aed585574
commit c359c27997
7 changed files with 68 additions and 32 deletions

View File

@@ -19,6 +19,7 @@ define([
var storeObj;
var ready = false;
var filesOp;
var exp = {};
var safeSet = function (key, val) {
storeObj[key] = val;
@@ -85,6 +86,10 @@ define([
cb();
};
Store.getProxy = function () {
return exp;
};
var changeHandlers = Store.changeHandlers = [];
Store.change = function (f) {
@@ -134,7 +139,9 @@ define([
};
var rt = window.rt = Listmap.create(listmapConfig);
exp.proxy = rt.proxy;
rt.proxy.on('create', function (info) {
exp.info = info;
var realtime = info.realtime;
if (!Cryptpad.getUserHash()) {
localStorage.FS_hash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
@@ -170,12 +177,12 @@ define([
};
Store.ready = function (f, Cryptpad) {
if (Cryptpad.parsePadUrl(window.location.href).type === "file") {
/*if (Cryptpad.parsePadUrl(window.location.href).type === "file") {
if (typeof(f) === 'function') {
f(void 0, Cryptpad.getStore(true));
}
return;
}
}*/
if (ready) {
if (typeof(f) === 'function') {
f(void 0, Store);