feat(p2p): information about feed

This commit is contained in:
Alexey Kasyanchuk 2018-07-18 11:33:25 +03:00
parent 8792da82d5
commit bd8921c186
2 changed files with 31 additions and 27 deletions

View File

@ -16,12 +16,12 @@ export default class ConfigPage extends Page {
this.setTitle('Rats filters');
this.options = {}
this.basicTypes = ['video',
'audio',
'pictures',
'books',
'application',
'archive',
'disc']
'audio',
'pictures',
'books',
'application',
'archive',
'disc']
this.contentType = this.basicTypes.slice(0)
this.descriptions = {
main: __('All'),
@ -190,28 +190,28 @@ export default class ConfigPage extends Page {
}
<div className='column w100p'>
<div style={{flex: 1, padding: '8px 0px'}}>{__('disable some categories')}:</div>
{
this.basicTypes.map(type => (<Checkbox
label={this.descriptions[type]}
checked={this.contentType && this.contentType.indexOf(type) >= 0}
onCheck={e => {
if(e.target.checked)
{
this.contentType.push(type)
}
else
{
const index = this.contentType.indexOf(type)
this.contentType.splice(index, 1)
}
if(this.contentType.length == 0)
this.contentType = this.basicTypes.slice(0)
<div style={{flex: 1, padding: '8px 0px'}}>{__('disable some categories')}:</div>
{
this.basicTypes.map(type => (<Checkbox
label={this.descriptions[type]}
checked={this.contentType && this.contentType.indexOf(type) >= 0}
onCheck={e => {
if(e.target.checked)
{
this.contentType.push(type)
}
else
{
const index = this.contentType.indexOf(type)
this.contentType.splice(index, 1)
}
if(this.contentType.length == 0)
this.contentType = this.basicTypes.slice(0)
this.forceUpdate()
}}
/>))
}
this.forceUpdate()
}}
/>))
}
</div>
{

View File

@ -891,6 +891,10 @@ module.exports = async ({
// store torrent to feed
await feed.load()
Object.defineProperty(p2p.info, 'feed', {
enumerable: true,
get: () => feed.size()
});
p2pStore.on('store', async ({data: record, temp, myself}) => {
if(record.type !== 'vote')
return