mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
Adding register
This commit is contained in:
parent
1427b4596d
commit
174412bee1
@ -132,10 +132,25 @@ __embarkIPFS.resolve = function (name, callback) {
|
||||
return callback(name + " is not registered");
|
||||
}
|
||||
callback(err, res.value);
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
__embarkIPFS.lookup = function () {
|
||||
console.error("Not Available");
|
||||
};
|
||||
|
||||
__embarkIPFS.register = function(addr, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!this._ipfsConnection) {
|
||||
var connectionError = new Error('No IPFS connection. Please ensure to call Embark.Names.setProvider()');
|
||||
return callback(connectionError);
|
||||
}
|
||||
|
||||
this._ipfsConnection.name.publish(addr, function (err, res) {
|
||||
if (err) {
|
||||
return callback(addr + " is not publ");
|
||||
}
|
||||
|
||||
callback(err, `https://gateway.ipfs.io/ipns/${res.name}`);
|
||||
});
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user