updated claim-name verification process

This commit is contained in:
bill bittner 2017-09-27 12:12:42 -07:00
parent 2a9aad3b56
commit 53b8fb9766
5 changed files with 63 additions and 72 deletions

View file

@ -18,21 +18,6 @@ function handleResponse ({ data }, resolve, reject) {
} }
module.exports = { module.exports = {
getWalletList () {
logger.debug('lbryApi >> getting wallet list');
return new Promise((resolve, reject) => {
axios
.post('http://localhost:5279/lbryapi', {
method: 'wallet_list',
})
.then(response => {
handleResponse(response, resolve, reject);
})
.catch(error => {
reject(error);
});
});
},
publishClaim (publishParams) { publishClaim (publishParams) {
logger.debug(`lbryApi >> Publishing claim to "${publishParams.name}"`); logger.debug(`lbryApi >> Publishing claim to "${publishParams.name}"`);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View file

@ -2,7 +2,6 @@ const logger = require('winston');
const config = require('config'); const config = require('config');
const fs = require('fs'); const fs = require('fs');
const db = require('../models'); const db = require('../models');
const { getWalletList } = require('./lbryApi.js');
module.exports = { module.exports = {
validateFile (file, name, license, nsfw) { validateFile (file, name, license, nsfw) {
@ -113,21 +112,17 @@ module.exports = {
db.File.findAll({ where: { name } }) db.File.findAll({ where: { name } })
.then(result => { .then(result => {
if (result.length >= 1) { if (result.length >= 1) {
// filter out any results that were not published from a spee.ch wallet address const claimAddress = config.get('WalletConfig.LbryClaimAddress');
getWalletList() // filter out any results that were not published from spee.ch's wallet address
.then((walletList) => { const filteredResult = result.filter((claim) => {
const filteredResult = result.filter((claim) => { return (claim.address === claimAddress);
return walletList.includes(claim.address);
});
if (filteredResult.length >= 1) {
resolve(false);
} else {
resolve(true);
}
})
.catch((error) => {
reject(error);
}); });
// return based on whether any non-spee.ch claims were left
if (filteredResult.length >= 1) {
resolve(false);
} else {
resolve(true);
}
} else { } else {
resolve(true); resolve(true);
} }

View file

@ -79,9 +79,13 @@ footer {
} }
.row--wide { .row--wide {
padding: 1em 0px 1em 0px; padding-right: 0px;
margin: 0px; padding-left: 0px;
}
.row--thin {
padding-top: 0.5em;
padding-bottom: 0.5em;
} }
.top-bar { .top-bar {
@ -217,6 +221,13 @@ input:-webkit-autofill {
border-bottom: 1px solid grey; border-bottom: 1px solid grey;
} }
.input-checkbox, .input-textarea {
border: 1px solid grey;
}
.label--secondary {
color: grey;
}
/* BUTTONS */ /* BUTTONS */
button { button {

View file

@ -38,22 +38,6 @@
margin-bottom: 1em; margin-bottom: 1em;
} }
#claim-name-input-area {
border-bottom: 1px blue solid;
float: left;
margin-bottom: 1em;
font-weight: bold;
}
.publish-input, #publish-license {
border: 1px solid lightgrey;
}
.publish-input {
padding: 1%;
width: 90%
}
/* show routes */ /* show routes */
.show-asset { .show-asset {
width: 100%; width: 100%;

View file

@ -7,31 +7,47 @@
</div> </div>
</div> </div>
<div class="row" id="details-detail" hidden="true"> <div id="details-detail" hidden="true">
<div class="row row--thin">
<div class="column column--3">
<label for="publish-title" class="label label--secondary">Title: </label>
</div>
<div class="column column--9">
<input type="text" id="publish-title" class="input-text input-text--primary">
</div>
</div>
<div class="row row--thin">
<div class="column column--3">
<label for="publish-description" class="label label--secondary">Description: </label>
</div>
<div class="column column--9">
<textarea rows="2" id="publish-description" class="input-textarea"></textarea>
</div>
</div>
<div class="row row--thin">
<div class="column column--3">
<label for="publish-license" class="label label--secondary">License:* </label>
</div>
<div class="column column--9">
<select type="text" id="publish-license" class="select select--primary">
<option value="Public Domain">Public Domain</option>
<option value="Creative Commons">Creative Commons</option>
</select>
</div>
</div>
<div class="row row--thin">
<div class="column column--3">
<label for="publish-nsfw" class="label label--secondary">NSFW*</label>
</div>
<div class="column column--9">
<input class="input-checkbox" type="checkbox" id="publish-nsfw">
</div>
</div>
<table>
<tr>
<td><label for="publish-title">Title: </label></td>
<td><input type="text" id="publish-title" class="input-text input-text--primary"></td>
</tr>
<tr>
<td><label for="publish-description">Description: </label></td>
<td><textarea rows="2" id="publish-description" class="textarea textarea--primary"> </textarea></td>
</tr>
<tr>
<td><label for="publish-license">License:* </label></td>
<td>
<select type="text" id="publish-license" name="license" value="license">
<option value="Public Domain">Public Domain</option>
<option value="Creative Commons">Creative Commons</option>
</select>
</td>
</tr>
<tr>
<td><label for="publish-nsfw">NSFW*</label></td>
<td><input type="checkbox" id="publish-nsfw"></td>
</tr>
</table>
</div> </div>