Merge branch 'staging' into communities-trim
This commit is contained in:
@@ -93,7 +93,15 @@ Channel.removeOwnedChannel = function (Env, safeKey, channelId, cb) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Channel.removeOwnedChannelHistory = function (Env, channelId, unsafeKey, hash, cb) { // XXX UNSAFE
|
Channel.trimHistory = function (Env, safeKey, data, cb) {
|
||||||
|
if (!(data && typeof(data.channel) === 'string' && typeof(data.hash) === 'string' && data.hash.length === 64)) {
|
||||||
|
return void cb('INVALID_ARGS');
|
||||||
|
}
|
||||||
|
|
||||||
|
var channelId = data.channel;
|
||||||
|
var unsafeKey = Util.unescapeKeyCharacters(safeKey);
|
||||||
|
var hash = data.hash;
|
||||||
|
|
||||||
nThen(function (w) {
|
nThen(function (w) {
|
||||||
Metadata.getMetadata(Env, channelId, w(function (err, metadata) {
|
Metadata.getMetadata(Env, channelId, w(function (err, metadata) {
|
||||||
if (err) { return void cb(err); }
|
if (err) { return void cb(err); }
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ Core.expireSession = function (Sessions, safeKey) {
|
|||||||
|
|
||||||
Core.expireSessionAsync = function (Env, safeKey, cb) {
|
Core.expireSessionAsync = function (Env, safeKey, cb) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
Core.expireSession(Sessions, safeKey);
|
Core.expireSession(Env.Sessions, safeKey);
|
||||||
cb(void 0, 'OK');
|
cb(void 0, 'OK');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ const AUTHENTICATED_USER_TARGETED = {
|
|||||||
UNPIN: Pinning.unpinChannel,
|
UNPIN: Pinning.unpinChannel,
|
||||||
CLEAR_OWNED_CHANNEL: Channel.clearOwnedChannel,
|
CLEAR_OWNED_CHANNEL: Channel.clearOwnedChannel,
|
||||||
REMOVE_OWNED_CHANNEL: Channel.removeOwnedChannel,
|
REMOVE_OWNED_CHANNEL: Channel.removeOwnedChannel,
|
||||||
|
TRIM_HISTORY: Channel.trimHistory,
|
||||||
UPLOAD_STATUS: Upload.status,
|
UPLOAD_STATUS: Upload.status,
|
||||||
UPLOAD: Upload.upload,
|
UPLOAD: Upload.upload,
|
||||||
UPLOAD_COMPLETE: Upload.complete,
|
UPLOAD_COMPLETE: Upload.complete,
|
||||||
@@ -166,11 +167,6 @@ var handleAuthenticatedMessage = function (Env, map) {
|
|||||||
|
|
||||||
switch (msg[0]) {
|
switch (msg[0]) {
|
||||||
case 'COOKIE': return void Respond(void 0);
|
case 'COOKIE': return void Respond(void 0);
|
||||||
case 'TRIM_OWNED_CHANNEL_HISTORY':
|
|
||||||
return void Channel.removeOwnedChannelHistory(Env, msg[1], publicKey, msg[2], function (e) { // XXX USER_TARGETED_DOUBLE
|
|
||||||
if (e) { return void Respond(e); }
|
|
||||||
Respond(void 0, 'OK');
|
|
||||||
});
|
|
||||||
case 'WRITE_LOGIN_BLOCK':
|
case 'WRITE_LOGIN_BLOCK':
|
||||||
return void Block.writeLoginBlock(Env, msg[1], function (e) { // XXX SPECIAL
|
return void Block.writeLoginBlock(Env, msg[1], function (e) { // XXX SPECIAL
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -196,8 +192,6 @@ var handleAuthenticatedMessage = function (Env, map) {
|
|||||||
Respond(void 0, result);
|
Respond(void 0, result);
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
console.log(msg);
|
|
||||||
throw new Error("OOPS");
|
|
||||||
return void Respond('UNSUPPORTED_RPC_CALL', msg);
|
return void Respond('UNSUPPORTED_RPC_CALL', msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user