Fallback to the public dev server if cats don't work

This commit is contained in:
haad 2016-05-25 11:21:58 +02:00
parent afd1351fdc
commit 7b5c4225d8

View File

@ -145,6 +145,7 @@ class OrbitDB {
return new Promise((resolve, reject) => {
if(this._ipfs.files.cat) {
logger.debug(".cat with js-ipfs");
setTimeout(reject, 10000);
this._ipfs.files.cat(hash, (err, res) => {
if(err) return reject(err);
let buf = '';
@ -163,22 +164,19 @@ class OrbitDB {
const readNetworkInfo = (hash) => {
return new Promise((resolve, reject) => {
catFromJsIpfsApi(hash).then(resolve)
.catch((e) => {
catFromJsIpfs(hash).then(resolve)
.catch((e) => {
logger.warn(".cat - no api or content found, using mock")
resolve(JSON.stringify({
name: 'localhost dev network',
publishers: ['localhost:3333']
}))
// catFromJsIpfsApi(hash).then(resolve)
// .catch((e) => {
// catFromJsIpfs(hash).then(resolve)
// .catch((e) => {
// logger.warn(".cat - no api or content found, using mock")
// resolve(JSON.stringify({
// name: 'localhost dev network',
// publishers: ['localhost:3333']
// }))
// })
// })
// name: 'localhost dev network',
name: 'Orbit DEV Network',
// publishers: ['localhost:3333']
publishers: ['178.62.241.75:3333']
}));
});
});
});
};