|
|
@ -145,7 +145,7 @@ var getFreeSpace = Pinning.getFreeSpace = function (Env, safeKey, cb) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getHash = Pinning.getHash = function (Env, safeKey, cb) {
|
|
|
|
Pinning.getHash = function (Env, safeKey, cb) {
|
|
|
|
getChannelList(Env, safeKey, function (channels) {
|
|
|
|
getChannelList(Env, safeKey, function (channels) {
|
|
|
|
Env.hashChannelList(channels, cb);
|
|
|
|
Env.hashChannelList(channels, cb);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -166,7 +166,7 @@ Pinning.pinChannel = function (Env, safeKey, channels, cb) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (toStore.length === 0) {
|
|
|
|
if (toStore.length === 0) {
|
|
|
|
return void getHash(Env, safeKey, cb);
|
|
|
|
return void cb();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getMultipleFileSize(Env, toStore, function (e, sizes) {
|
|
|
|
getMultipleFileSize(Env, toStore, function (e, sizes) {
|
|
|
@ -208,7 +208,7 @@ Pinning.unpinChannel = function (Env, safeKey, channels, cb) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (toStore.length === 0) {
|
|
|
|
if (toStore.length === 0) {
|
|
|
|
return void getHash(Env, safeKey, cb);
|
|
|
|
return void cb();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Env.pinStore.message(safeKey, JSON.stringify(['UNPIN', toStore, +new Date()]),
|
|
|
|
Env.pinStore.message(safeKey, JSON.stringify(['UNPIN', toStore, +new Date()]),
|
|
|
@ -222,15 +222,14 @@ Pinning.unpinChannel = function (Env, safeKey, channels, cb) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Pinning.resetUserPins = function (Env, safeKey, channelList, cb) {
|
|
|
|
Pinning.resetUserPins = function (Env, safeKey, channelList, _cb) {
|
|
|
|
|
|
|
|
var cb = Util.once(Util.mkAsync(_cb));
|
|
|
|
if (!Array.isArray(channelList)) { return void cb('INVALID_PIN_LIST'); }
|
|
|
|
if (!Array.isArray(channelList)) { return void cb('INVALID_PIN_LIST'); }
|
|
|
|
var session = Core.getSession(Env.Sessions, safeKey);
|
|
|
|
var session = Core.getSession(Env.Sessions, safeKey);
|
|
|
|
|
|
|
|
|
|
|
|
if (!channelList.length) {
|
|
|
|
|
|
|
|
return void getHash(Env, safeKey, function (e, hash) {
|
|
|
|
if (!channelList.length) { // XXX wut
|
|
|
|
if (e) { return cb(e); }
|
|
|
|
return void cb();
|
|
|
|
cb(void 0, hash);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var pins = {};
|
|
|
|
var pins = {};
|
|
|
|