updated startup to continue if DL directory isn't available

This commit is contained in:
bill bittner 2017-08-03 10:42:02 -07:00
parent e8a89ca795
commit 4161d1da32
2 changed files with 10 additions and 15 deletions

View file

@ -4,7 +4,7 @@ const logger = require('winston');
module.exports = { module.exports = {
getWalletList () { getWalletList () {
logger.debug('getting wallet list'); logger.debug('getting wallet list');
const deferred = new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios axios
.post('http://localhost:5279/lbryapi', { .post('http://localhost:5279/lbryapi', {
method: 'wallet_list', method: 'wallet_list',
@ -17,11 +17,10 @@ module.exports = {
reject(error); reject(error);
}); });
}); });
return deferred;
}, },
publishClaim (publishParams) { publishClaim (publishParams) {
logger.debug(`Publishing claim to "${publishParams.name}"`); logger.debug(`Publishing claim to "${publishParams.name}"`);
const deferred = new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios axios
.post('http://localhost:5279/lbryapi', { .post('http://localhost:5279/lbryapi', {
method: 'publish', method: 'publish',
@ -35,11 +34,10 @@ module.exports = {
reject(error); reject(error);
}); });
}); });
return deferred;
}, },
getClaim (uri) { getClaim (uri) {
logger.debug(`Getting Claim for "${uri}"`); logger.debug(`Getting Claim for "${uri}"`);
const deferred = new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios axios
.post('http://localhost:5279/lbryapi', { .post('http://localhost:5279/lbryapi', {
method: 'get', method: 'get',
@ -63,11 +61,10 @@ module.exports = {
reject(error); reject(error);
}); });
}); });
return deferred;
}, },
getClaimsList (claimName) { getClaimsList (claimName) {
logger.debug(`Getting Claim List for "${claimName}"`); logger.debug(`Getting Claim List for "${claimName}"`);
const deferred = new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios axios
.post('http://localhost:5279/lbryapi', { .post('http://localhost:5279/lbryapi', {
method: 'claim_list', method: 'claim_list',
@ -80,11 +77,10 @@ module.exports = {
reject(error); reject(error);
}); });
}); });
return deferred;
}, },
resolveUri (uri) { resolveUri (uri) {
logger.debug(`Resolving URI for "${uri}"`); logger.debug(`Resolving URI for "${uri}"`);
const deferred = new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios axios
.post('http://localhost:5279/lbryapi', { .post('http://localhost:5279/lbryapi', {
method: 'resolve', method: 'resolve',
@ -101,11 +97,10 @@ module.exports = {
reject(error); reject(error);
}); });
}); });
return deferred;
}, },
getDownloadDirectory () { getDownloadDirectory () {
logger.debug('Retrieving the download directory path from lbry daemon...'); logger.debug('Retrieving the download directory path from lbry daemon...');
const deferred = new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios axios
.post('http://localhost:5279/lbryapi', { .post('http://localhost:5279/lbryapi', {
method: 'settings_get', method: 'settings_get',
@ -118,9 +113,9 @@ module.exports = {
} }
}) })
.catch((error) => { .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;
}, },
}; };

View file

@ -5,12 +5,12 @@
<p>These are all the free, public assets at that claim. You can publish more at <a href="/">spee.ch</a>.</p> <p>These are all the free, public assets at that claim. You can publish more at <a href="/">spee.ch</a>.</p>
{{#each claims}} {{#each claims}}
<div class="all-claims-item"> <div class="all-claims-item">
<img class="all-claims-img" src="/{{this.name}}/{{this.claim_id}}" /> <img class="all-claims-img" src="/{{this.claim_id}}/{{this.name}}/" />
<div class="all-claims-details"> <div class="all-claims-details">
<ul style="list-style-type:none"> <ul style="list-style-type:none">
<li>claim: {{this.name}}</li> <li>claim: {{this.name}}</li>
<li>claim_id: {{this.claim_id}}</li> <li>claim_id: {{this.claim_id}}</li>
<li>direct link: <a href="/{{this.name}}/{{this.claim_id}}">spee.ch/{{this.name}}/{{this.claim_id}}</a></li> <li>link: <a href="/{{this.claim_id}}/{{this.name}}">spee.ch/{{this.name}}/{{this.claim_id}}</a></li>
<li>author: {{this.value.stream.metadata.author}}</li> <li>author: {{this.value.stream.metadata.author}}</li>
<li>description: {{this.value.stream.metadata.description}}</li> <li>description: {{this.value.stream.metadata.description}}</li>
<li>license: {{this.value.stream.metadata.license}}</li> <li>license: {{this.value.stream.metadata.license}}</li>