From 4161d1da32a25cbe75f63c050a1578ce82187b70 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 3 Aug 2017 10:42:02 -0700 Subject: [PATCH] updated startup to continue if DL directory isn't available --- helpers/lbryApi.js | 21 ++++++++------------- views/allClaims.handlebars | 4 ++-- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/helpers/lbryApi.js b/helpers/lbryApi.js index ea08f0b4..e4d529a5 100644 --- a/helpers/lbryApi.js +++ b/helpers/lbryApi.js @@ -4,7 +4,7 @@ const logger = require('winston'); module.exports = { getWalletList () { logger.debug('getting wallet list'); - const deferred = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { method: 'wallet_list', @@ -17,11 +17,10 @@ module.exports = { reject(error); }); }); - return deferred; }, publishClaim (publishParams) { logger.debug(`Publishing claim to "${publishParams.name}"`); - const deferred = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { method: 'publish', @@ -35,11 +34,10 @@ module.exports = { reject(error); }); }); - return deferred; }, getClaim (uri) { logger.debug(`Getting Claim for "${uri}"`); - const deferred = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { method: 'get', @@ -63,11 +61,10 @@ module.exports = { reject(error); }); }); - return deferred; }, getClaimsList (claimName) { logger.debug(`Getting Claim List for "${claimName}"`); - const deferred = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { method: 'claim_list', @@ -80,11 +77,10 @@ module.exports = { reject(error); }); }); - return deferred; }, resolveUri (uri) { logger.debug(`Resolving URI for "${uri}"`); - const deferred = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { method: 'resolve', @@ -101,11 +97,10 @@ module.exports = { reject(error); }); }); - return deferred; }, getDownloadDirectory () { logger.debug('Retrieving the download directory path from lbry daemon...'); - const deferred = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { axios .post('http://localhost:5279/lbryapi', { method: 'settings_get', @@ -118,9 +113,9 @@ module.exports = { } }) .catch((error) => { - reject(error); + logger.error('Unable to retrieve daemon download directory. Restart spee.ch once the daemon is ready. Using default "/home/lbry/Downloads".', error); + resolve('/home/lbry/Downloads/'); }); }); - return deferred; }, }; diff --git a/views/allClaims.handlebars b/views/allClaims.handlebars index 449807f7..4c258f53 100644 --- a/views/allClaims.handlebars +++ b/views/allClaims.handlebars @@ -5,12 +5,12 @@

These are all the free, public assets at that claim. You can publish more at spee.ch.

{{#each claims}}
- +