Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Commit

Permalink
Merge pull request #991 from lbryio/staging
Browse files Browse the repository at this point in the history
Cuts release from staging
  • Loading branch information
jessopb authored Apr 15, 2019
2 parents 792bb51 + e21761e commit 2ec4f36
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
1 change: 0 additions & 1 deletion client/scss/_asset-preview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
}

.asset-preview__label {
height: 100%;
padding: $thin-padding;
display: flex;
flex-direction: column;
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 20 additions & 10 deletions server/controllers/api/file/availability/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const logger = require('winston');

const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
const db = require('../../../../models');
const { getFileListFileByOutpoint } = require('server/lbrynet');

const chainquery = require('chainquery').default;

/*
Expand All @@ -10,18 +14,24 @@ const db = require('../../../../models');
const fileAvailability = ({ ip, originalUrl, params }, res) => {
const name = params.name;
const claimId = params.claimId;
db.File
.findOne({
where: {
name,
claimId,
},
logger.debug(`fileAvailability params: name:${name} claimId:${claimId}`);
// TODO: we probably eventually want to check the publishCache for the claimId too,
// and shop the outpoint to file_list.
return chainquery.claim.queries
.resolveClaim(name, claimId)
.then(result => {
return `${result.dataValues.transaction_hash_id}:${result.dataValues.vout}`;
})
.then(outpoint => {
logger.debug(`fileAvailability: outpoint: ${outpoint}`);
return getFileListFileByOutpoint(outpoint);
})
.then(result => {
if (result) {
return res.status(200).json({success: true, data: true});
if (result && result[0]) {
return res.status(200).json({ success: true, data: true });
} else {
res.status(200).json({ success: true, data: false });
}
res.status(200).json({success: true, data: false});
})
.catch(error => {
handleErrorResponse(originalUrl, ip, error, res);
Expand Down

0 comments on commit 2ec4f36

Please sign in to comment.