From 89a0e8689d86d4c131f4d3d61501f51c4c4bf86d Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Thu, 26 Apr 2018 11:06:50 +0300 Subject: [PATCH] feat(filters): adult filter --- src/app/filters-page.js | 14 ++++++++++++++ src/background/config.js | 3 ++- src/background/spider.js | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/app/filters-page.js b/src/app/filters-page.js index bf9d7d4..a831e2b 100644 --- a/src/app/filters-page.js +++ b/src/app/filters-page.js @@ -115,6 +115,20 @@ export default class ConfigPage extends Page { + { + if(!this.options.filters) + return + + this.options.filters.adultFilter = checked + this.forceUpdate() + }} + /> + + { this.toRemoveProbably && this.toRemoveProbably > 0 ? diff --git a/src/background/config.js b/src/background/config.js index 0e2d654..d89c421 100644 --- a/src/background/config.js +++ b/src/background/config.js @@ -39,7 +39,8 @@ let config = { filters: { maxFiles: 0, - namingRegExp: '' + namingRegExp: '', + adultFilter: false, }, cleanup: true, diff --git a/src/background/spider.js b/src/background/spider.js index d6c0bb4..b0d5253 100644 --- a/src/background/spider.js +++ b/src/background/spider.js @@ -393,6 +393,12 @@ const checkTorrent = (torrent) => { return false } + if(config.filters.adultFilter && torrent.contentCategory === 'xxx') + { + console.log('ignore torrent', torrent.name, 'because adult filter') + return false + } + return true }