Authentication #170

Merged
bones7242 merged 43 commits from authentication into master 2017-09-29 02:29:22 +02:00
5 changed files with 63 additions and 72 deletions
Showing only changes of commit 53b8fb9766 - Show all commits

View file

@ -18,21 +18,6 @@ function handleResponse ({ data }, resolve, reject) {
}
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) {
logger.debug(`lbryApi >> Publishing claim to "${publishParams.name}"`);
return new Promise((resolve, reject) => {

View file

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

View file

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

View file

@ -38,22 +38,6 @@
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-asset {
width: 100%;

View file

@ -7,31 +7,47 @@
</div>
</div>
<div class="row" id="details-detail" hidden="true">
<div id="details-detail" hidden="true">
<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">
<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>
</td>
</tr>
<tr>
<td><label for="publish-nsfw">NSFW*</label></td>
<td><input type="checkbox" id="publish-nsfw"></td>
</tr>
</table>
</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>
</div>