show the size of your files, if you're logged in

This commit is contained in:
ansuz
2017-04-18 15:49:04 +02:00
parent 2b8579e8b7
commit 347459781c
3 changed files with 71 additions and 20 deletions

View File

@@ -676,6 +676,14 @@ define([
rpc.getFileListSize(cb);
};
var getFileSize = common.getFileSize = function (href, cb) {
var channelId = Hash.hrefToHexChannelId(href);
rpc.getFileSize(channelId, function (e, bytes) {
if (e) { return void cb(e); }
cb(void 0, bytes);
});
};
var createButton = common.createButton = function (type, rightside, data, callback) {
var button;
var size = "17px";

View File

@@ -83,7 +83,14 @@ define([
// get the total stored size of a channel's patches (in bytes)
exp.getFileSize = function (file, cb) {
rpc.send('GET_FILE_SIZE', file, cb);
rpc.send('GET_FILE_SIZE', file, function (e, response) {
if (e) { return void cb(e); }
if (response && response.length) {
cb(void 0, response[0]);
} else {
cb('INVALID_RESPONSE');
}
});
};
// get the combined size of all channels (in bytes) for all the
@@ -93,6 +100,8 @@ define([
if (e) { return void cb(e); }
if (response && response.length) {
cb(void 0, response[0]);
} else {
cb('INVALID_RESPONSE');
}
});
};