From db5d5b02364a6a173515e34689c171f47f4093cc Mon Sep 17 00:00:00 2001 From: aleitner Date: Wed, 21 Sep 2016 17:49:12 -0400 Subject: [PATCH] Handle downloadedshard --- app/client.js | 32 ++++++++++++++++++++++++++++++++ app/storjshare.html | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/client.js b/app/client.js index c77b769..cba0f0f 100644 --- a/app/client.js +++ b/app/client.js @@ -315,6 +315,38 @@ var main = new Vue({ farmer.join(function(err) { self.transitioning = false; + farmer.dataChannelServer.on('shardUploaded', function(item, contact) { + console.log(JSON.parse(JSON.stringify(item))); + var message = new storj.deps.kad.Message( + { + method: 'TRIGGER', + params: { + behavior: 'ProveUploadReceipt', + contents: { + item: item.hash + // rmd160sha265: storj.utils.rmd160sha256(item, 'hex'), + // sha1whirlpool: storj.utils.sha1whirlpool(item, 'hex') + } + }, + contact: { + address: tab.network.hostname, + port: tab.network.port, + nodeID: farmer.contact.nodeID, + protocol: storj.version.protocol + }, + } + ); + + farmer.transport.send(contact, message, function(err, response) { + if (err) { + console.log(err.message); + logger.error(err.message); + } + + console.log(response); + }); + }); + if (self.userdata.appSettings.reportTelemetry) { self.startReportingTelemetry(tab); } diff --git a/app/storjshare.html b/app/storjshare.html index 28344b3..d44c451 100644 --- a/app/storjshare.html +++ b/app/storjshare.html @@ -22,7 +22,7 @@