diff --git a/src/app/filters-page.js b/src/app/filters-page.js index 146bc35..ff244da 100644 --- a/src/app/filters-page.js +++ b/src/app/filters-page.js @@ -77,20 +77,26 @@ export default class ConfigPage extends Page { - -
- { - window.torrentSocket.emit('removeTorrents', true, window.customLoader((toRemove) => { - this.toRemoveProbably = toRemove - this.forceUpdate() - })); - }} /> - { - window.torrentSocket.emit('removeTorrents', false, window.customLoader((toRemove) => { - this.toRemove = toRemove - this.forceUpdate() - })); - }} /> +
+
+
Torrent name regular extension filtering
+ { + if(!this.options.filters) + return + + this.options.filters.namingRegExp = value + this.forceUpdate() + }} + /> +
+
+ * - clean string means disabled +
{ @@ -114,6 +120,21 @@ export default class ConfigPage extends Page {
Settings saved
} +
+ { + window.torrentSocket.emit('removeTorrents', true, window.customLoader((toRemove) => { + this.toRemoveProbably = toRemove + this.forceUpdate() + })); + }} /> + { + window.torrentSocket.emit('removeTorrents', false, window.customLoader((toRemove) => { + this.toRemove = toRemove + this.forceUpdate() + })); + }} /> +
+
{ this.saveSettings() diff --git a/src/background/config.js b/src/background/config.js index 7d60d1a..673e4ab 100644 --- a/src/background/config.js +++ b/src/background/config.js @@ -38,6 +38,7 @@ let config = { filters: { maxFiles: 0, + namingRegExp: '' }, cleanup: true, diff --git a/src/background/spider.js b/src/background/spider.js index 5f3898c..01e7bec 100644 --- a/src/background/spider.js +++ b/src/background/spider.js @@ -454,6 +454,17 @@ const checkTorrent = (torrent) => { return false } + const nameRX = config.filters.namingRegExp && config.filters.namingRegExp.trim() + if(nameRX && nameRX.length > 0) + { + const rx = new RegExp(nameRX) + if(!rx.test(torrent.name)) + { + console.log('ignore', torrent.name, 'by naming rx') + return false + } + } + return true }