update ipfs lib

This commit is contained in:
Iuri Matias 2017-12-13 10:59:53 -05:00
parent 0b00f99f09
commit 12c8e223d6
3 changed files with 14 additions and 14 deletions

View File

@ -280,8 +280,8 @@ EmbarkJS.Storage.IPFS.get = function(hash) {
var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()'); var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Storage.setProvider()');
reject(connectionError); reject(connectionError);
} }
EmbarkJS.Storage.ipfsConnection.object.get([hash]).then(function(node) { EmbarkJS.Storage.ipfsConnection.object.get(hash).then(function(node) {
resolve(node.data); resolve(node.data.toString());
}).catch(function(err) { }).catch(function(err) {
reject(err); reject(err);
}); });

View File

@ -30,7 +30,7 @@
"follow-redirects": "^1.2.4", "follow-redirects": "^1.2.4",
"fs-extra": "^2.0.0", "fs-extra": "^2.0.0",
"globule": "^1.1.0", "globule": "^1.1.0",
"ipfs-api": "6.0.2", "ipfs-api": "17.2.4",
"merge": "^1.2.0", "merge": "^1.2.0",
"mocha": "^2.2.5", "mocha": "^2.2.5",
"orbit-db": "^0.17.3", "orbit-db": "^0.17.3",

View File

@ -59,19 +59,19 @@ $(document).ready(function() {
//EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'}); //EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'});
$("#storage .error").hide(); $("#storage .error").hide();
EmbarkJS.Storage.ipfsConnection.ping() //EmbarkJS.Storage.ipfsConnection.ping()
.then(function(){ //.then(function(){
$("#status-storage").addClass('status-online'); $("#status-storage").addClass('status-online');
$("#storage-controls").show(); $("#storage-controls").show();
}) //})
.catch(function(err) { //.catch(function(err) {
if(err){ // if(err){
console.log("IPFS Connection Error => " + err.message); // console.log("IPFS Connection Error => " + err.message);
$("#storage .error").show(); // $("#storage .error").show();
$("#status-storage").addClass('status-offline'); // $("#status-storage").addClass('status-offline');
$("#storage-controls").hide(); // $("#storage-controls").hide();
} // }
}); //});
$("#storage button.setIpfsText").click(function() { $("#storage button.setIpfsText").click(function() {
var value = $("#storage input.ipfsText").val(); var value = $("#storage input.ipfsText").val();