mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-22 21:29:14 +00:00
PR feedback
This commit is contained in:
parent
60c6bc3e48
commit
39b9d6e1d8
@ -53,14 +53,14 @@ __embarkIPFS.saveText = function (text) {
|
|||||||
var promise = new Promise(function (resolve, reject) {
|
var promise = new Promise(function (resolve, reject) {
|
||||||
if (!self._ipfsConnection) {
|
if (!self._ipfsConnection) {
|
||||||
var connectionError = new Error(NoConnectionError);
|
var connectionError = new Error(NoConnectionError);
|
||||||
reject(connectionError);
|
return reject(connectionError);
|
||||||
}
|
}
|
||||||
self._ipfsConnection.add(self._ipfsConnection.Buffer.from(text), function (err, result) {
|
self._ipfsConnection.add(self._ipfsConnection.Buffer.from(text), function (err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
return reject(err);
|
||||||
} else {
|
|
||||||
resolve(result[0].path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolve(result[0].path);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ __embarkIPFS.get = function (hash) {
|
|||||||
var promise = new Promise(function (resolve, reject) {
|
var promise = new Promise(function (resolve, reject) {
|
||||||
if (!self._ipfsConnection) {
|
if (!self._ipfsConnection) {
|
||||||
var connectionError = new Error(NoConnectionError);
|
var connectionError = new Error(NoConnectionError);
|
||||||
reject(connectionError);
|
return reject(connectionError);
|
||||||
}
|
}
|
||||||
self._ipfsConnection.get(hash, function (err, files) {
|
self._ipfsConnection.get(hash, function (err, files) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -98,7 +98,7 @@ __embarkIPFS.uploadFile = function (inputSelector) {
|
|||||||
var promise = new Promise(function (resolve, reject) {
|
var promise = new Promise(function (resolve, reject) {
|
||||||
if (!self._ipfsConnection) {
|
if (!self._ipfsConnection) {
|
||||||
var connectionError = new Error(NoConnectionError);
|
var connectionError = new Error(NoConnectionError);
|
||||||
reject(connectionError);
|
return reject(connectionError);
|
||||||
}
|
}
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onloadend = function () {
|
reader.onloadend = function () {
|
||||||
@ -106,10 +106,10 @@ __embarkIPFS.uploadFile = function (inputSelector) {
|
|||||||
var buffer = self._ipfsConnection.Buffer.from(fileContent);
|
var buffer = self._ipfsConnection.Buffer.from(fileContent);
|
||||||
self._ipfsConnection.add(buffer, function (err, result) {
|
self._ipfsConnection.add(buffer, function (err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
return reject(err);
|
||||||
} else {
|
|
||||||
resolve(result[0].path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolve(result[0].path);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
reader.readAsArrayBuffer(file);
|
reader.readAsArrayBuffer(file);
|
||||||
|
@ -105,10 +105,10 @@ __embarkSwarm.getUrl = function (hash) {
|
|||||||
|
|
||||||
const NotAvailable = "Not available with Swarm";
|
const NotAvailable = "Not available with Swarm";
|
||||||
|
|
||||||
__embarkSwarm.resolve = function () {
|
__embarkSwarm.resolve = function (_name, callback) {
|
||||||
return new Error(NotAvailable);
|
callback(NotAvailable);
|
||||||
};
|
};
|
||||||
|
|
||||||
__embarkSwarm.register = function () {
|
__embarkSwarm.register = function (_addr, callback) {
|
||||||
return new Error(NotAvailable);
|
callback(NotAvailable);
|
||||||
};
|
};
|
||||||
|
@ -215,6 +215,8 @@ class Storage extends React.Component {
|
|||||||
</FormGroup>
|
</FormGroup>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
<Alert bsStyle="warning">The 2 functions below are only available with IPFS</Alert>
|
||||||
|
|
||||||
<h3>Register to IPNS</h3>
|
<h3>Register to IPNS</h3>
|
||||||
<Form inline onKeyDown={(e) => this.checkEnter(e, this.ipnsRegister)}>
|
<Form inline onKeyDown={(e) => this.checkEnter(e, this.ipnsRegister)}>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user